Main Page | Modules | File List | Globals | Related Pages

Porting

Porting

Functions

Functions which require modifications can be divided into three groups:

JTAG hardware access involves 7 simple macros, 6 of them to switch TMS, TDI and TCK low or high and a single one to query the status on the TDO line of the target device. In addition XsvfInit() is called during startup, which can be used to do any additionally required hardware initialization.

Access to the XSVF data is subdivided into several routines. In general, one simple routine would have been sufficient, which simply returns the next data byte. But there are two reasons for defining separate routines for reading different data types. The first is, that more specific debug output can be generated within these routines. The second reason is related to the byte order used on different platforms to store multibyte values. For example, XSVF stores delay times in a four byte value representing a number of microseconds. The most significant byte comes first, which is called big endian format. Most microcontrollers however use little endian, where the least significant byte comes first. The Nut/OS implementation calls ntohl() and ntohs() for conversion, which are well known functions used in TCP/IP implementations. You need to write your own byte swapping routines, if your host system is little endian and doesn't provide similar functions.

Execution delay isn't really critical as long as you don't under-run the specified time.

File System

The distributed code reads XSVF data from a file, but most environments of tiny microcontrollers do not come with file systems. Fortunately it's no big deal to make host.c reading the data from a different source.

You may start rewriting XsvfGetByte() and call this routine from within all other XsvfGet functions.

Variable Types

The code uses BSD-like type definitions for unsigned values to avoid lengthy declarations. If your environment doesn't support any short forms, then explicitely define u_char, u_short and u_long types in a separate header file, which replaces sys/types.h included by host.h.

Standard Header Files

The majority of header files put in angle brackets are part of the C runtime library. Not all of them may be supported with your host platform, in which case you probably won't need them anyway. They are mainly used for standard I/O, which is not necessarily required.
© 2004 by egnite Software GmbH - visit http://www.ethernut.de/