Home

Dynamic C Function Reference Manual

image

Contents

1. DESCRIPTION Creates a file if it does not already exist The parent directory must already exist In non blocking mode if file is NULL only one file or directory can be created at any one time since a single static FAT ile is used for temporary storage Each time you call this function pass the same dirname pointer not just the same string contents Valid filenames are limited to an 8 character filename and 3 character extension separated by a period this is commonly known as the 8 3 format Examples include but are not limited to 12345678 123 filename txt and webpagel htm PARAMETERS part Pointer to the partition being used filename Pointer to the full pathname of the file to be created alloc size Initial number of bytes to pre allocate Note that at least one cluster will be allocated If there is not enough space beyond the first cluster for the re quested allocation amount the file will be allocated with whatever space is available on the partition but no error code will be returned If not even the first cluster is allocated the ENOSPC error code will return This initial allocation amount is rounded up to the next whole number of clusters file If not NULL the created file is opened and accessible using this handle If NULL the file is closed after it is created RETURN VALUE 0 success EINVAL part filename alloc size or file contain invalid values ENOENT the parent directory does
2. Dynamic C Functions rabbit com 297 OSSetTickPerSec INT16U OSSetTickPerSec INT16U TicksPerSec DESCRIPTION Sets the amount of ticks per second from 1 2048 Ticks per second defaults to 64 If this func tion is used the define OS TICKS PER SEC needs to be changed so that the time delay functions work correctly Since this function uses integer division the actual ticks per second may be slightly different that the desired ticks per second PARAMETERS TicksPerSec Unsigned 16 bit integer RETURN VALUE The actual ticks per second set as an unsigned 16 bit integer LIBRARY UCOS2 LIB SEE ALSO OSStart OSStart void OSStart void DESCRIPTION Starts the multitasking process allowing uC OS II to manage the tasks that have been created Before OSStart is called OSInit MUST have been called and at least one task MUST have been created This function calls OSStartHighRdy which calls OSTaskSwHook and sets OSRunning to TRUE LIBRARY UCOS2 LIB SEE ALSO OSTaskCreate OSTaskCreateExt 298 rabbit com Dynamic C Functions OSStatInit void OSStatInit void DESCRIPTION Determines CPU usage LIBRARY UCOS2 LIB OSTaskChangePrio INT8U OSTaskChangePrio INT8U oldprio INT8U newprio DESCRIPTION Allows a task s priority to be changed dynamically Note that the new priority MUST be avail able PARAMETERS oldprio The priority level to change from newprio The priority level to c
3. Dynamic C Integrated C Development System For Rabbit Microprocessors Function Reference Manual 019 0113 e 090409 M The latest revision of this manual is available on the Rabbit web site www rabbit com for free unregistered download Dynamic C Function Reference Manual Part Number 019 0113 e 090409 M Printed in U S A Digi International Inc 2007 2008 All rights reserved No part of the contents of this manual may be reproduced or transmitted in any form or by any means without the express written permission of Digi International Inc Permission is granted to make one or more copies as long as the copyright page contained therein is included These copies of the manuals may not be let or sold for any reason without the express written permission of Digi International Inc Digi International Inc reserves the right to make changes and improvements to its products without providing notice Trademarks RabbitSys is a trademark of Digi International Inc Rabbit and Dynamic C are registered trademarks of Digi International Inc Windows is a registered trademark of Microsoft Corporation Table of Contents Alphabetical Listing of Dynamic C Functions V Group Listing of Dynamic C Functions XV Arithmetic XV Logging Subsystem XX Bit Manipulation XV MD5 xxi Bus Operation Rabbit 3000 4000 XV MicroC OS II xxi Character XV Miscellaneous xxii Data Encryption XV Multitasking xxii Direct Memory Access R
4. DESCRIPTION Determine if costatement is stopped or running PARAMETERS p Address of costatement RETURN VALUE 1 if costatement is running 0 otherwise LIBRARY COSTATE LIB Dynamic C Functions rabbit com 199 isdigit int isdigit int c DESCRIPTION Tests for a decimal digit 0 9 PARAMETERS c Character to test RETURN VALUE 0 if not a decimal digit 0 otherwise LIBRARY STRING LIB SEE ALSO isxdigit isalpha isalpha 200 rabbit com Dynamic C Functions isgraph int isgraph int c DESCRIPTION Tests for a printing character other than a space 33 lt c lt 126 PARAMETERS c Character to test RETURN VALUE 0 c is not a printing character 0 c is a printing character LIBRARY STRING LIB SEE ALSO isprint isalpha isalnum isdigit ispunct islower int islower int c DESCRIPTION Tests for lower case character PARAMETERS c Character to test RETURN VALUE O if not a lower case character O otherwise LIBRARY STRING LIB SEE ALSO tolower toupper isupper Dynamic C Functions rabbit com 201 isspace int isspace int c DESCRIPTION Tests for a white space character tab return newline vertical tab form feed and space 9 lt c lt 13 and c 32 PARAMETERS c Character to test RETURN VALUE 0 if not O otherwise LIBRARY STRING LIB SEE ALSO ispunct isprint int isprint in
5. DESCRIPTION Gets the current error bits for that qd channel This function is intended to be used with the Rab bit 3000 and Rabbit 4000 PARAMETERS channel The channel to read errors from currently 1 or 2 RETURN VALUE Set of error flags that can be decoded with the following masks OD OVERFLOW 0x01 QD_UNDERFLOW 0x02 LIBRARY QD LIB was in R3000 LIB prior to DC 10 Dynamic C Functions rabbit com 383 qd init void qd init int iplevel DESCRIPTION If your board has a Rabbit 3000A microprocessor installed the quadrature decoder can be set for 10 bit counter operation For 10 bit operation add the following macro at the top of your application program define QD 10BIT OPERATION If the above macro is not defined then the quadrature decoder defaults to 8 bit counter operation With the Rabbit 3000 processor you must use the default 8 bit operation defining the 10 bit macro will cause a compile time error Sample program Samples Rabbit3000 QD Phase 10bit c demonstrates the use of the macro If your board has a Rabbit 4000 microprocessor installed the quadrature decoder inputs must be chosen with one of the following defines Define only one per quadrature decoder define QD1 USEPORTD use port D pins 1 and 0 define QD1 USEPORTEL use port E pins 1 and 0 define QD1 USEPORTEH use port E pins 5 and 4 define QD2 USEPORTD use port D pins 3 and 2 define QD2 USEPORTEL use port E pins 3 an
6. DESCRIPTION Return next available free element from the given pool Eventually your application should re turn this element to the pool using pfree to avoid memory leaks The element is set to all zero bytes before returning PARAMETERS p Pool handle structure as previously passed to pool init RETURN VALUE Null No free elements were available Otherwise pointer to an element If the pool is not linked your application must not write more than p gt e1size bytes to the element this was the el size parameter passed to pool init The application can write up to p gt e1size 4 bytes to the element if the pool is linked An element in root memory has 4 bytes of overhead when the pool is linked LIBRARY POOL LIB SEE ALSO pool init palloc pfree phwm pavail 326 rabbit com Dynamic C Functions pfirst void pfirst Pool t p DESCRIPTION Get the first allocated element in a root pool The pool MUST be set to being a linked pool us ing pool link p lt non zero gt Otherwise the result is undefined PARAMETERS p Pool handle structure as previously passed to pool_init RETURN VALUE Null There are no allocated elements Otherwise pointer to first De oldest allocated element LIBRARY POOL LIB SEE ALSO pool init pool link palloc pfree plast pnext pprev Dynamic C Functions rabbit com 327 pfirst fast xmem void pfirst fast Pool t p DESCRIPTI
7. 1 Clock stretching timeout LIBRARY I2C LIB SEE ALSO Technical Note 215 Using the DC Bus with a Rabbit Microprocessor Dynamic C Functions rabbit com 207 i2c send ack int i2c_send_ack void DESCRIPTION Sends ACK sequence to slave ACK is usually sent after a successful transfer where more bytes are going to be read RETURN VALUE 0 Success 1 Clock stretching timeout LIBRARY I2C LIB SEE ALSO Technical Note 215 Using the I2C Bus with a Rabbit Microprocessor i2c_ send nak int i2c_ send _nak void DESCRIPTION Sends NAK sequence to slave NAK is often sent when the transfer is finished RETURN VALUE 0 Success 1 Clock stretching timeout LIBRARY I2C LIB SEE ALSO Technical Note 215 Using the DC Bus with a Rabbit Microprocessor 208 rabbit com Dynamic C Functions i2c start tx int i2c start tx void DESCRIPTION Initiates I C transmission by sending the start sequence which is defined as a high to low tran sition on SDA while SCL is high The point being that SDA is supposed to remain stable while SCL is high If it does not then that indicates a start S or stop P condition This function first waits for possible clock stretching which is when a bus peripheral holds SCK low RETURN VALUE 0 Success 1 Clock stretching timeout LIBRARY I2C LIB SEE ALSO Technical Note 215 Using the I2C Bus with a Rabbit Microprocessor Dynamic C Functions rabbit
8. Command the serial flash to copy from one of its flash pages to one of its RAM buffers PARAMETERS dev Pointer to ef device struct for initialized flash device bank Which RAM bank to write the data to For Atmel 45DBxxx devices this can be 1 or 2 page The page to read from RETURN VALUE 0 Success 1 Error LIBRARY SFLASH LIB 484 rabbit com Dynamic C Functions sf readRAM int sf readRAM char buffer int offset int len DESCRIPTION Read data from the RAM buffer on the serial flash chip Note This function blocks and only works on boards with one serial flash device PARAMETER buffer Pointer to character buffer to copy data into offset Address in the serial flash RAM to start reading from len Number of bytes to read RETURN VALUE 0 Success 1 Error LIBRARY SFLASH LIB Dynamic C Functions rabbit com 485 sf writeDeviceRAM int sf writeDeviceRAM sf device dev long buffer int offset int len int flags DESCRIPTION Write data to the RAM buffer on the serial flash chip from a buffer in xmem PARAMETER dev Pointer to ef device struct for initialized flash device buffer Pointer to xmem data to write into the flash chip RAM offset The address in the serial flash RAM to start writing at len The number of bytes to write flags Can be one of the following e SF_BITSREVERSED Allows the data to be written to the flash in re verse bit order This improves speed and works fine as long a
9. Dynamic C Functions rabbit com 481 sf RAMToPage int sf RAMToPage long page DESCRIPTION Command the serial flash to write its RAM buffer contents to one of the flash memory pages Note This function blocks and only works on boards with one serial flash device PARAMETER page The page to which the RAM buffer contents will be written t RETURN VALUE 0 for success 1 for error LIBRARY SFLASH LIB 482 rabbit com Dynamic C Functions sf readDeviceRAM int sf readDeviceRAM sf device dev long buffer int offset int len int flags DESCRIPTION Read data from the RAM buffer on the serial flash chip into an xmem buffer PARAMETERS dev buffer offset len flags RETURN VALUE 0 Success 1 Error LIBRARY SFLASH LIB Pointer to ef device struct for initialized flash device Address of an xmem buffer The address in the serial flash RAM to start reading from The number of bytes to read Can be one of the following SF_BITSREVERSED Reads the data in bit reversed order from the flash chip This improves speed but the data must have been also written in re versed order see sf_XWriteRAM SF _RAMBANK1 default Reads from the first RAM bank on the flash de vice SF_RAMBANK2 Reads from the alternate RAM bank on the flash device Dynamic C Functions rabbit com 483 sf readPage int sf readPage sf device dev int bank long page DESCRIPTION Replaces sf_pageToRAM
10. EBUSY if the device is busy Valid prior to Dynamic C 9 01 LIBRARY PART LIB Dynamic C Functions rabbit com 229 mbr EnumDevice mbr EnumDevice mbr drvr driver mbr dev dev int devnum int checktype DESCRIPTION This routine is called to learn about devices present on the driver passed in The device will be added to the linked list of enumerated devices Partition information will be filled in from the master boot record MBR Pointers to file system level partition information structures will be set to NULL PARAMETERS driver Pointer to a DOS contoller structure setup during init of storage device de vicer dev Pointer to a drive structure to be filled in devnum Physical device number of device on the driver checktype Routine that takes an unsigned char partition type and returns 1 if of sought type and zero if not Pass NULL for this parameter to bypass this check RETURN VALUE 0 for success EIO for Error trying to read the device or structure EINVAL if devnum invalid or does not exist ENOMEM if memory for page buffer is not available EUNFORMAT if the device is accessible but not formatted You can use it provided it is for matted partitioned by either this library or another system EBADPART if the partition table on the device is invalid ENOPART if the device does not have any sought partitions If checktype parameter is NULL this test is bypassed This code is superseded by any othe
11. RETURN VALUE The 20 bit physical address of the allocated data on success On error a runtime error occurs Note This return value cannot be used with pointer arithmetic LIBRARY STACK LIB EXCEPTIONS ERR_BADXALLOC if could not allocate requested storage or negative size passed 542 rabbit com Dynamic C Functions xalloc stats void xalloc stats word parm DESCRIPTION Prints a table of available xalloc regions to the Stdio window This function was introduced in Dynamic C version 8 It is for debugging and educational pur poses It should not be called in a production program PARAMETERS parm Prior to Dynamic C version 9 30 reserved for future use Set to 0 Starting with DC 9 30 this parameter is of type Long It is the address of the data structure xbreak_t and must not be 0 LIBRARY MEM LIB XMEM LIB prior to DC 9 30 SEE ALSO xalloc _xalloc xavail _xavail xrelease Dynamic C Functions rabbit com 543 xavail long xavail long addr ptr DESCRIPTION Returns the maximum length of memory that may be successfully obtained by an immediate call to xalloc and optionally allocates that amount This function was introduced in Dynamic C version 7 04P3 PARAMETERS addr ptr Pointer to a long word in root data memory to store the address of the block If this pointer is null then the block is not allocated Otherwise the block is allocated as if by a call to xalloc RETURN VALUE
12. csessccececeeeeeeeeneaeees 90 IEN 44 fat EE 91 IDGlay SOC seeur ee aa ar a aS TESSA 45 fat GetAttr sses irene esas anara aE RS SRR 92 Delay Ticks roeper oee a EE 45 fat GeNa me eebe saeni paa E Aa es 93 Disable HW _WDT cccccesecccssceceeeccescceeens 46 fat_GetPartition cccccseeccessccessceceseceescceeens 94 IR EE 47 fat TE 95 DMAcompleted cccccesessensecececeeeeessensaeees 48 fat_InitUCOSMutex ceccessscececeeeeeseenseaeees 96 DMAhandle2chan cesecsessecececeeeeeesenteaeees 49 fat IsClsed soiree er rar E aes eens 97 DMAioe2mem nnsssssssssseessssssesrrtesessssesrreeresesseo 50 fat OPET sirme e aaa r 98 IMA i012 EE 52 Pat Kategorie Eege eege deed 99 DMA loadBufDesc ccececsersecececeeeeessentnaeees 53 fat_LastWTite cccccccecceessesscsececeeseessesenaeees 100 DMAmatchSetup cccecessensececeeeeeeeseenenaeees 54 fat_MountPartition cesecsececeeeeeseesenseees 101 DMAMem2ioe cccccceceeeseesensececeeeeeeessnntnaeees 55 fat TEEN 102 DMAmMmem2ioi ccccceceeeseesensececeeeeesessnnseaeess 56 fat_OpenDir EEN 104 DMAmem2mem ccceeceesensecececeeesesennsnaeees 57 fat_PartitionDevice csesecsececeeeeeseeseeeeees 105 IDMA DOI EE 58 fat Read soere eese reeeo eaae EEr enS 106 DMAprintBufDesc ssssssesssssseessresessssessrereesssse 59 fat R adDir s6 ssi0cicgaaddeeseasesdadaancocetesiecdieas 107 DMAprintRegs sssssssssssesssssseesrresessssesrreeeeses
13. for e plast p e e pprev p e PARAMETERS P Pool handle structure as previously passed to pool_init e Previous element address obtained by e g plast This must be an al located element in the given pool otherwise the results are undefined Be careful when iterating through a list and deleting elements using pfree once the element is deleted it is no longer valid to pass its ad dress to this function If this parameter is null then the result is the same as plast This ensures the invariant pprev p pnext p ell e RETURN VALUE null There are no more elements nul1 Pointer to previous allocated element LIBRARY POOL LIB SEE ALSO pool init pool link palloc pfree plast pnext Dynamic C Functions rabbit com 355 pprev_ fast xmem void pprev_ fast Pool t p void e DESCRIPTION Get the previous allocated element in a root pool The pool MUST be set to being a linked pool by using pool _link p lt non zero gt otherwise the results are undefined This is an assembler only version of pprev Do not call this function from C Registers Parameters in IX DE respectively Trashes F DE Return value in HL carry flag Example ld ix my_ pool ld de current element lcall pprev_fast jr c no_ more elems HL points to previously allocated element D PARAMETERS P Pool handle structure as previously passed to pool_init Pass this in IX regist
14. mktime tm_rd tm wr Dynamic C Functions rabbit com 243 modf float modf float x int n DESCRIPTION Splits x into a fraction and integer n PARAMETERS x Floating point integer An integer RETURN VALUE The integer part in n and the fractional part satisfies lt 1 0 LIBRARY MATH LIB SEE ALSO fmod ldexp 244 rabbit com Dynamic C Functions nf eraseBlock int nf eraseBlock nf device dev long page DESCRIPTION Erases the block that contains the specified page on the specified NAND flash device Check for completion of the erase operation using eithernf isBusyRBHW or nf isBusyStatus Normally this function will not allow a bad block to be erased However when NFLASH_ CANERASEBADBLOCKS is defined by the application the bad block check is not performed and the application is allowed to erase any block regardless of whether it is marked good or bad PARAMETERS dev Pointer to an initialized nf device structure page Page specifies the zero based number of a NAND flash page in the block to be erased relative to the first good page RETURN VALUE 0 Success or the first error result encountered 1 NAND flash device is busy 2 Block check time out error 3 Page is in a bad block LIBRARY NFLASH LIB This function was introduced in Dynamic C 9 01 SEE ALSO CalculateECC256 ChkCorrectECC256 xCalculateECC256 xChkCorrectECC256 Dynamic C Functions rab
15. x Value to compute RETURN VALUE x if x gt 0 else x LIBRARY MATH LIB SEE ALSO abs Dynamic C Functions rabbit com 77 fat AutoMount int fat AutoMount word flags DESCRIPTION Initializes the drivers in the default drivers configuration list in fat_config 1ib and enu merates the devices in the default devices configuration list then mounts partitions on enumer ated devices according to the device s default configuration flags unless overridden by the specified run time configuration flags Despite its lengthy description this function makes ini tializing multiple devices using the FAT library as easy as possible The first driver in the con figuration list becomes the primary driver in the system if one is not already set up After this routine successfully returns the application can start calling directory and file func tions for the devices mounted partitions If devices and or partitions are not already formatted this function can optionally format them according to the device s configuration or run time override flags This function may be called multiple times but will not attempt to remount device partitions that it has already mounted Once a device partition has been mounted by this function un mounts and remounts must be handled by the application Even though this function may be called multiple times it is not meant to be used as a polling or status function For example if you are
16. 1 Macro name not found 2 No valid ID block found block version 3 or later 3 First parameter is a bad macro name LIBRARY IDBLOCK LIB SEE ALSO writeUserBlockArray Dynamic C Functions rabbit com 179 GetVectExtern2000 unsigned GetVectExtern2000 void DESCRIPTION Reads the address of external interrupt table entry This function really just returns what is present in the table The return value is meaningless if the address of the external interrupt has not been written This function should be used for Rabbit 2000 processors that are marked IQ2T in the 3rd line of text across the face of the chip It will work for other versions of the Rabbit 2000 but should be deprecated in favor of Get VectExtern3000 which allows the use of two external interrupts Please see document TN301 Rabbit 2000 Microprocessor Interrupt Issue on the Rabbit Semiconductor website for more information RETURN VALUE Jump address in vector table LIBRARY SYS LIB SEE ALSO GetVectiIntern SetVectExtern2000 SetVectIntern GetVectExtern3000 180 rabbit com Dynamic C Functions GetVectExtern3000 unsigned GetVectExtern3000 int interruptNum DESCRIPTION Reads the address of an external interrupt table entry This function may be used with all Rabbit 3000 processors and all Rabbit 2000 processors with the exception of the ones marked IQ2T in the 3rd line of text across the face of the chip For those use the func
17. EINVAL Invalid parameter given ENOMEDIUM No SD card in socket ESHAREDBUSY Shared SPI port busy LIBRARY SDFLASH LIB sdspi read sector int sdspi_ read sector sd device sd unsigned long sector number void data buffer DESCRIPTION This function is called to execute protocol command 17 to read a 512 byte block of data from the SD card PARAMETER sd Pointer to sd_ device structure of the SD card sector number The sector number to read data buffer Pointer to a buffer for the 512 bytes read RETURN VALUE 0 Success EIO I O error EINVAL Invalid parameter given ENOMEDIUM No SD card in socket ESHAREDBUSY Shared SPI port busy LIBRARY SDFLASH LIB 424 rabbit com Dynamic C Functions sdspi reset card int sdspi reset card sd device sd DESCRIPTION Resets the SD card pointed to by sd Function executes protocol command 0 to force the card to Idle mode This command is sent multiple times to reset the SD card PARAMETER sd Pointer to sd_ device structure of the SD card RETURN VALUE 0 Success EIO I O error EINVAL Invalid parameter given ENOMEDIUM No SD card in socket ESHAREDBUSY Shared SPI port busy LIBRARY SDFLASH LIB Dynamic C Functions rabbit com 425 sdspi sendingAP int sdspi_sendingAP sd device sd DESCRIPTION Sends AP command 55 to set Alternate Command mode on the next command sent to the card This function does not release the port shar
18. Reads length bytes from serial port X or until tmout milliseconds transpires between bytes The countdown of tmout does not begin until a byte has been received A timeout occurs im mediately if there are no characters to read This function is non reentrant The functions serEread and serFread may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXread int port where port is one of the macros SER_PORT A through SER_PORT E PARAMETERS data Data structure to read from serial port X length Number of bytes to read tmout Maximum wait in milliseconds for any byte from previous one RETURN VALUE The number of bytes read from serial port X LIBRARY RS232 LIB EXAMPLE echoes a blocks of characters main IAC e char s 16 serAopen 19200 while 1 iz m serAncacd s 15 20 0 4 serAwrite s n serAclose 462 rabbit com Dynamic C Functions serXwrFlush void serXwrFlush void where X is A F DESCRIPTION Flushes serial port X transmit buffer meaning that the buffer contents will not be sent This function is non reentrant The functions serEwrFlush and serFwrFlush may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another fo
19. and serFgetc may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXgetc int port where port is one of the macros SER_PORT A through SER_PORT E RETURN VALUE Success the next character in the low byte 0 in the high byte Failure 1 which indicates either an empty or a locked receive buffer LIBRARY RS232 LIB EXAMPLE echoes characters main aime Cp serAopen 19200 while 1 if le sexAgetre te a serAputc c serAclose Dynamic C Functions rabbit com 453 serxXgetError int serXgetError void where X is A F DESCRIPTION Returns a byte of error flags with bits set for any errors that occurred since the last time this function was called Any bits set will be automatically cleared when this function is called so a particular error will only be reported once This function is non reentrant The flags are checked with bitmasks to determine which errors occurred Error bitmasks e SER PARITY ERROR e SER _OVERRUN_ ERROR The functions serEgetError and serFgetError may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X
20. in the function name the prototype of the generalized function is serXgetError int port where port is one of the macros SER_PORT A through SER_PORT E RETURN VALUE The error flags byte LIBRARY RS232 LIB 454 rabbit com Dynamic C Functions serXopen int serXopen long baud where X is A F DESCRIPTION Opens serial port X This function is non reentrant The user must define the buffer sizes for each port being used with the buffer size macros XINBUFSIZE and XOUTBUFSIZE The values must be a power of 2 minus 1 e g define XINBUFSIZE 63 define XOUTBUFSIZE 127 Defining the buffer sizes to 2 1 makes the circular buffer operations very efficient If a value not equal to 27 1 is defined a default of 31 is used and a compiler warning is given The functions serEopen and serFopen may be used with the Rabbit 3000 and Rabbit 4000 Note The default pin setup of Serial Port E uses parallel port C pins which conflict with the programming port Opening serial port E with the default settings while in debug mode will therefore kill PC host target communication The user must define the following if not using the default PCDR settings SERE_TXPORT define to PEDR or PDDR SERE RXPORT define to PEDR or PDDR Note The alternate pins on parallel port D can be used for serial port B by defining SERB _USEPORTD at the beginning of a program See the section on parallel port D in the Rabbit documentation for
21. int fat Delete fat part part int type char name Ir DESCRIPTION Deletes the specified file or directory The type must match or the deletion will not occur This routine inserts a deletion code into the directory entry and marks the sectors as available in the FAT table but does not actually destroy the data contained in the sectors This allows an unde lete function to be implemented but such a routine is not part of this library A directory must be empty to be deleted PARAMETERS part Handle for the partition being used type Must be a FAT file FAT_ FILE or a FAT directory FAT DIR depend ing on what is to be deleted name Pointer to the full path name of the file directory to be deleted RETURN VALUE 0 success EIO device I O error EINVAL part type or name contain invalid values EPATHSTR name is not a valid path name string EPERM the file is open write protected hidden or system ENOTEMPTY the directory is not empty ENOENT the file directory does not exist EBUSY the device is busy Only if non blocking EPSTATE if the partition is busy i e there is an allocation in progress Only if non block ing LIBRARY FAT LIB SEE ALSO fat Open fat _OpenDir fat Split fat Truncate fat Close Dynamic C Functions rabbit com 85 fat EnumDevice int fat EnumDevice mbr_drvr driver mbr_ dev dev int devnum char sig int norecovery DESCRIPTION This routine is called t
22. int fat Tell FATfile file unsigned long pos DESCRIPTION Puts the value of the position pointer that is the number of bytes from the beginning of the file into pos Zero indicates the position pointer is at the beginning of the file uC OS II USERS e The FAT API is not reentrant To use the FAT from multiple uC OS II tasks put the following statement in your application define FAT USE _UCOS MUTEX e Mutex timeouts or other mutex errors will cause the run time error ERR_FAT MUTEX ERROR The default mutex timeout is 5 seconds and can be changed by define ing a different value for FAT MUTEX TIMEOUT_SEC e You MUST call fat_InitUCOSMutex after calling OSInit and before calling any other FAT API functions e You must run the FAT in blocking mode define FAT BLOCK e You must not call low level non API FAT or write back cache functions Only call FAT functions appended with fat_ and with public function descriptions PARAMETERS file Pointer to the file structure of the open file pos Pointer to the variable where the value of the file position pointer is to be placed RETURN VALUE 0 success EIO position is beyond EOF EINVAL file is invalid LIBRARY FAT LIB SEE ALSO fat Seek fat Read fat Write fat_xWrite 116 rabbit com Dynamic C Functions fat tick int fat _tick void DESCRIPTION Drive device I O completion and periodic flushing It is not generally necessary for the appl
23. pktXtx Sets the hardware to transmit data This function must be written in assembly The same rules for register usage as for pkt Xrx apply This function is called whenever the driver switches from receive to transmit mode in response to an additional packet or packets being available for sending A typical use of this function is to enable any necessary transmitter hardware See the sample program Samples PKTDEMO C for an example of how to write these user supplied functions See technical note TN213 Rabbit Serial Port Software for more informa tion on the packet driver 334 rabbit com Dynamic C Functions PARAMETERS baud mode options test packet RETURN VALUE pktXopen cont d Bits per second of data transfer minimum is 2400 Type of packet scheme used the options are e PKT_GAPMODE e PKT_9BITMODE e PKT_CHARMODE Further specification for the packet scheme The value of this depends on the mode used e gap mode minimum gap size in byte times e 9 bit mode type of 9 bit protocol e DEI RABBITSTARTBYTE e PKT LOWSTARTBYTE e PKT HIGHSTARTBYTE e char mode character marking start of packet Pointer to a function that tests for completeness of a packet The function should return 1 if the packet is complete or 0 if more data should be read in For gap mode the test function is not used and should be set to null 1 The Rabbit s bps setting is within 5 of the input baud 0 The Rabbit
24. use32kHzOsc void use32kHzOsc void DESCRIPTION Sets the Rabbit processor to use the 32kHz real time clock oscillator for both the CPU and pe ripheral clock and shuts off the main oscillator If this is already set there is no effect This mode should provide greatly reduced power consumption Serial communications will be lost since typical baud rates cannot be made from a 32kHz clock Also note that this function dis ables the periodic interrupt so wait for and related statements will not work properly al though costatements in general will still work In addition the values in TICK_TIMER MG TIMER and SEC_TIMER will not be updated unless you call the function updateTimers frequently in your code In addition you will need to call hitwd pe riodically to hit the hardware watchdog timer since the periodic interrupt normally handles that or disable the watchdog timer before calling this function The watchdog can be disabled with Disable HW WDT use32kHzOsc is not task reentrant LIBRARY SYS LIB SEE ALSO useMainOsc useClockDivider updateTimers 524 rabbit com Dynamic C Functions useClockDivider void useClockDivider void DESCRIPTION Sets the Rabbit processor to use the main oscillator divided by 8 for the CPU but not the pe ripheral clock If this is already set there is no effect Because the peripheral clock is not af fected serial communications should still work This function also e
25. Check the amount of free memory on the stack of the specified task PARAMETERS prio The task s priority pdata Pointer to a data structure of type OS_STK DATA RETURN VALUE OS NO ERR The call was successful OS PRIO INVALID The priority you specify is higher than the maximum allowed i e gt OS LOWEST PRIO or OS PRIO SELF not specified OS TASK NOT EXIST The desired task has not been created OS TASK OPT ERR IfOS TASK OPT STK CHK was NOT specified when the task was created LIBRARY UCOS2 LIB SEE ALSO OSTaskCreateExt 308 rabbit com Dynamic C Functions OSTaskSuspend INT8U OSTaskSuspend INT8U prio DESCRIPTION Suspends a task The task can be the calling task if the priority passed to OSTaskSuspend is the priority of the calling task or OS_PRIO SELF This function should be used with great care If a task is suspended that is waiting for an event i e a message a semaphore a queue the task will be prevented from running when the event arrives PARAMETERS prio The priority of the task to suspend RETURN VALUE OS MO ERR The requested task is suspended OS TASK SUS IDLE OS PRIO INVALID OS TASK SUS PRIO LIBRARY UCOS2 LIB SEE ALSO OSTaskResume Attempting to suspend the idle task not allowed The priority specified is higher than the maximum allowed i e OS LOWEST PRIO or OS PRIO_ SELF is not specified The task to suspend does not exist Dynamic C Functions rabbit
26. INF and INF RETURN VALUE Arccotangent of the argument in radians LIBRARY MATH LIB SEE ALSO tan atan acsc float acsc float x DESCRIPTION Computes the arccosecant of real float value x Note The Dynamic C functions deg and rad convert radians and degrees PARAMETERS x Assumed to be between INF and INF RETURN VALUE The arccosecant of the argument in radians LIBRARY MATH LIB SEE ALSO sin asin Dynamic C Functions rabbit com AESdecrypt4x4 void AESdecrypt4x4 char far expandedkey char far crypt char far plain DESCRIPTION Decrypts a block of data using an implementation of the Rijndael AES cipher with a 128 bit key and block size The encrypted block of data may be overwritten by the decrypted block of data PARAMETERS expandedkey crypt plain LIBRARY AES CORE LIB A set of round keys generated by AESexpandKey4 from a 16 byte 128 bit key Total of 176 bytes 44 longwords Note when using an AESstreamState structure e g state then call this function using AESdecrypt4x4 state gt expanded key plain crypt A block of 16 bytes of ciphertext to be decrypted crypt and plain may point to the same place A block of 16 bytes of resulting plaintext data crypt and plain may point to the same place rabbit com Dynamic C Functions AESdecryptStream4x4 CBC int AESdecryptStream4x4 CBC AESstreamSt
27. LIBRARY SERVO LIB SEE ALSO servo graph servo read table Dynamic C Functions rabbit com 445 servo torque void servo torque int which int torque DESCRIPTION Run specified servo in open loop controlled torque mode The torque is limited by the dynamic current limit feature if available PARAMETERS which Servo 0 or 1 torque Amount of torque expressed as a fraction of the maximum permissible torque times 10 000 For example to set the torque to 1 10 the maximum value in the reverse direction call servo _torque 0 1000 LIBRARY SERVO LIB SEE ALSO servo _closedloop servo _openloop 446 rabbit com Dynamic C Functions serCheckParity int serCheckParity char rx byte char parity DESCRIPTION This function is different from the other serial routines in that it does not specify a particular serial port This function takes any 8 bit character and tests it for correct parity It will return true if the parity of rx_byte matches the parity specified This function is useful for checking individual characters when using a 7 bit data protocol PARAMETERS rx byte The 8 bit character being tested for parity parity The character O for odd parity or the character E for even parity RETURN VALUE 1 Parity of the byte being tested matches the parity supplied as an argument 0 Parity of the byte does not match LIBRARY RS232 LIB Dynamic C Functions rabbit com 447 serXclose voi
28. The size of the largest free block available If this is zero then addr_ptr will not be changed LIBRARY XMEM LIB was in STACK LIB prior to DC 8 SEE ALSO xalloc _xalloc _xavail xrelease xalloc_stats 544 rabbit com Dynamic C Functions _xavail long xavail long addr ptr word align word type lr DESCRIPTION Returns the maximum length of memory that may be successfully obtained by an immediate callto _xalloc and optionally allocates that amount The align and type parameters are the same as would be presented to xalloc PARAMETERS addr ptr Address of a longword in root data memory to store the address of the block If this pointer is null then the block is not allocated Otherwise the block is allocated as if by a call to _xalloc align Alignment of returned block as per_xalloc type Type of memory as per_xalloc RETURN VALUE The size of the largest free block available If this is zero then addr_ptr will not be changed LIBRARY XMEM LIB SEE ALSO xalloc _xalloc xavail xrelease xalloc_stats Dynamic C Functions rabbit com 545 xCalculateECC256 long xCalculateECC256 unsigned long data DESCRIPTION Calculates a 3 byte Error Correcting Checksum ECC 1 bit correction and 2 bit detection capa bility value for a 256 byte 2048 bit data buffer located in extended memory PARAMETERS data Physical address of the 256 byte data buffer RETURN VALUE The calculated ECC in t
29. This call back function resides in UCOS2 LIB and extends functionality during task creation by allowing additional informa tion to be passed to the kernel anything associated with a task This function can also be used to trigger other hardware such as an oscilloscope Interrupts are disabled during this call there fore it is recommended that code be kept to a minimum PARAMETERS ptcb Pointer to the TCB of the task being created LIBRARY UCOS2 LIB SEE ALSO OSTaskDelHook 302 rabbit com Dynamic C Functions OSTaskDel INT8U OSTaskDel INT8U prio DESCRIPTION Deletes a task The calling task can delete itself by passing either its own priority number or OS _PRIO_ SELF if it doesn t know its priority number The deleted task is returned to the dor mant state and can be re activated by creating the deleted task again PARAMETERS prio Task s priority number RETURN VALUE OS_NO ERR OS TASK DEL IDLE OS PRIO INVALID OS TASK DEL ERR OS TASK DEL ISR LIBRARY UCOS2 LIB SEE ALSO OSTaskDelReq The call was successful Attempting to delete uC OS II s idle task The priority specified is higher than the maximum allowed i e OS LOWEST PRIO or OS DRIO SELF not specified The task to delete does not exist Attempting to delete a task from an ISR Dynamic C Functions rabbit com 303 OSTaskDelHook void OSTaskDelHook OS TCB ptcb DESCRIPTION Called by uC OS II whenever a task is
30. When two costatements are requesting access to a single user cofunction the first request is honored and the second request is held When Lloophead notices that the first caller is not being called each time around the loop it cancels the request calls the abandonment code and allows the second caller in See Samples Cofunc Cofaband c for sample code showing abandonment handling LIBRARY COFUNC LIB loopinit void loopinit void DESCRIPTION This function should be called in the beginning of a program that uses single user cofunctions It initializes internal data structures that are used by loophead LIBRARY COFUNC LIB Dynamic C Functions rabbit com 225 lsqrt unsigned int lsqrt unsigned long x DESCRIPTION Computes the square root of x Note that the return value is an unsigned int The fractional por tion of the result is truncated PARAMETERS x long int input for square root computation RETURN VALUE Square root of x fractional portion truncated LIBRARY MATH LIB ltoa char ltoa long num char ibuf DESCRIPTION This function outputs a signed long number to the character array PARAMETERS num Signed long number ibuf Pointer to character array RETURN VALUE Pointer to the same array passed in to hold the result LIBRARY STDIO LIB SEE ALSO ltoa 226 rabbit com Dynamic C Functions ltoan int ltoan long num DESCRIPTION This function returns the
31. WrPortI BitWrPortI BitRdPortE WrPortE BitWrPortE Dynamic C Functions rabbit com 389 RdPortI int RdPortI int port DESCRIPTION Reads an internal I O port specified by the argument use RAPortE for external port All of the Rabbit internal registers have predefined macros corresponding to the name of the register PADR is defined to be 0x30 etc PARAMETERS port Address of internal I O port RETURN VALUE Returns an integer the lower 8 bits of which contain the result of reading the port specified by the argument Upper byte contains zero LIBRARY SYSIO LIB SEE ALSO RdPortE BitRdPortI WrPortI BitWrPortI BitRdPortE WrPortE BitWrPortE 390 rabbit com Dynamic C Functions ReadCompressedFile int ReadCompressedFile ZFILE input UBYTE buf int lenx DESCRIPTION This function decompresses a compressed file input ZF ILE opened with OpenInput CompressedFile using the LZ compression algorithm on the fly placing a number of bytes 1 enx into a user specified buffer ouf PARAMETERS input Input bit file buf Output buffer lenx Number of bytes to read This can be increased to get more throughput or decreased to free up variable space RETURN VALUE Number of bytes read LIBRARY LZSS LIB Dynamic C Functions rabbit com 391 read rtc unsigned long read rtc void DESCRIPTION Reads seconds 32 bits directly from the Real time Clock RTC Use with caution I
32. and x y Note The Dynamic C functions deg and rad convert radians and degrees PARAMETERS y The point corresponding to the y axis x The point corresponding to the x axis RETURN VALUE If both y and x are zero the function returns 0 and signals a domain error Otherwise the arct angent of y x is returned as follows Returned value Parameter Values in Radians angle x 0 y 0 PI 2 x 0 y gt 0 PI x 0 y lt 0 x gt 0 y 0 PI x lt 0 y 0 LIBRARY MATH LIB SEE ALSO acos asin atan cos sin tan 12 rabbit com Dynamic C Functions atof NEAR SYNTAX float n atof char sptr FAR SYNTAX float fC atof char far sptr Note By default atof is defined to np atof DESCRIPTION ANSI string to float conversion UNIX compatible For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_ STRING macro is de fined and all pointers are near pointers append np to the function name e g n_ strfunc For more information about FAR pointers see
33. char cs_ shadow int cs pin DESCRIPTION Replaces sf_init The function sfspi_init must be called before any calls to this function Initializes serial flash chip This function must be called before the serial flash can be used Currently supported devices are e AT45DB041 e AT45DB081 e AT45DB642 e AR45DB1282 PARAMETERS dev Pointer to an empty s _ device struct that will be filled in on return The struct will then act as a handle for the device cs port TO port for the active low chip select pin for the device CS shadow Pointer to the shadow variable for cs_port cs pin T O port pin number for the chip select signal RETURN VALUE 0 for success lif no flash chip detected 2 if error communicating with flash chip 3 if unknown flash chip type LIBRARY SFLASH LIB 480 rabbit com Dynamic C Functions sf isWriting int sf isWriting sf device dev DESCRIPTION Returns 1 if the flash device is busy writing to a page PARAMETER dev Pointer to st device struct for initialized flash device RETURN VALUE 1 busy 0 ready not currently writing LIBRARY SFLASH LIB sf pageToRAM int sf pageToORAM long page DESCRIPTION Command the serial flash to copy the contents of one of its flash pages into its RAM buffer Note This function blocks and only works on boards with one serial flash device PARAMETER page The page to copy RETURN VALUE 0 for success 1 for error LIBRARY SFLASH LIB
34. eee cece eeee eee 520 SERGE Eege 510 updateTimers acc cascacietiisetensaintcancasiaczeces 524 REES ee 511 USES 2ZKAZOSC visors eiia ess 524 EE 514 useClockDivider cccceseeserteceeeeeees 525 DONO WEE geseent 523 useClockDivider3000 cccecceeeeenees 526 erter 523 useMainOsc ooccciasetcecesssacaccasuezaderensedeess 527 String to Number Conversion U ja EE 13 User Block iro ME E E E 14 EE 15 EE Se Ce E E 512 Ee SR writeUserBlock xssescssecsesasdecassabencscssavone 535 SUOL Steeg 515 writeUserBlockArray sessssseseseeseeee 537 System y _GetSysMacrolndex osgeeettesuegueeegueeg 178 _GetSysMacroValue en 179 VBAT RAM Rabbit 4000 5000 JSYSISSOLURGSCE scrii 517 TOOt2VrAM seet 412 chkHardReset access tarinsstaiasarecasesevoinncesee 25 GE 528 chkSoftReset ss cscesssevterssgeanecasiaasedbaseaetes 25 CAKWDT a ccccccssctecccaesscccctaseueccassseceeasees 26 w AO EE 27 Watchdogs clockDoublerOn sssssssssssssssessssesssseseseeee 27 Disable HW WDT cccccccecececccccccen 46 defineErrorHandler ccceceeeeeeeees 42 Enable HW WDT ooccccoccccccececececececcecccee 69 ERIE enee 76 AMA EE 194 forceSoftReset seier ee 150 Vde reed eoscvscosecesneesoecsoceihoaveoseces 529 get_cpu_frequency EE 176 KI EE 530 Getdivider 19200 een 177 KE 530 GetVectExtern2000 e 180 VdReleaseWd s cssccsssecssesseseenees 531 xxviii rabbit com Dynamic C Functions 1 Function Descriptions This chapter includes detailed descr
35. f The pointer to the created file fnum This is a user defined number in the range of 1 to127 inclusive Each file in the flash file system is assigned a unique number in this range RETURN VALUE 0 Success 1 Failure LIBRARY FILESYSTEM LIB 126 rabbit com Dynamic C Functions fcreate FS2 int fcreate File FileNumber name DESCRIPTION Create a new file with the given file name which is composed of two parts the low byte is the actual file number 1 to 255 inclusive and the high byte contains an extent number 1 to _ s num_1x on which to place the file metadata The extent specified by fs_set_1x is always used to determine the actual data extent If the high byte contains 0 then the default metadata extent specified by fs set _1x is used The file descriptor is filled in if success ful The file will be opened for writing so a further call to fopen_wr is not necessary The number of files which may be created is limited by the lower of FS_MAX FILES and 255 This limit applies to the entire filesystem all logical extents Once a file is created its data and metadata extent numbers are fixed for the life of the file i e until the file is deleted When created no space is allocated in the file system until the first write occurs for the file Thus if the system power is cycled after creation but before the first byte is written the file will be effectively deleted The first write to a file causes
36. fd The FlashDescriptor ofthe memory to query RETURN VALUE The integer representing the type of the flash memory LIBRARY FLASH LIB SEE ALSO flash erasechip flash erasesector flash_init flash read flash readsector flash _ sector2xwindow flash writesector Dynamic C Functions rabbit com 139 flash init int flash init FlashDescriptor fd int mb3cr DESCRIPTION Initializes an internal data structure of type FlashDescriptor with information about the flash memory chip The Memory Interface Unit bank register MB3CR will be assigned the value of mb3 cr whenever a function accesses the flash memory referenced by fd See the Rab bit 2000 Users Manual for the correct chip select and wait state settings Note Improper use of this function can cause your program to be overwritten or operate incorrectly This and the other flash memory access functions should not be used on the same flash memory that your program resides on nor should they be used on the same region of a second flash memory where a file system resides Use WriteFlash to write to the primary flash memory PARAMETERS fd This is a pointer to an internal data structure that holds information about a flash memory chip mb3cr This is the value to set MB3CR to whenever the flash memory is accessed Oxc2 i e CS2 OEO WEO 0 WS is a typical setting for the second flash memory on the TCP IP Dev Kit the Intellicom the Advanced Ethernet Core and the
37. in the function name the prototype of the generalized function is cof_serXwrite int port where port is one of the macros SER_PORT_ A through SER_PORT E PARAMETERS data Data structure to write length Number of bytes in data to write LIBRARY RS232 LIB EXAMPLE writes a block of characters repeatedly main const char s Hello Rabbit serAopen 19200 Jecoaie 7 while 1 loophead costate wid cof SerAwrite s strlen s serAclose 36 rabbit com Dynamic C Functions CompressFile void CompressFile ZFILE input ZFILE output DESCRIPTION This function compresses the input file uncompressed ZFILE opened with OpenInputCompressFile using the LZ compression algorithm The result is put into a user specified output file an empty ZFILE opened with OpenOutputCompressedFile The macro OUTPUT_COMPRESSION_ BUFFERS must be defined with a positive non zero value to use CompressFile ora compile time error will occur The default value of OUTPUT_COMPRESSION_ BUFFERS is zero PARAMETERS input Input bit file output Output bit file RETURN VALUE None LIBRARY LZSS LIB SEE ALSO OpenInputCompressedFile OpenOutputCompressedFile Dynamic C Functions rabbit com 37 CoPause void CoPause CoData p DESCRIPTION Pause execution of a costatement so that it will not run the next time it is encountered unless and until CoOResume p or CoBegin p ar
38. is cleared so the next time OSMboxAccept is called the mailbox will be empty void 0 The mailbox is empty or pevent is a null pointer or you didn t pass the proper event pointer LIBRARY OS MBOX C Prior to DC 8 UCOS2 LIB SEE ALSO OSMboxCreate OSMboxPend OSMboxPost OSMboxQuery Dynamic C Functions rabbit com 267 OSMboxCreate OS EVENT OSMboxCreate void msg DESCRIPTION Creates a message mailbox if event control blocks are available PARAMETERS msg Pointer to a message to put in the mailbox If this value is set to the null pointer i e void 0 then the mailbox will be considered empty RETURN VALUE l void 0 A pointer to the event control clock OS EVENT associated with the created mailbox void 0 No event control blocks were available LIBRARY OS MBOX C Prior to DC 8 UCOS2 LIB SEE ALSO OSMboxAccept OSMboxPend OSMboxPost OSMboxQuery 268 rabbit com Dynamic C Functions OSMboxDel OS EVENT OSMboxDel OS EVENT pevent INT8U opt INT8U err DESCRIPTION This function deletes a mailbox and readies all tasks pending on the mailbox Note that e This function must be used with care Tasks that would normally expect the presence of the mailbox MUST check the return code of OSMboxPend OSMboxAccept callers will not know that the intended mailbox has been deleted unless they check pevent to see that it s a null pointer e This call can potentially
39. middle of sending a packet This function is intended for use with the Rabbit 3000 and Rabbit 4000 LIBRARY HDLC PACKET LIB HDLCclosexX void HDLCcloseX void Where X is E or F DESCRIPTION Disables the HDLC port E or F If it was used the TATIR resource timer A1 cascade is re leased This function is non reentrant This function is intended for use with the Rabbit 3000 and Rabbit 4000 LIBRARY HDLC PACKET LIB SEE ALSO TAT1R_ SetValue 186 rabbit com Dynamic C Functions HDLCdropxX int HDLCdropx void Where X is E or F DESCRIPTION Drops the next received packet freeing up its buffer This must be used if the packet has been examined with HDLCpeekxX and is no longer needed A call to HDLCreveiceX is the only other way to free up the buffer This function is intended for use with the Rabbit 3000 and Rabbit 4000 RETURN VALUE 1 Packet dropped 0 No received packets were available LIBRARY HDLC PACKET LIB HDLCerrorx int HDLCerrorx unsigned long bufptr int lenptr Where X is E or F DESCRIPTION This function returns a set of possible error flags as an integer A received packet with errors is automatically dropped Masks are used to check which errors have occurred The masks are e HDLC _NOBUFFER driver ran out of buffers for received packets e HDLC _OVERRUN a byte was overwritten and lost before the ISR could retreive it e HDLC OVERFLOW a rece
40. null is returned If this parameter is null then f must point to the first element in the list and e is inserted at the start of the list Dynamic C Functions rabbit com 341 pmovebetween cont d f Second reference element The element e will be inserted before this el ement On entry it must be true that pprev p f d Otherwise null is returned If this parameter is null then d must point to the last el ement in the list and e is inserted at the end of the list Note If both d and P are null then it must be true that there are no allocated ele ments in the linked list and the element e is added as the only element in the list This proviso only obtains when the element e is initially allocated from an empty pool with pool _link p POOL LINKED BY APP The allocated element is not in the linked list of allocated elements RETURN VALUE Returns the parameter value e unless e was null in which case the value of plast if called at function entry would be returned If the initial conditions for d and f do not hold then null is returned with no further action EXAMPLES void d e f e plast p element to move f pnext p d pfirst p d f are first 2 elements pmovebetween p e d f LIBRARY POOL LIB SEE ALSO pool_init pool_link plast pfirst pnext pprev preorder 342 rabbit com Dynamic C Functions
41. s FAT _INC_LNAME include long name entries e FAT INC_ACTIVE include active entries The following predefined filters are available s FAT INC_ALL returns ALL entries of ANY type e FAT_INC_DEF default files and directories including read only and archive Note Active files are included by default unless FAT_INC_DELETED FAT _INC_EMPTY or FAT _INC_LNAME is set Include flags become the desired filter value if the associated filter flags are set Dynamic C Functions rabbit com 107 fat ReadDir cont d EXAMPLES OF FILTER BEHAVIOR mode FAT IMC DEE FATFIL HIDDEN FATATTR_ HIDDEN would return the next hidden file or directory including read only and archive mode FAT INC _DEF FAT FIL HIDDEN FAT FIL DIR FATATTR_HIDDEN would return next hidden directory but would not return any hidden file mode FAT_INC_DEF FAT_ FIL _HIDDEN FAT_ FIL DIR FATATTR_HIDDEN amp FATATTR_DIRECTORY would return next hidden file but would not return any hidden directory mode FAT INC ALL amp FAT_INC EMPTY would return the next non empty entry of any type RETURN VALUE 0 success EINVAL invalid argument ENOENT directory does not exist EEOF no more entries in the directory EFAULT directory chain has link error EBUSY the device is busy non blocking mode only Other negative values from the fat_Open call are also possible LIBRARY FAT LIB SEE ALSO fat OpenDir fat Status 108 rabbit com Dy
42. the size of the largest possible packet that can be expected RETURN VALUE 1 Success extended memory was allocated 0 Failure no memory allocated the packet channel cannot be used LIBRARY PACKET LIB Dynamic C Functions rabbit com 333 pktXopen int pktXopen long baud int mode char options int test packet X is A F DESCRIPTION Opens serial port X The functions pkt Eopen and pkt Fopen may be used with the Rabbit 3000 and Rabbit 4000 The packet driver is meant to be used with a variety of transceiver hardware so some functions must be defined by the user Each of these functions listed below take no arguments and return nothing pktXinit Initializes the communication hardware Called inside pkt Xopen This function may be written in C It will only be called once each time the packet driver is opened so speed is not a major concern This is where I O pins should be configured and any other setup should be performed pktXrx Sets the hardware to receive data This function must be written in assembly Any registers besides the 8 bit accumulator A must be preserved first and restored before returning This function is called when the driver switches from transmit to receive mode once there are no packets to send This function is necessary for half duplex connections and other types of shared bus schemes so that the transmitter can be disabled allowing other nodes to use the lines
43. void servo set pos int which long pos long vel DESCRIPTION Move the specified servo motor to a specified position and set the specified velocity at that po sition This cancels any move which is currently in effect PARAMETERS which pos vel LIBRARY SERVO LIB SEE ALSO Servo 0 or 1 Position as an encoder count Velocity in units of encoder counts per loop update interval times 65536 You can convert RPM to a suitable velocity command using servo millirpm2vcmd servo move Co servo set vel servo millirpm2vcmd 444 rabbit com Dynamic C Functions servo set vel void servo set vel int which long vel DESCRIPTION Move the specified servo motor at a constant velocity This cancels any move that is currently in effect PARAMETERS which Servo 0 or 1 vel Velocity in units of encoder counts per loop update interval times 65536 You can convert RPM to a suitable velocity command using servo_millirpm2vcmd LIBRARY SERVO LIB SEE ALSO servo move to servo set pos servo millirpm2vcmd servo stats reset void servo stats reset int which DESCRIPTION Reset the statistics table This is used immediately prior to a command movement so that the table is filled with the results of the movement command Once reset one table row is filled in for each execution of the update loop ISR driven This continues until the table is full or it is reset again PARAMETER which Servo 0 or 1
44. xsetlong void xsetlong long dst long val DESCRIPTION Set the long integer pointed to by dst This is the most efficient function for writing 4 bytes to xmem PARAMETERS dst xmem linear address of the long integer value to set val value to store into the above location RETURN VALUE None LIBRARY XMEM LIB xstrlen unsigned int xstrlen long src DESCRIPTION Return the length of the string in xmem pointed to by src If there is no null terminator within the first 65536 bytes of the string then the return value will be meaningless PARAMETERS sre xmem linear address of the first character of the string Note to perform a normal null terminated search ensure that src is in the range 0 27 If the MSB of src is not zero i e bits 24 31 then that character will be used to terminate the search rather than the standard null terminator E g to determine the length of a string terminated by xstrlen paddr my_str long lt lt 24 RETURN VALUE Length of string not counting the terminator LIBRARY XMEM LIB 556 rabbit com Dynamic C Functions RABE Tete Software License Agreement RABBIT SOFTWARE END USER LICENSE AGREEMENT IMPORTANT READ CAREFULLY BY INSTALLING COPYING OR OTHERWISE USING THE ENCLOSED RABBIT DYNAMIC C SOFTWARE WHICH INCLUDES COMPUTER SOFTWARE SOFTWARE AND MAY INCLUDE ASSOCIATED MEDIA PRINTED MATERIALS AND ONLINE OR ELECTRONIC DOCUMENTA
45. 0 7 RETURN VALUE O or 1 The value of the bit read LIBRARY SYSIO LIB SEE ALSO RdPortI WrPortI BitWrPortI BitRdPortE RdPortE WrPortE BitWrPortE Dynamic C Functions rabbit com 19 BitWrPortE void BitWrPortE unsigned int port char portshadow int value int bitcode DESCRIPTION Updates shadow register at bitcode with value 0 or 1 and copies shadow to register WARNING A shadow register is required for this function PARAMETERS port Address of external parallel port data register portshadow Reference pointer to a variable to shadow the current value of the register value Value of 0 or 1 to be written to the bit position bitcode Bit position 0 7 LIBRARY SYSIO LIB SEE ALSO RdPortI BitRdPortI WrPortI BitWrPortI BitRdPortE RdPortE WrPortE 20 rabbit com Dynamic C Functions BitWrPortl void BitWrPortI int port char portshadow int value int bitcode DESCRIPTION Updates shadow register at position bit code with value 0 or 1 copies shadow to register WARNING A shadow register is required for this function PARAMETERS port Address of internal parallel port data register portshadow Reference pointer to a variable to shadow the current value of the register value Value of 0 or 1 to be written to the bit position bitcode Bit position 0 7 LIBRARY SYSIO LIB SEE ALSO RdPortI BitRdPortI WrPortI BitRdPortE RdPortE WrPortE BitWrPortE Dynamic C Functions rabb
46. 1 prefix plus message text 2 prefix only up to then null terminator RETURN VALUE buffer address or NULL if bad length passed LIBRARY log lib SEE ALSO log_next log_prev Dynamic C Functions rabbit com 217 Log map uint32 log map LogFacPri lfp DESCRIPTION Return the log destination class and stream for a given facility priority code The result is up to four destinations packed into a longword This function merely invokes the macro LOG MAP which may be overridden by the application but defaults to just the filesystem Note Please see the comments at the top of log 1ib for a description of the message logging subsystem PARAMETER lfp Facility priority code This is a single byte code specified whenever any log message is added Facility is coded in the 5 MSBs and priority in the 3 LSBs RETURN VALUE Up to four destinations for a message of the specified facility and priority Each byte in the re sulting long word represents a destination stream A zero byte indicates no destination If the result is all zeros then a message of this type would be discarded LIBRARY log lib 218 rabbit com Dynamic C Functions log next int log next LogDest ldst LogEntry le DESCRIPTION Retrieve next log entry You must call Log seek before calling this function the first time Retrieval of stored log messages proceeds for example as follows log _seek ldst 0 seek to start log
47. 32 bit address pointed to by the passed near pointer The compiler does not know the contents of a pointer and will assume the inner pointer is a 32 bit pointer For more information about FAR pointers please see the Dynamic C User s Man ual 512 rabbit com Dynamic C Functions strtod cont d In the following examples 1 byte x x indicates a NEAR address 16 bit upcast to FAR Passing a char far far ptr as tailptr ADDRESS DATA _ x x y y y y tailptr y y y y z z z z tailptr z z z z Correct contents tailptr Passing a char ptr as tailptr Note the first pointer can be upcast to FAR but the compiler doesn t know to upcast the internal pointer ADDRESS DATA _ x x 1 y y tailptr _ y y z z tailptr z z Incorrect contents tailptr PARAMETERS s String to convert tailptr Pointer to a pointer of character The next conversion may resume at the location specified by tailptr RETURN VALUE 66 99 The float number represented by s LIBRARY STRING LIB SEE ALSO atof Dynamic C Functions rabbit com 513 strtok NEAR SYNTAX char n strtok char src char brk FAR SYNTAX char far E strtok char far src char far brk Note By default strtok is defined to pn strtok DESCRIPTION Scans src for tokens separated by delimiter characters
48. 8 or from 0 RETURN VALUE Returns a handle to a DMA channel if one is available If none are available it returns DMA_CHANNEL NONE LIBRARY DMA LIB SEE ALSO DMAunalloc DMAhandle2chan Dynamic C Functions rabbit com 47 DMAcompleted int DMAcompleted dma chan t handle unsigned int len DESCRIPTION This function checks to see if a channel is finished with its DMA operation If complete the number of bytes transferred in the last operation is returned in len if Len is not NULL and 1 is returned PARAMETERS handle Handle for channel to check len Pointer to the value to be filled with the number of bytes last transferred RETURN VALUE 1 DMA operation is complete 0 Allocated channel has never been used or is currently running EINVAL Invalid handle LIBRARY DMA LIB SEE ALSO DMAstop 48 rabbit com Dynamic C Functions DMAhandle2chan int DMAhandle2chan dma chan t handle DESCRIPTION This function checks the validity of a handle and returns the channel number if it is valid PARAMETER handle Handle to convert to channel number RETURN VALUE 0 7 Valid channel number DMA CHANNEL NONE The channel is invalid LIBRARY DMA LIB SEE ALSO DMAalloc DMAunalloc Dynamic C Functions rabbit com 49 int DMAioe2mem dma chan t handle dma addr _t dest unsigned int src DMAioe2mem unsigned int len unsigned int flags DESCRIPTION This function performs an immediate
49. ALSO strespn strrcehr strtok Dynamic C Functions rabbit com 511 strtod NEAR SYNTAX float n_strtod char s char tailptr FAR SYNTAX float fC strtod char far s char far far tailptr Note By default strtod is defined to pn strtod DESCRIPTION ANSI string to float conversion For Rabbit 4000 users this function supports FAR pointers The macro USE_ FAR STRING will change all calls to functions in this library to their far versions by default The user may also explicitly call the far version with strfunc where strfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR STRING macro is de fined and all pointers are near pointers append _n_ to the function name ep n strtod For more information about FAR pointers see th Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR Warning The far version of strtod is not backwards compatible with near pointers due to the use of a double pointer The problem is that char tailptr isa 16 bit pointer pointing to another 16 bit pointer The far version char far far tailptr is a 32 bit pointer pointing to a 32 bit pointer If you pass a double near pointer as the argument to the double far pointer function the double dereference tailptr of the double pointer will attempt to access a
50. Bus Operation Rabbit 3000 4000 DMAA OC neiseina oeii iiid 47 disable IObUS srecsdscsuceosrsessrediesuoeesasuzdedecs 46 DMAcompleted ccssescssessessssesseseeseees 48 enableIObus avasedceavaceceadvenrisvancienseeteenbends 69 DMAhandle2chan cccecccccccccccccccecccees 49 c DMAioe2mem E 50 DM Ale GI EE 52 Character DMAloadBufDesc nsss 53 Tes AMINA Aeee ea 197 DMAmatchSetup e eegeieegeteaEgeieeRSEee 54 isalpha eege 198 RA ER 55 Ce E 198 DMAmem2ioi E 56 TRON GU erea 200 DMAmem2mem sricgeaiisicerdssecvssereanecaranes 57 GE 201 DMApoll E 58 See 201 DMA printBulDese 9 cscs siecassantnccatsousss 59 EE 202 PMA PH E 60 Dynamic C Functions rabbit com Xv DMAsetBufDesc e ssceekeEsEteeEESedebaesgerg 61 E eege 344 DMAsetDirect fi scccddccdadinccdsnapoianaisereacsaane 62 PIER sccsjadistasscevstesiadaideciesasneccdemeseanens 345 DMAsetParameters seeccccseeeeeceeeees 63 EE fast ee 346 DMAstartAuto sccssssaidesssssateconiaasecduseaveces 64 pool_append c5 incasisancduegsasecdaasavereasandec 348 DMAStartDirect ceescccesececeeeeeeeeeeeees 65 POOL ET 349 RE 66 pool ink deer 350 E EE 67 EEN 351 RE TEE 67 POOKIE engeuggetteggediengetteergerdede ie 352 DMAunalloc secicicnsiceosavaseesaseanacesanseadesani 68 PREY Asti een 355 SOUT E 449 POE fast eenegen 356 SrA d MAON isocanvsucasadyenaarivuresdsaniavadsenvs 450 PASE caccssceanceserceaconaseadtenageacdesnszoasncte 357 ser B maOff ceses iesiri 449 pputlast_fast zem
51. Dynamic C To update Dynamic C go to www rabbit com products dc or call 1 530 757 8400 Symbols ChkSoftReset c cccccssecccccceecececcesccccenescecees 25 Chk ap TO EE He GetSysMacroIndex sscccceseeessseessseessees 178 ClockDoublerOff cccccccccccceesceceeeeeeeeseeeess 27 GetSysMacroValue ssccccesseeessesessseesees 179 clockDoublerOn ccccccccecseeccceeeceeseeeeeeeeseeees 27 _sysIsSoftReset cccccccccccceceesessecececeeeeeenenees 517 CloselnputCompressedFile cssscessssseeeesseeeees 28 Kallot rseessrodeet raei NES NES 542 CloseOutputCompressedFile c ccccssescssesesseee 28 RAV EE 545 CoBegin ee eee Tee 29 A cof_pktAreceive c ccccccccessesssscceceeeceessssaeeeeees 29 COF_PKtASend ccccccccccecessessssececeeeceesesseeeeees 30 ADS vg 2 cof_pktBreceive ccccecececececececeeeceeeceeeseeesceeees 29 TEE 2 cof pktBsend egssieeddesgdesggesdieedest eege dees 30 e E 3 cof_pktCreceive cacusveecccvernettarsireanaveertecessintale 29 EE 3 GE E 30 AES Meet E 4 COF_PKtDreceive cccecccessssssscceceeeceesenseeeeees 29 AESdecryptStream4x4_CBC ccceeecceeeeeeeeeeeees 5 COE PKtDstid echo siete ccctevcseeis tive EI 30 AESEncrypt4x4 wocccccccccsscsscssssesscsscssessssessesssesees 6 cof_pktEreceive cccccccscessessssececeeeceesesseeeeees 29 AESencryptStream4x4_CBC ecceeeeeeeeseeeeeeeeees 7 Cof pktEsend 228 1gei eeeesa seed De e 30 AESexpandKey4 EE 8 COF_PKtFreceive ccccc
52. FULL The queue cannot accept any more messages because it is full OS ERR EVENT TYPE A pointer to a queue was not passed OS ERR PEVENT NULL If pevent is a null pointer OS_ERR_POST NULL PTR Attempting to post to a non mailbox LIBRARY OS OC Prior to DC 8 UCOS2 LIB SEE ALSO OSQAccept OSQCreate OSQFlush OSQPend OSQPost OSQQuery 290 rabbit com Dynamic C Functions OSQPostOpt INT8U OSQPostOpt OS EVENT pevent void msg INT8U opt DESCRIPTION This function sends a message to a queue This call has been added to reduce code size since it can replace both OSQPost and OSQPostFront Also this function adds the capabil ity to broadcast a message to all tasks waiting on the message queue Note Interrupts can be disabled for a long time if you do a broadcast In fact the inter rupt disable time is proportional to the number of tasks waiting on the queue PARAMETERS pevent Pointer to message queue s event control block msg Pointer to the message to send A null pointer must not be sent opt Determines the type of POST performed e OS POST OPT NONE POST to a single waiting task Identical to OSQPost e OS POST OPT BROADCAST POST to ALL tasks that are waiting on the queue e OS POST _OPT_FRONT POST as LIFO Simulates OSQPostFront The last 2 flags may be combined e OS POST OPT _FRONT OS POST OPT BROADCAST is identi cal to OSQPost Front except that it will broadcast msg to all w
53. Functions 6 Disclaimer of Warranty You expressly acknowledge and agree that the use of the Software and its documentation is at Your sole risk THE SOFTWARE DOCUMENTATION AND TECHNICAL SUPPORT ARE PROVIDED ON AN AS IS BASIS AND WITHOUT WARRANTY OF ANY KIND Information regarding any third party services included in this package is provided as a conve nience only without any warranty by Rabbit and will be governed solely by the terms agreed upon between You and the third party providing such services RABBIT AND ITS LICENSORS EXPRESSLY DISCLAIM ALL WARRANTIES EXPRESS IMPLIED STATUTORY OR OTHER WISE INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANT ABILITY FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT OF THIRD PARTY RIGHTS RABBIT DOES NOT WARRANT THAT THE FUNCTIONS CONTAINED IN THE SOFTWARE WILL MEET YOUR REQUIREMENTS OR THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR FREE OR THAT DEFECTS IN THE SOFTWARE WILL BE CORRECTED FURTHERMORE RABBIT DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OR THE RESULTS OF THE SOFT WARE IN TERMS OF ITS CORRECTNESS ACCURACY RELIABILITY OR OTHERWISE NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY RABBIT OR ITS AUTHORIZED REPRESENTATIVES SHALL CREATE A WARRANTY OR IN ANY WAY INCREASE THE SCOPE OF THIS WARRANTY SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES SO THE ABOVE EXCLUSION MAY NOT APPLY TO YOU 7 Limitation of Lia
54. If this goes past EOF the position pointer is set to EOF and error code EEOF is returned SEEK_END seek to pos bytes from the end of the file That is for a file that is x bytes long the statement fat Seek m file 1 SEEK END will cause the position pointer to be set at x 1 no matter its value prior to the seek call If the value of pos would move the position pointer past the start of the file the position pointer is set to O the start of the file and no error code is returned If pos is greater than or equal to 0 the position pointer is set to EOF and error code EEOF is returned SEEK_RAW is similar to SEEK_SET but if pos goes beyond EOF using SEEK RAW will set the file length and the position pointer to pos Dynamic C Functions rabbit com 109 fat Seek cont d RETURN VALUE 0 success EIO device I O error EINVAL file pos or whence contain invalid values EPERM the file is locked or writes are not permitted ENOENT the file does not exist EEOF space is allocated but the pointer is left at original EOF ENOSPC no space is left on the device to complete the seek EBUSY the device is busy Only if non blocking EFSTATE if file in inappropriate state Only if non blocking LIBRARY FAT LIB SEE ALSO fat Open fat Read fat Write fat _xWrite 110 rabbit com Dynamic C Functions fat SetAttr int fat SetAttr FATfile file int attr DESCRIPTION This funct
55. OSQPostFront OSQQuery Dynamic C Functions rabbit com 285 OsQgDel OS EVENT OSQDel OS EVENT pevent INT8U opt INT8U err DESCRIPTION Deletes a message queue and readies all tasks pending on the queue Note that This function must be used with care Tasks that would normally expect the presence of the queue MUST check the return code of OSQPend OSQAccept callers will not know that the intended queue has been deleted unless they check pevent to see that it s a null pointer This call can potentially disable interrupts for a long time The interrupt disable time is directly proportional to the number of tasks waiting on the queue Because all tasks pending on the queue will be readied you must be careful in applications where the queue is used for mutual exclusion because the resource s will no longer be guarded by the queue If the storage for the message queue was allocated dynamically e usinga malloc type call then your application must release the memory storage by call the counterpart call of the dynamic allocation scheme used If the queue storage was created statically then the storage can be reused PARAMETERS pevent Pointer to the queue s event control block opt May be one of the following delete options e OS DEL NO PEND Delete queue only if no task pending e OS DEL ALWAYS Deletes the queue even if tasks are waiting In this case all the tasks pending will be readied err Pointer to
56. Pointer to 2N point sequence of real fractions N Number of complex elements in output spectrum blockexp Pointer to integer block exponent LIBRARY FFT LIB SEE ALSO fftceplx fftcplxinv fftrealinv hanncplx hannreal powerspectrum Dynamic C Functions rabbit com 135 fftrealinv void fftrealinv int x int N int blockexp DESCRIPTION Computes the 2N point real sequence corresponding to the N point positive frequency complex spectrum in array x The N point positive frequency spectrum contained in array x is replaced with its corresponding 2N point real sequence The value of blockexp is increased by 1 each time array x has to be scaled to avoid arithmetic overflow The value of blockexp is also decreased by log5N to include the 1 N factor in the definition of the inverse DFT The function expects to find the real part of the fmax term in the imaginary part of the zero fre quency X 0 term stored x 1 The 2N point real sequence is stored in natural order The zeroth element of the sequence is stored in x 0 the first element in x 1 and the kth element in x k N must be a power of 2 and between 4 and 1024 An invalid N causes a RANGE exception PARAMETERS x Pointer to N element array of complex fractions N Number of complex elements in array x blockexp Pointer to integer block exponent LIBRARY FFT LIB SEE ALSO fftcplx fftcplxinv fftreal hanncplx hannreal powerspectrum 136 ra
57. Pool t p void e DESCRIPTION Free an element that was previously obtained via palloc This is an assembler only version of pfree Do not call this function from C pfree_ fast does not perform any IPSET protection or parameter validation pfree fast is a mem function The parameters must be passed in machine registers REGISTERS Parameters in IX DE respectively Trashes BC DE HL EXAMPLE ld ix my_pool ld de element addr lcall pfree fast PARAMETERS p Pool handle structure as previously passed to pool_alloc or palloc_fast This must be in the IX register e Element to free which was returned from palloc This must be in the DE register RETURN VALUE None LIBRARY POOL LIB SEE ALSO pool_init palloc_fast pavail_fast pxfree_fast 330 rabbit com Dynamic C Functions word phwm Pool t p DESCRIPTION Return the largest number of elements ever simultaneously allocated from the given pool i e the pool high water mark You can use this function to help size a pool since it may be difficult to determine the optimum number of elements without running a trial program PARAMETERS p Pool handle structure as previously passed to pool_init or pool xinit RETURN VALUE Maximum number of elements ever allocated LIBRARY POOL LIB SEE ALSO pool init pool xinit pavail Dynamic C Functions rabbit com 331 pktxXxclose void pktXclose void X is A F DESCRIPT
58. RabbitLink RETURN VALUE 0 Success 1 Invalid flash memory type 1 Attempt made to initialize primary flash memory LIBRARY FLASH LIB SEE ALSO flash erasechip flash erasesector flash gettype flash read flash readsector flash sector2xwindow flash writesector 140 rabbit com Dynamic C Functions flash read int flash read FlashDescriptor fd word sector word offset unsigned long buffer word length DESCRIPTION Reads data from the flash memory and stores it in buffer Note fd must have already been initialized with flash_init before calling this func tion See the flash_init description for further restrictions PARAMETERS fd The FlashDescriptor of the flash memory to read from sector The sector of the flash memory to read from offset The displacement in bytes from the beginning of the sector to start read ing at buffer The physical address of the destination buffer TIP A logical address can be changed to a physical with the function paddr length The number of bytes to read RETURN VALUE 0 Success LIBRARY FLASH LIB SEE ALSO flash erasechip flash erasesector flash gettype flash init flash readsector flash _sector2xwindow flash writesector paddr Dynamic C Functions rabbit com 141 flash readsector int flash readsector FlashDescriptor fd word sector unsigned long buffer DESCRIPTION Reads the contents of an entire sector of flash memory into a buffer Note f
59. SEE ALSO fat Open fat _OpenDir Dynamic C Functions rabbit com 81 fat CreateDir int fat CreateDir fat part part char dirname DESCRIPTION Creates a directory if it does not already exist The parent directory must already exist In non blocking mode only one file or directory can be created at any one time since a single static FAT ile is used for temporary storage Each time you call this function pass the same dirname pointer not just the same string contents PARAMETERS part Handle for the partition being used dirname Pointer to the full path name of the directory to be created RETURN VALUE 0 success EINVAL invalid argument Trying to create volume label ENOENT parent directory does not exist EPERM the directory already exists or is write protected EBUSY the device is busy only if non blocking EFSTATE if non blocking but a previous sequence of calls to this function or fat _CreateFile has not completed and you are trying to create a different file or direc tory You must complete the sequence of calls for each file or directory i e keep calling until something other than EBUSY is returned Other negative values are possible from fat_Open fat_Close calls LIBRARY FAT LIB SEE ALSO fat ReadDir fat Status fat Open fat CreateFile 82 rabbit com Dynamic C Functions fat CreateFile int fat CreateFile fat part part char filename long alloc size FATfile file
60. SEE ALSO sprintf Dynamic C Functions rabbit com 361 printf cont d DYNAMIC C CONVERSION SPECIFIERS s string ls null terminated string in mem d signed decimal u unsigned decimal f float e exponential g floating point same as f or e depending upon value and precision p pointer lp pointer x hexadecimal result in lowercase X hexadecimal same as x but result in uppercase c single character s string The precision specifier the number between and s determines the maximum number of characters to display ain Brintt satinn ta printt gt s 3s lt n a gt print t gt s3s lt n al print t gt 3s lt n al printf RAAT AA AAA A TAREE AY n H printf gt s lt n abcd printf gt 3s lt n abcd printt gt 3s lt n abcd printf gt 3s lt n abcda As shown in the screenshot above a value to the right of causes the string to be displayed with that number of characters ignoring extra characters A value by itself or to the left of causes padding Negative values cause the string to be left justified with spaces added to the right if necessary Positive values cause the string to be right justified with spaces added to the left if necessary 362 rabbit com Dynamic C Functions printf cont d ls null terminated string in mem This conversion specifi
61. SetVectIntern GetVectIntern 474 rabbit com Dynamic C Functions SetVectExtern4000 unsigned SetVectExtern4000 int interruptNum void isr DESCRIPTION Function to set one of the external interrupt jump table entries for the Rabbit 4000 Rabbit 3000 and some versions of the Rabbit 2000 All Rabbit interrupts use jump vectors See SetVectIntern for more information PARAMETERS interruptNum External interrupt number 0 and 1 are the only valid values isr ISR handler address Must be a root address RETURN VALUE Jump address in vector table LIBRARY SYS LIB SEE ALSO GetVectExtern3000 SetVectIntern GetVectIntern Dynamic C Functions rabbit com 475 SetVectiIntern unsigned SetVectIntern int vectNum void isr DESCRIPTION Sets an internal interrupt table entry All Rabbit interrupts use jump vectors This function writes a jp instruction OxC3 followed by the 16 bit ISR address to the appropriate location in the vector table The location in RAM of the vector table is determined and set by the BIOS auto matically at startup The start of the table is always on a 0x100 boundary It is perfectly permissible to have ISRs in xmem and do long jumps to them from the vector ta ble It is even possible to place the entire body of the ISR in the vector table if it is 16 bytes long or less but this function only sets up jumps to 16 bit addresses The following table shows the vectNum value for each periph
62. User block on the primary flash to a set of buffers in root memory This function is usually used as the inverse function of writeUserBlockArray This function was introduced in Dynamic C version 7 30 Note Portions of the User block may be used by the BIOS to store values such as calibra tion constants See the manual for your particular board for more information before over writing any part of the User block Note When using a board with serial bootflash e g RCM4300 RCM4310 readUserBlockArray should be called until it returns zero or a negative error code A positive return value indicates that the SPI port needed by the serial flash is in use by another device However if using uC OS II and SPI USE UCOS MUTEX is defined then this function only needs to be called once If the mutex times out waiting for the SPI port to free up the run time error ERR_SPI_MUTEX_ERROR will occur See the description for _rcm43 InitUCOSMutex for more information on using uC OS II and SPI USE UCOS MUTEX PARAMETERS dests Pointer to array of destinations to copy data to numbytes Atray of numbers of bytes to be written to each destination numdests Number of destinations addr Address offset in User block to read from RETURN VALUE 0 Success 1 Invalid address or range 2 No valid System ID block found block version 3 or later The return values below are applicable only if SPI USE UCOS MUTEX is not defined ETIME Serial
63. WIPFICE issesteatescicsassti ston AES 463 SCLPBCIOSE ciiissecheccdenicsiessacnecadiniasetetaseaes 448 SCPC WHILE REESEN AT 464 SerBdatabits ccceesessececeeeeeeeeeeees 448 E 465 serBdmaOff cceceesessecececeeeeeeeeees 449 Ree 448 serBdmaOn 450 SerDdatabits ccceesessessecececeeeensensees 448 serBflowcontrolONn c cccceceeeeeeeesees 452 serDdmaOll deiere eer 449 Ser BEIC eer aiiis 453 serDdmaOn aa ss ccceise cucausaceinhcseaassendangetacs 450 serBgetError Agedro 454 serDflowcontrolOff ccsisosssnwasarerxanstiaasias 451 SELB OPEN energie deet 455 serDflowcontrolOn sccisssescnssacservesessesness 452 Ser Bparity eissor ispitni 456 BOLI GGUS lt snccsssaaatonendgecnveraarpeaunenastvedte 453 SEC CIC Goen 457 SEED SOIR MGW svsscacnnersavceeaszesenduameasesneesy 454 SEC PUG pssescaereaciiiuphesntaceausestayaavemdee 458 SERIOPEM ess ieegebiete santesnaseederssensive 455 SOU US eeben 459 SERA 456 SEP S EE 460 SEG eg 457 SCPBIGFree sissen A AE 460 SOLD PUIG reser EEn 458 s rBrdUs d WE 461 Seine geed dee 459 NEE 462 SerDrd Plush eege eaer ana 460 serBwrFlush 20 0 0 ceceeeeeesesseeeceeeeeeeeeesees 463 serDrdFree ccccceceeeseesessecececeeeeesssees 460 SCLPBWIPICE ssceccectasdevessssncceedaseaverasiens 463 SerDrdU sed ssecdeve csscccessashececeatescesiet case 461 EE 464 SerDredd weet deet 462 SELB WIUSE ssvcsecssesedessrgucvieds Edge 465 SCYDWIFIUSH 00 0 0 ce eeeeeeeeesseeececeeeeesesees 463 EE 448 SCT
64. amp D space mode the divider value is stored as a define byte in code space so directly accessing the variable will re sult in an incorrect load from constant data space This function uses the 1dp instruction which circumvents the separate I amp D default loading scheme so that the correct value is re turned RETURN VALUE The value used in baud rate calculation LIBRARY SYS LIB gets char gets char s DESCRIPTION Waits for a string terminated by lt CR gt at the stdio window The string returned is null terminat ed without the return The user should make sure only one process calls this function at a time PARAMETERS s The input string is put to the location pointed to by the argument s The caller is responsible to make sure the location pointed to by s is big enough for the string RETURN VALUE Same pointer passed in but string is changed to be null terminated LIBRARY STDIO LIB SEE ALSO puts getchar Dynamic C Functions rabbit com _GetSysMacroIndex int GetSysMacroIndex int n char buf uint32 value DESCRIPTION Skips to the nth macro entry and retrieves the macro name as defined by the compiler and the value of the macro as defined in the system macro table The system macro table contains board specific configuration parameters that are defined by the compiler and can be retrieved at runt ime through this interface The flash driver must be initialized and the System ID block
65. an error code that can contain one of the following e OS NO_ERR Call was successful and queue was deleted e OS ERR DEL ISR Attempt to delete queue from an ISR e OS ERR INVALID OPT Invalid option was specified e OS ERR TASK WAITING One or more tasks were waiting on the queue e OS ERR EVENT TYPE You didn t pass a pointer to a queue e OS ERR _PEVENT NULL If pevent is a null pointer RETURN VALUE pevent Error OS_ EVENT 0 The queue was successfully deleted LIBRARY OS OC Prior to DC 8 UCOS2 LIB 286 rabbit com Dynamic C Functions OSQFlush INT8U OSQFlush OS EVENT pevent DESCRIPTION Flushes the contents of the message queue PARAMETERS pevent Pointer to message queue s event control block RETURN VALUE OS NO ERR Success OS ERR EVENT TYPE A pointer to a queue was not passed OS ERR PEVENT NULL f pevent isa null pointer LIBRARY OS OC Prior to DC 8 UCOS2 LIB SEE ALSO OSQAccept OSQCreate OSQPend OSQPost OSQPostFront OSQQuery Dynamic C Functions rabbit com 287 OSQPend void OSQPend OS EVENT pevent INT16U timeout INT8U err DESCRIPTION Waits for a message to be sent to a queue PARAMETERS pevent Pointer to message queue s event control block timeout Allow task to resume execution if a message was not received by the num ber of clock ticks specified Specifying 0 means the task is willing to wait forever err Pointer to a variable for holding an error code RE
66. been resumed OS PRIO INVALID The priority you specify is higher than the maximum allowed i e 2 OS LOWEST PRIO OS TIME NOT DLY Task is not waiting for time to expire OS TASK NOT EXIST The desired task has not been created LIBRARY UCOS2 LIB SEE ALSO OSTimeDly OSTimeD1LyHMSM OSTimeDlySec Dynamic C Functions rabbit com 313 OSTimeDlySec INT8U OSTimeDlySec INT16U seconds DESCRIPTION Delays execution of the task until seconds expires This is a low overhead version of OSTimeD1yHMSM for seconds only PARAMETERS seconds The number of seconds to delay RETURN VALUE OS NO ERR The call was successful OS TIME ZERO DLY A delay of zero seconds was requested LIBRARY UCOS2 LIB SEE ALSO OSTimeDly OSTimeD1yHMSM OSTimeDlyResume 314 rabbit com Dynamic C Functions OSTimeGet INT32U OSTimeGet void DESCRIPTION Obtain the current value of the 32 bit counter that keeps track of the number of clock ticks RETURN VALUE The current value of OSTime LIBRARY UCOS2 LIB SEE ALSO OSTimeSet OSTimeSet void OSTimeSet INT32U ticks DESCRIPTION Sets the 32 bit counter that keeps track of the number of clock ticks PARAMETERS ticks The value to set OSTime to LIBRARY UCOS2 LIB SEE ALSO OSTimeGet Dynamic C Functions rabbit com 315 OSTimeTick void OSTimeTick void DESCRIPTION This function takes care of the processing necessary at the occurrence of each sys
67. bufLength dma _ addr _t srcAddress dma addr_ t destAddress dma addr t linkAddress dma_addr_t bufPtr int bufSize DESCRIPTION This function loads a DMA buffer descriptor in memory with the values provided The buffer needs to be described as either 12 or 16 bytes in size PARAMETERS chanControl MA channel control value bufLength MA buffer length D D srcAddress DMA source address D D destAddress MA destination address linkAddress MA link address of next buffer descriptor bufPtr Physical address of buffer descriptor to fill bufSize Size of buffer descriptor in bytes 12 or 16 only RETURN VALUE 0 Success EINVAL Error LIBRARY DMA LIB SEE ALSO DMAloadBufDesc DMAsetDirect Dynamic C Functions rabbit com 61 DMAsetDirect void DMAsetDirect int channel char chanControl unsigned int bufLength dma _ addr _ t srcAddress dma addr_t destAddress dma_addr_t linkAddress DESCRIPTION This function sets up a DMA channel with the values provided PARAMETERS channel DMA channel to set chanControl DMA channel control value bufLength DMA buffer length srcAddress DMA source address destAddress DMA destination address linkAddress DMA link address of next buffer descriptor LIBRARY DMA LIB SEE ALSO DMAloadBufDesc DMAsetBufDesc 62 rabbit com Dynamic C Functions DMAsetParameters int DMAsetParameters unsigned int transfer pri unsigned int interrupt pri unsigned int inter
68. buffer and compute the MDS hash of its contents combined with all pre vious data passed to it This function can be called several times to generate the hash of a large amount of data PARAMETERS md5 append Pointer to the md5_ state_t structure that was initialized by md5_ init data Pointer to the data to be hashed nbytes Length of the data to be hashed LIBRARY MD5 LIB md5 init void md5 init md5 state t pms DESCRIPTION Initialize the MDS hash process Initial values are generated for the structure and this structure will identify a particular transaction in all subsequent calls to the md5 library PARAMETER pms Pointer to the md5_state_t structure LIBRARY MD5 LIB Dynamic C Functions rabbit com 235 md5 finish void md5 finish md5 state t pms char digest 16 DESCRIPTION Completes the hash of all the received data and generates the final hash value PARAMETERS pms Pointer to the md5_ state_t structure that was initialized by md5_ init digest The 16 byte array that the hash value will be written into LIBRARY MD5 LIB 236 rabbit com Dynamic C Functions memchr NEAR SYNTAX void o memchr void src int ch unsigned int n FAR SYNTAX void far E memchr void far src int ch size tn Note By default memchr is defined to np memchr DESCRIPTION Searches up to n characters at memory pointed to by src for character ch For Rabbit 4000 users this function supports F
69. busy LIBRARY SDFLASH LIB Dynamic C Functions rabbit com 427 sdspi WriteContinue int sdspi WriteContinue sd device sd DESCRIPTION This function completes the previously started write command to the SD card when non block ing mode is enabled It looks for the end of the busy signal from the card then strobes the chip select This function should be called repeatedly until the EBUSY code is not returned at which point the SPI port is freed There is a timeout mechanism for the busy signal If exceeded the port is freed and the EIO error code is returned PARAMETERS sd The device structure for the SD card RETURN VALUE 0 Success EIO I O error or timeout EBUSY SD card is busy with write operation call sdspi_ WriteContinue again LIBRARY SDFLASH LIB 428 rabbit com Dynamic C Functions sdspi write sector int sdspi write sector sd device sd unsigned long sector number char data buffer DESCRIPTION This function is called to execute protocol command 24 to write a 512 byte block of data to the SD card PARAMETER sd Pointer to device structure of the SD card sector number The sector number to write data buffer Pointer to a buffer of 512 bytes to write RETURN VALUE 0 Success EIO I O error EACCES Write protected block no write access EINVAL Invalid parameter given ENOMEDIUM No SD card in socket ESHAREDBUSY Shared SPI port busy EBUSY SD card is busy with write ope
70. call this function from C Registers Parameters in IX DE respectively Trashes AF HL Return value in BCDE carry flag Example ld ix my_ pool ld de current element ld bc current _element 2 lcall pxnext fast jr c no_more_elems BCDE points to next allocated element PARAMETERS P Pool handle structure as previously passed to pool_xinit Pass this in the IX register e Current element address in BCDE register See pxnext for fuller de scription RETURN VALUE C flag set There are no more elements C flag clear NC BCDE points to next element LIBRARY POOL LIB SEE ALSO pool xinit pool link pxalloc pxfree pxfirst pxprev 380 rabbit com Dynamic C Functions pxprev long pxprev Pool t p long e DESCRIPTION Get the previous allocated element in an xmem pool The pool MUST be set to being a linked pool using pool link p lt non zero gt otherwise the results are undefined You can easily iterate through all of the allocated elements of an xmem pool using the following construct long e Pool t p for e pxlast p e e pxprev p eil PARAMETERS p Pool handle structure as previously passed to pool_xinit e Previous element address obtained by e g pxlast This must be an allocated element in the given pool otherwise the results are undefined Be careful when iterating through a list and deleting elements using pxfree once the element is deleted it
71. card RETURN VALUE 0 Success EIO I O error EINVAL Invalid parameter given ENOMEDIUM No SD card in socket ESHAREDBUSY Shared SPI port busy LIBRARY SDFLASH LIB 416 rabbit com Dynamic C Functions sdspi get scr int sdspi get scr sd device sd DESCRIPTION This function executes application specific command 51 to retrieve the SD card s Configuration Register SCR and store it in the respective SD driver configuration object The SCR data is used to identify the SD card s physical interface version and security version It also contains erase state all O s or 1 s and supported bus widths PARAMETERS sd The device structure for the SD card RETURN VALUE 0 Success EIO I O error EINVAL Invalid parameter given ENOMEDIUM No SD card in socket ESHAREDBUSY Shared SPI port busy LIBRARY SDFLASH LIB Dynamic C Functions rabbit com 417 sdspi getSectorCount long sdspi_ getSectorCount sd device dev DESCRIPTION Return number of usable 512 byte sectors on an SD card PARAMETER dev Pointer to sd_ device struct for initialized flash device RETURN VALUE Number of sectors LIBRARY SDFLASH LIB sdspi get status reg int sdspi get status _reg sd device sd int status DESCRIPTION This function is called to execute protocol command 13 to retrieve the status register value of the SD card PARAMETERS sd Pointer to the device structure for the SD card status Pointer to va
72. com 209 i2c_startw tx int i2c_startw tx void DESCRIPTION Initiates I C transmission by sending the start sequence which is defined as a high to low tran sition on SDA while SCL is high The point being that SDA is supposed to remain stable while SCL is high If it does not then that indicates a start S or stop P condition This function first waits for possible clock stretching which is when a bus peripheral holds SCK low This function is essentially the same as i2c_start_tx with the addition of a clock stretch delay which is 2000 counts inserted after the start sequence A count is an iteration through a loop RETURN VALUE 0 Success 1 Clock stretching timeout LIBRARY I2C LIB SEE ALSO Technical Note 215 Using the I2C Bus with a Rabbit Microprocessor 210 rabbit com Dynamic C Functions i2c stop tx void i2c stop tx void DESCRIPTION Sends the stop sequence to the slave which is defined as bringing SDA high while SCL is high i e the clock goes high then data goes high LIBRARY I2C LIB SEE ALSO Technical Note 215 Using the I2C Bus with a Rabbit Microprocessor i2c write char int i2c write char char d DESCRIPTION Sends 8 bits to slave Checks if slave pulls data low for ACK on clock pulse Allows for clocks stretching on SCL going high PARAMETERS d Character to send RETURN VALUE 0 Success 1 Clock stretching timeout 1 NAK sent from slave LI
73. com 67 DMAunalloc int DMAunalloc dma_chan t handle DESCRIPTION This function deallocates a handle effectively closing the DMA channel to which it was asso ciated PARAMETER handle Handle for DMA channel returned by DMAalloc RETURN VALUE 0 Success EINVAL Error LIBRARY DMA LIB SEE ALSO DMAalloc DMAhandle2chan 68 rabbit com Dynamic C Functions Enable HW WDT void Enable HW WDT void DESCRIPTION Enables the hardware watchdog timer on the Rabbit processor The watchdog is hit by the peri odic interrupt which is on by default LIBRARY SYS LIB enableIObus void enableIObus void DESCRIPTION This function enables external I O bus operation on the Rabbit 3000 or Rabbit 4000 The exter nal I O bus must be enabled during any external I O bus operation and disabled during normal bus operations with other devices Parallel port A becomes the I O data bus and parallel port B bits 7 2 becomes the I O address bus This function is non reentrant Port A and B data shadow register values are NOT saved or restored in this function call If the macro PORTA_AUX_10 has been previously defined this function should not be called LIBRARY ExternIO LIB was in R3000 LIB prior to DC 10 SEE ALSO disablelIObus Dynamic C Functions rabbit com 69 errlogGetHeaderInfo root char errlogGetHeaderInfo void DESCRIPTION Reads the error log header and formats the output
74. delay is not possible if the ticker interrupts every 100 ms In this case the delay would be set to 0 The actual delay is rounded to the nearest tick PARAMETERS hours Number of hours that the task will be delayed max is 255 minutes Number of minutes max 59 seconds Number of seconds max 59 milli Number of milliseconds max 999 RETURN VALUE OS NO ERR Execution delay of task was successful OS _ TIME INVALID MINUTES Minutes parameter out of range OS TIME INVALID SECONDS Seconds parameter out of range OS TIME INVALID MS Milliseconds parameter out of range OS TIME ZERO DLY LIBRARY OS TIME OC Prior to DC 8 ucos2 1lib SEE ALSO OSTimeDly OSTimeDlyResume OSTimeDlySec 312 rabbit com Dynamic C Functions OSTimeDlyResume INT8U OSTimeDlyResume INT8U prio DESCRIPTION Resumes a task that has been delayed through a call to either OSTimeD1ly or OSTimeD1yHMSM Note that this function MUST NOT be called to resume a task that is waiting for an event with timeout This situation would make the task look like a timeout oc curred unless this is the desired effect Also a task cannot be resumed that has called OSTimeD1yHMSM with a combined time that exceeds 65535 clock ticks In other words if the clock tick runs at 100 Hz then a delayed task will not be able to be resumed that called OSTimeDlyHMSM 0 10 55 350 or higher PARAMETERS prio Priority of the task to resume RETURN VALUE OS NO ERR Task has
75. destination string sre Pointer to location to source string RETURN VALUE Pointer to destination string LIBRARY STRING LIB SEE ALSO strncat Dynamic C Functions rabbit com 497 strchr NEAR SYNTAX char o strchr char src char ch FAR SYNTAX char far E strchr char far src char ch Note By default strchr is defined to pn strchr DESCRIPTION Scans a string for the first occurrence of a given character For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_STRING macro is de fined and all pointers are near pointers append n_ to the function name e g n strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS sre String to be scanned ch Character to search RETURN VALUE Pointer to the first occurrence of ch in src Null if ch is not found LIBRARY STRING LIB SEE ALSO Strrechr strtok 498 rabbit com Dynamic C Functions strcmp NEAR SYNTAX in
76. disable interrupts for a long time The interrupt disable time is directly proportional to the number of tasks waiting on the mailbox e Because ALL tasks pending on the mailbox will be readied you MUST be careful in applications where the mailbox is used for mutual exclusion because the resource s will no longer be guarded by the mailbox PARAMETERS pevent Pointer to the event control block associated with the desired mailbox opt May be one of the following delete options e OS DEL NO PEND Delete mailbox only if no task pending e OS DEL ALWAYS Deletes the mailbox even if tasks are waiting In this case all the tasks pending will be readied err Pointer to an error code that can contain one of the following values e OS NO ERR Call was successful mailbox was deleted e OS ERR DEL ISR Attempt to delete mailbox from ISR e OS ERR INVALID OPT Invalid option was specified e OS ERR TASK WAITING One or more tasks were waiting on the mailbox e OS ERR EVENT TYPE No pointer passed to a mailbox e OS ERR _PEVENT NULL If pevent is a null pointer RETURN VALUE l void 0 Is a pointer to the event control clock OS_EVENT associated with the created mailbox void 0 If no event control blocks were available LIBRARY OS _MBOX C Dynamic C Functions rabbit com 269 OSMboxPend void OSMboxPend OS EVENT pevent INT16U timeout INT8U err DESCRIPTION Waits for a message to be sent to a mailbox PARAMETERS
77. effect unless expressly agreed to in writing by Rabbit No amendment to or modification of this License will be binding unless in writing and signed by a duly authorized representative of Rabbit Digi International Inc 2008 e All rights reserved 560 rabbit com Dynamic C Functions
78. egener Eegeregie 43 sdspi_notbusy ssvesecsacdseenssseecnersanaevevenvene 421 ER ett hacasdi sein vesnovecsaseepeseatenmeinag ennn 76 sdspi print OV ege EEGEN 422 leegent 17 sdept Process Commande 423 Eloge eege 145 sdept read sector ccssccececeeeeeeeesees 424 See SPE ee en re E 145 Sdspi_reset_Card eccessseececeeeeeeeesees 425 PLEX EE 152 sdspi_sendingAP ssccceceeeeeeeetees 426 ebe 212 sdspi_set_block_length cce 427 WACK ss ce cerdes ea E 213 Sdspi_SetLED sccscessaisssenseseesnesssdevecteseons 426 lOp enge hoes eshasecavasneoecvasteve vn i e aia 213 Sdspi_Write_sector ccsscccceceeeeeeeetees 429 ST UG 224 sdspi_WriteContinue eee 428 WAGE eebe 244 f le 347 Flash Serial POW eeh dE 353 BEE eegenen Are E 353 SE eren Si RE 387 eT UN eseye Ha EIDA 387 Ee ER EE 388 See E PS eege 388 eg ae eege 489 ee mee EE 489 Si AeA Vie eegene 483 oTa E 496 e a Sep El eeg 496 eener SS tee 518 Dynamic C Functions rabbit com xix T nt geste stet egb ogeg esste eg IEE 519 C020 4 cee eee RRE 389 Eet Aere 390 G WPO E dgeiuedieue Ed a n atay 539 Global Positioning System KE 540 gps_get_position sisssccrdenassrccanscvnederscries 182 12C Protocol GEN Se Uc check ack oo cececeeeeeesssenscccceeeeeees 206 n a TS REN 207 H ec read chat ecccccccccccsssssessececceesseeeeees 207 Uc send ack weiceccccccccccssesessececceeseeeeeees 208 HDLC Protocol Rabbit 3000 4000 i2c_send_nak E 20
79. ends of the stream must begin with the same initialization vector and key For security it is very important never to use the same initialization vector twice with the same key Dynamic C Functions rabbit com asec float asec float x DESCRIPTION Computes the arcsecant of real float value x Note The Dynamic C functions deg and rad convert radians and degrees PARAMETERS x Assumed to be between INF and INF RETURN VALUE The arcsecant of the argument in radians LIBRARY MATH LIB SEE ALSO cos acos asin float asin float x DESCRIPTION Computes the arcsine of real float value x Note The Dynamic C functions deg and rad convert radians and degrees PARAMETERS x Assumed to be between 1 and 1 RETURN VALUE The arcsine of the argument in radians LIBRARY MATH LIB SEE ALSO sin acsc 10 rabbit com Dynamic C Functions atan float atan float x DESCRIPTION Computes the arctangent of real float value x Note The Dynamic C functions deg and rad convert radians and degrees PARAMETERS X Assumed to be between INF and INF RETURN VALUE The arctangent of the argument in radians LIBRARY MATH LIB SEE ALSO tan acot Dynamic C Functions rabbit com 11 atan2 float atan2 float y float x DESCRIPTION Computes the arctangent of real float value y x to find the angle in radians between the x axis and the ray through 0 0
80. exclusion semaphore In other words when the semaphore is acquired and a higher priority task at tempts to obtain the semaphore then the priority of the task owning the semaphore is raised to this priority It is assumed that you will specify a pri ority that is LOWER in value than ANY of the tasks competing for the mu tex Pointer to error code that will be returned to your application e OS NO ERR if the call was successful e OS ERR CREATE ISR you attempted to create a mutex from an ISR e OS PRIO EXIST a task at the priority inheritance priority already ex ist e OS ERR _PEVENT NULL no more event control blocks available e OS PRIO_ INVALID ifthe priority you specify is higher that the max imum allowed i e gt OS LOWEST PRIO Pointer to the event control clock OS_ EVENT associated with the created mutex Error detected Dynamic C Functions rabbit com 279 OSMutexDel OS EVENT OSMutexDel OS EVENT pevent INT8U opt INT8U err DESCRIPTION This function deletes a mutual exclusion semaphore and readies all tasks pending on it Note that e This function must be used with care Tasks that would normally expect the presence of the mutex MUST check the return code of OSMutexPend e This call can potentially disable interrupts for a long time The interrupt disable time is directly proportional to the number of tasks waiting on the mutex e Because ALL tasks pending on the mutex will be rea
81. explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_STRING macro is de fined and all pointers are near pointers append n_ to the functionname e g n_ strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS str1 Pointer to string 1 str2 Pointer to string 2 n Maximum number of bytes to compare if zero then strings are considered equal RETURN VALUE lt 0 str1 is less than str2 because char in st r1 is less than corresponding char in st r2 0 str1 is identical to str2 gt 0 str1 is greater than st r2 because char in st r1 is greater than corresponding char in st r2 LIBRARY STRING LIB SEE ALSO strempi strcmp strncmp 506 rabbit com Dynamic C Functions strncpy NEAR SYNTAX char ro strncpy char dst char src unsigned int n FAR SYNTAX char far f strncpy char far dst char far src size tn Note By default strncpy is definedto n strncpy DESCRIPTION Copies a given number of characters from one string to another and padding with null characters or truncating as necessary For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macr
82. fat device table 78 rabbit com Dynamic C Functions fat AutoMount cont d PARAMETERS flags Run time device configuration flags to allow overriding the default device configuration flags If not overriding the default configuration flags spec ify FDDF_USE DEFAULT To override the default flags specify the ORed combination of one or more of the following e FDDF MOUNT PART_0 Mount specified partition e FDDF MOUNT PART 1 e FDDF MOUNT PART 2 FDDF MOUNT PART 3 e FDDF MOUNT PART ALL Mount all partitions e FDDF MOUNT _DEV_0 Apply to specified device e FDDF MOUNT D EN 1 e FDDF MOUNT DEV 2 e FDDF MOUNT DEV_3 e FDDF MOUNT DEV_ ALL Apply to all available devices e FDDF_NO_ RECOVERY Use norecovery if fails first time e FDDF_COND_DEV_FORMAT Format device if unformatted e FDDF COND PART FORMAT Format partition if unformatted e FDDF_UNCOND_DEV_FORMAT Format device unconditionally e FDDF_UNCOND_PART FORMAT Format partition unconditionally Note The FDDF_ MOUNT DART zx flags apply equally to all FDDF_MOUNT_DEV_ devices which are specified If this is a prob lem call this function multiple times with a single DEV flag bit each time Note Formatting the device creates a single FAT partition covering the entire device It is recommended that you always set the PART FORMAT flag bit if you set the corresponding DEV_FORMAT flag bit Dynamic C Func
83. flash only time out waiting for SPI postive N Serial flash only SPI in use by device N LIBRARY IDBLOCK LIB SEE ALSO writeUserBlockArray readUserBlock 394 rabbit com Dynamic C Functions registry enumerate int registry enumerate RegistryContext r int f int keyvalues DESCRIPTION void far ptr Enumerate registry r gt old_spec calling the specified function f for each section header and optionally key value pair The registry get function also performs enumeration in fact it is a wrapper for this function PARAMETERS r keyvalues ptr RegistryContext structure with at least the o1d_ spec field initialized For example use registry prep read to set up the struct cor rectly r gt old_spec Open resource handle of a readable resource containing the registry settings This is read from the current seek position thus in most cases call this function with a freshly opened resource handle Callback function to be invoked The function prototype must be as fol lows int f void far ptr int new sect char sect char far key char far value where the parameters are e ptr this is passed through from the 4th parameter to the registry enumerate function see below e new_sect boolean indicating whether this call is to introduce a new sec tion If true then sect is the new section name and key and value are not relevant e
84. for as long as the input buffer may be locked or whenever the buffer may become full as characters are written This function is non reentrant The functions cof_serEputs and cof_serFputs may be used with the Rabbit 3000 or Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is cof_serXputs port where port is one of the macros SER_PORT A through SER_PORT E PARAMETERS str Null terminated character string to write LIBRARY RS232 LIB EXAMPLE writes a null terminated character string repeatedly main const char s Hello Rabbit serAopen 19200 LOCGTOLMALNE 5 while 1 loophead costate wid cof_serAputs s serAclose 34 rabbit com Dynamic C Functions cof serxXread int cof serXread void data int length unsigned long tmout X is A F DESCRIPTION This single user cofunction reads Length characters from port X where X is A B C D E or F or until tmout milliseconds transpires between characters read It yields to other tasks for as long as the input buffer is locked or whenever the buffer becomes empty as characters are read A timeout will never occur if no characters have been read This function is non reentrant The functions oof serEread and cof _serFread may be used w
85. for a description of the message logging subsystem PARAMETERS ldst Destination class and stream Use one of the constants LOG_DEST_FS2 or LOG DEST _XMEM then OR in the stream number 0 63 whence O first entry 1 last entry other values reserved RETURN VALUE 0 success 1 Log empty 2 Unrecoverable error or not open 3 Not a seekable or configured log destination class 4 invalid whence parameter LIBRARY log lib SEE ALSO log next log prev Dynamic C Functions rabbit com 223 log10 float log10 float x DESCRIPTION Computes the base 10 logarithm of real float value x PARAMETERS x Value to compute RETURN VALUE The log base 10 of x The function returns INF and signals a domain error when x lt 0 LIBRARY MATH LIB SEE ALSO log exp longjmp void longjmp jmp buf env int val DESCRIPTION Restores the stack environment saved in array env See the description of set jmp for details of use Note you cannot use Llongjmp to move out of slice statements costatements or cofunctions PARAMETERS env Environment previously saved with set jmp val Integer result of set jmp LIBRARY SYS LIB SEE ALSO setjmp 224 rabbit com Dynamic C Functions loophead void loophead void DESCRIPTION This function should be called within the main loop in a program It is necessary for proper sin gle user cofunction abandonment handling
86. format match the format fields in format For example snprintf buffer BUF LEN s x variable x 256 puts the string variable x 100 into buffer A complete list of valid conversion specifiers od s etc can be found in the description for printf under Dynamic C Conversion Specifiers The macro STDIO_ DISABLE FLOATS can be defined if it is not necessary to format floating point numbers If this macro is defined Ge f and g will not be recognized This can save thousands of bytes of code space This function can be called by processes of different priorities PARAMETERS buffer Location of formatted string len The maximum length of the formatted string format String to be formatted SA Format arguments RETURN VALUE The number of characters written If the output is truncated due to the 1en parameter then this function returns the number of characters that would have been written had there been enough space LIBRARY STDIO LIB SEE ALSO printf sprintf 490 rabbit com Dynamic C Functions SPIinit void SPIinit void DESCRIPTION Initialize the SPI port parameters for a serial interface only This function does nothing for a par allel interface A description of the values that the user may define before the Huse SPI LIB statement is found at the top of the library Lib Spi Spi 1ib LIBRARY SPI LIB SEE ALSO SPIRead SPIWrite SPIWrRd Dynamic C Functions rabbit com 491 SPIRead vo
87. hitwdQ 7 EE eege aed 0 call hitwdQ 8 DEE gie EE call hitwdQ 9 DEER eegen LEE See call hitwdQ Periodic Interrupt disabled so 10 Cclk Pclk 32kHz 16 2 048KHz call bitwa Dynamic C Functions rabbit com 469 Set cpu power mode cont d clkDoubler Clock doubler setting CLKDOUBLER_ON or CLKDOUBLER_ OFF CPU will operate at half selected speed when turned off This param eter only affects main oscillator modes not 32 KHZ oscillator modes Turning Clock doubler off reduces power consumption shortChipSelect Short Chip Select setting Use SHORTCS_ OFF or SHORTCS_ON Note When short chip select is on make sure that interrupts are dis abled during I O operations Turning Short Chip Select on may reduce power consumption See the Rabbit processor manual for more information regarding chip selects and low power operation RETURN VALUE 0 valid parameter 1 invalid parameter LIBRARY low_power lib 470 rabbit com Dynamic C Functions setjmp int setjmp jmp buf env DESCRIPTION Store the PC program counter SP stack pointer and other information about the current state into env The saved information can be restored by executing longjmp Note you cannot use set jmp to move out of slice statements costatements or cofunctions Typical usage switch setjmp e case 0 first time try to execute TO may call longjmpQ break if we get here f wa
88. ieren eenntetegga gege 358 serBdmaOn E 450 PICO el EE 359 serCdmaOQff EE 449 MNO sense esksdetcectcenncdnicee aceasta eee 370 SerCdmaOn cceceesseccesccccesseeeeceeesees 450 Pxalloc_fast seisis 371 REISCH eebe gEgeie 449 PRCAMOG 3 jisigsidtciscaeaceiiisbinsianseatecageanies 372 Set eat M6025 dagteeiacesertdonccinuaaeeealuetons 450 PROSE ee 373 SerEdmaOf ceceeeeccesceccescceeecceeeeee 449 PXfirst_fast eceesscscceceesesssesenseeeeeeess 374 SEH eegenen eg 450 TER 375 SerFdmaOfe ceceeeeeccesceceseccesecceenees 449 PRINCE EE 376 SEENEN 450 TEEN 377 serXdmaOff cceceececcesceccsssceeecceeeees 449 PXlast_fast ceceesessececeeeesssessnteeeeeeeees 378 serXdmaOn E 450 PRM see 379 prext reste eege 380 Dynamic Memory Allocation PRPTEV ee 381 DEE eege 322 E 382 palloc_fast E 323 PaVall siessccsiecccesesiessscdatiecedenveteadarezectans 324 E pavail_fast sccsccdsnssseacassereccsasnssendasbedaders 325 ECC Gil 326 f CalculateECC256 cccceccccccccccceceeeeeeeeeees 22 ES See 327 ee eee ac sce se a a 23 Pest AAS sisscecensastevedtasbocaelassvvertasneoenes 328 xCalculateECC256 5 isc cestasascsasswessensnss 546 POS acces E tee eedayeieesteenienes 329 en EECHER 547 piree fast ee 330 Il 331 Error Handling HEES 339 errlogFormatEntry c cccsscssesseesesseeseeseees 71 plast fast sesser ensais 340 errlogFormatRegDump sscsssesesseeseeseees 72 pmovebetween oj scciadecsaaveaesnsacedeadanevece 341 errlogFormatStackDum
89. initial ly partitioning an LX or when estimating the capacity of an LX for user data a11 is a flag which indicates whether to return the total data capacity as if all current files were deleted or whether to return just the available data capacity The return value accounts for the packing ef ficiency which will be less than 100 because of the bookkeeping overhead It does not account for the free space required when any updates are performed however this free space may be shared by all files on the LX It also does not account for the space required for file metadata You can account for this by adding one logical sector for each file to be created on this LX You can also specify that the metadata be stored on a different LX by use of fs set _1x This function may be called either before or after fs init If called before then the La shift parameter must be set to the value to be used in fs_setup since the LS size is not known at this point 1s shift can also be passed as zero in which case the default size will be assumed a11 must be non zero if called before Ca init since the number of files in use is not yet known PARAMETERS 1xn Logical extent number to query all Boolean 0 for current free capacity only 1 for total Must use 1 if calling before fs init ls shift Logical sector shift i e log base 2 of LS size 6 to 13 may be zero to use default RETURN VALUE 0 The specified LX does not exist 0 Capacity o
90. inline Replaces current interrupt priority with another by rotating the new priority into the IP register PARAMETERS priority Interrupt priority range 0 3 lowest to highest priority LIBRARY UTIL LIB SEE ALSO ipres isalnum int isalnum int c DESCRIPTION Tests for an alphabetic or numeric character A to Z a to z and 0 to 9 PARAMETERS c Character to test RETURN VALUE 0 if not an alphabetic or numeric character 0 otherwise LIBRARY STRING LIB SEE ALSO isalpha isdigit ispunct Dynamic C Functions rabbit com 197 isalpha int isalpha int c DESCRIPTION Tests for an alphabetic character A to Z or a to Z PARAMETERS c Character to test RETURN VALUE 0 if not a alphabetic character 0 otherwise LIBRARY STRING LIB SEE ALSO isalnum isdigit ispunct iscntrl int iscntrl int c DESCRIPTION Tests for a control character 0 lt c lt 31 or c 127 PARAMETERS c Character to test RETURN VALUE 0 if not a control character O otherwise LIBRARY STRING LIB SEE ALSO isalpha isalnum isdigit ispunct 198 rabbit com Dynamic C Functions isCoDone int isCoDone CoData p DESCRIPTION Determine if costatement is initialized and not running PARAMETERS p Address of costatement RETURN VALUE 1 Costatement is initialized and not running 0 Otherwise LIBRARY COSTATE LIB isCoRunning int isCoRunning CoData p
91. is no longer valid to pass its ad dress to this function If this parameter is zero then the result is the same as pxlast This ensures the invariant pxlast p pxnext p ell e RETURN VALUE 0 There are no more elements 0 Points to previously allocated element LIBRARY POOL LIB SEE ALSO pool xinit Gool Link pxalloc pxfree pxlast pxnext Dynamic C Functions rabbit com 381 pxprev fast xmem long pxprev_ Cast Pool t p long e DESCRIPTION Get the previous allocated element in an xmem pool The pool MUST be set to being a linked pool using pool link p lt non zero gt otherwise the results are undefined This is an assembler only version of pxprev Do not call this function from C Registers Parameters in IX DE respectively Trashes AF HL Return value in BCDE carry flag Example ld ix my_pool ld de current element ld bc current element 2 lcall pxprev fast jr c no_more_elems BCDE points to previously allocated element PARAMETERS P Pool handle structure as previously passed to pool_xinit Pass this in IX register e Current element address in BCDE register See pxprev for fuller de scription RETURN VALUE C flag set there are no more elements C flag clear NC BCDE points to previous element LIBRARY POOL LIB SEE ALSO pool xinit pool link pxalloc pxprev 382 rabbit com Dynamic C Functions qd error char qd _error int channel
92. length DESCRIPTION Puts the current size of the file in bytes into length PARAMETERS file Handle for an open file length Pointer to the variable where the file length in bytes is to be placed RETURN VALUE 0 success EINVAL file is invalid LIBRARY FAT LIB SEE ALSO fat Open fat Seek 88 rabbit com Dynamic C Functions fat FormatDevice int fat FormatDevice mbr dev dev int mode DESCRIPTION Formats a device The device will have a DOS master boot record MBR written to it Existing partitions are left alone if the device was previously formatted The formatted device will be registered with the write back cache for use with the FAT library The one partition mode will instruct the routine to create a partition table with one partition using the entire device This mode only works if the device is currently unformatted or has no partitions If needed i e there is no MBR on the device this function is called by fat_AutoMount if its flags parameter allows it PARAMETERS dev Pointer to the data structure for the device to format mode Mode 0 normal use the partition table in the device structure 1 one partition using the entire device errors occur if there are already partitions in the device structure 3 force one partition for the entire device overwrites values already in the device structure RETURN 0 success EIO error trying to read the device or structure EINVAL de
93. must be read before this function will return accurate results This function only applies to boards with Version 5 or later System ID blocks PARAMETERS n The index in the system macro table buf Character array to contain and return macro name copied from system macro table MUST BE AT LEAST SYS_MACRO_LENGTH bytes or function will overflow buffer and can crash system value Pointer to macro value to return to caller RETURN VALUE 0 if successful 1 invalid address or range use to find end of table 2 ID block or macro table invalid LIBRARY IDBLOCK LIB SEE ALSO _GetSysMacro Value 178 rabbit com Dynamic C Functions _GetSysMacrovValue int GetSysMacroValue char name long value DESCRIPTION Finds the system table macro named by the first parameter as defined by the compiler and re trieves the value of the macro as defined in the system macro table The system macro table con tains board specific configuration parameters that are define by the compiler and can be retrieved at runtime through this interface The flash driver must be initialized and the System ID block must be read before this function will return accurate results See writeUserBlockArray for more details This function only applies to boards with Version 5 or later System ID blocks PARAMETERS name Name of System ID block macro acts as lookup key value Pointer to macro value to return to caller RETURN VALUE 0 if successful
94. n 0x100 A printf 0c n A char n n TAT printf 0c n A Not supported o octal E same as e result uppercase the result is always in uppercase in Dynamic C G same as g result uppercase the result is always in uppercase in Dynamic C 366 rabbit com Dynamic C Functions putchar void putchar int ch DESCRIPTION Puts a single character to Stdout The user should make sure only one process calls this function at a time PARAMETERS ch Character to be displayed LIBRARY STDIO LIB SEE ALSO puts getchar puts int puts char s DESCRIPTION This function displays the string on the stdio window in Dynamic C The Stdio window is re sponsible for interpreting any escape code sequences contained in the string Only one process at a time should call this function PARAMETERS s Pointer to string argument to be displayed RETURN VALUE 1 Success LIBRARY STDIO LIB SEE ALSO putchar gets Dynamic C Functions rabbit com 367 pwm init unsigned long Gem init unsigned long frequency DESCRIPTION Sets the base frequency for the pulse width modulation PWM and enables the PWM driver on all four channels The base frequency is the frequency without pulse spreading Pulse spreading see pwm_set will increase the frequency by a factor of 4 This function is intended for use with the Rabbit 3000 and Rabbit 4000 PARAMETER frequency Requested fr
95. not currently erasing or writing a page LIBRARY NFLASH LIB This function was introduced in Dynamic C 9 01 SEE ALSO nf_isBusyRBHW 252 rabbit com Dynamic C Functions nf readPage int nf readPage nf device dev long buffer long page DESCRIPTION Reads data from the specified NAND flash device and page to the specified buffer in xmem Note that in the case of most error results at least some of the NAND flash page s content has been read into the specified buffer Although the buffer content must be considered unreliable it can sometimes be useful for inspecting page content in bad blocks PARAMETERS dev Pointer to an initialized nf device structure buffer Physical address of the xmem buffer to read data into page Specifies the zero based number of a NAND flash page to be read relative to the first good page s number RETURN VALUE 0 Success or the first error result encountered 1 NAND flash device is busy 2 Block check time out error 3 Page is in a bad block 4 Page read time out error 5 Uncorrectable data or ECC error LIBRARY NFLASH LIB This function was introduced in Dynamic C 9 01 SEE ALSO CalculateECC256 ChkCorrectECC256 xCalculateECC256 xChkCorrectECC256 Dynamic C Functions rabbit com 253 nf writePage int nf writePage nf device dev long buffer long page DESCRIPTION Writes data to the specified NAND flash device and page from the specified buffer in xmem C
96. not exist ENOSPC no allocatable sectors were found EPERM write protected trying to create a file on a read only partition EBUSY the device is busy non blocking mode only EFSTATE if non blocking but a previous sequence of calls to this function of fat_CreateFile has not completed but you are trying to create a different file or directory You must complete the sequence of calls for each file or directory i e keep calling until something other than EBUSY is returned This code is only returned if you pass a NULL file pointer or if the file pointer is not NULL and the referenced file is already open EPATHSTR Bad file directory path string Valid filenames are limited to the 8 3 format Other negative values indicate I O error etc Dynamic C Functions rabbit com 83 fat CreateFile cont d LIBRARY FAT LIB SEE ALSO fat Open fat _ReadDir fat Write fat CreateTime int fat CreateTime fat dirent entry struct tm t DESCRIPTION This function puts the creation date and time of the entry into the system time structure t The function does not fill in the tm_wday field in the system time structure PARAMETERS entry Pointer to a directory entry t Pointer to a system time structure RETURN VALUE 0 success EINVAL invalid directory entry or time pointer LIBRARY FAT LIB SEE ALSO fat ReadDir fat Status fat LastAccess fat _LastWrite 84 rabbit com Dynamic C Functions fat Delete
97. number of characters of unused data space This function is non reentrant The functions serErdFree and serFrdFree may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXrdFree int port where port is one of the macros SER_PORT A through SER_PORT E RETURN VALUE The number of chars it would take to fill input buffer X LIBRARY RS232 LIB 460 rabbit com Dynamic C Functions serxXrdUsed int serXrdUsed void where X is A F DESCRIPTION Calculates the number of characters ready to read from the serial port receive buffer This func tion is non reentrant The functions serErdUsed and serFrdUsed may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXrdUsed int port where port is one of the macros SER_PORT A through SER_PORT E RETURN VALUE The number of characters currently in serial port X receive buffer LIBRARY RS232 LIB Dynamic C Functions rabbit com 461 serXread int serXread void data int length unsigned long tmout where X is A F DESCRIPTION
98. number of characters required to display a signed long number PARAMETERS num 32 bit signed number RETURN VALUE The number of characters to display signed long number LIBRARY STDIO LIB SEE ALSO ltoa Dynamic C Functions rabbit com 227 1x format int lx format FSLXnum lxn long wearlevel DESCRIPTION Format a specified file system extent This must not be called before calling fs init All files which have either or both metadata and data on this extent are deleted Formatting can be quite slow depending on hardware so it is best performed after power up if at all PARAMETERS lxn Logical extent number 1 s num_1x inclusive wearlevel Initial wearlevel value This should be 1 if you have a new flash and some larger number if the flash is used If you are reformatting a flash you can use 0 to use the old flash wear levels RETURN VALUE 0 Success 0 Failure ERRNO VALUES ENODEV no such extent number or extent is reserved EBUSY one or more files were open on this extent EIO I O error during format If this occurs retry the format operation If it fails again there is probably a hardware error LIBRARY FS2 L1B SEE ALSO fs init fs format 228 rabbit com Dynamic C Functions mbr CreatePartition int mbr CreatePartition mbr drive drive int pnum char type DESCRIPTION Creates or modifies the partition specified The partition being modified must not be mounted
99. only result from an 1 1 externally applied torque This is a true simulation of mechanical gearing Call this function with countO or count zero or both slaveO and slavel zero to exit from gear mode When a servo that was slaved is set to normal mode its velocity is set to zero PARAMETERS counto Encoder increment for the first servo which results from count increments of the second servo countl1 Encoder increment for the second servo which results from countO incre ments of the first servo Together count0 and count determine the gearing ratio Neither value should be set to a mag nitude greater than about 500 to avoid internal arithmetic overflow In any gear mode the total movement of either servo should be limited to less than about 2M counts in either direction from the point at which gear mode was set If a smaller range of movement is acceptable then the maximum of either count parameter may be increased proportionally The value of count0 count1 or count1 count0 should not have a magnitude greater than about 10 to avoid en coder quantization problems especially in cross coupled mode D L Dynamic C Functions rabbit com 435 servo gear cont d Slaven 1 if first servo slaved to second else zero slavel 1 if second servo slaved to first else zero LIBRARY SERVO LIB SEE ALSO servo _closedloop servo torque 436 rabbit com Dynamic C Functions servo graph int servo graph int which
100. page size of 512 bytes or to its erase block size of 16 KB If not defined by the application NFLASH USEERASEBLOCKSIZE is set to the value 1 in NFLASH LIB this mode should maximize the NAND flash devices life NFLASH USEERASEBLOCKSIZE value 1 sets the driver up to program an erase block size at a time This mode may be best for applications with only a few files open in write mode with larger blocks of data being written and may be especially good at append operations The trade off is reduced flash erasures at the expense of chunkier overhead due to the necessity of per forming all 32 pages ECC calculations for each programming unit written NFLASH USEERASEBLOCKSIZE value 0 sets the driver up to program a program page size at atime This mode may be best for applications with more than a few files open in write mode with smaller blocks of data being written and may be especially good at interleaved file writes and or random access write operations The trade off is increased flash erasures with the benefit of spread out overhead due to the necessity of performing only 1 page s ECC calculations per programming unit written 248 rabbit com Dynamic C Functions nf initDevice cont d PARAMETERS dev Pointer to an nf device structure that will be filled in An initialized nf device struct acts as a handle for the NAND flash device which Number of the NAND flash device to initialize Currently supported de vice numbers are 0 for the s
101. pevent Pointer to mailbox s event control block timeout Allows task to resume execution if a message was not received by the num ber of clock ticks specified Specifying 0 means the task is willing to wait forever err Pointer to a variable for holding an error code Possible error messages are e OS MO ERR The call was successful and the task received a message e OS TIMEOUT A message was not received within the specified time out e OS ERR EVENT TYPE Invalid event type e OS ERR PEND ISR _ If this function was called from an ISR and the result would lead to a suspension e OS ERR DERVENT NULL If pevent is a null pointer RETURN VALUE l void 0 A pointer to the message received void 0 No message was received or pevent is a null pointer or the prop er pointer to the event control block was not passed LIBRARY OS MBOX C Prior to DC 8 UCOS2 LIB SEE ALSO OSMboxAccept OSMboxCreate OSMboxPost OSMboxQuery 270 rabbit com Dynamic C Functions OSMboxPost INT8U OSMboxPost OS EVENT pevent void msg DESCRIPTION Sends a message to the specified mailbox PARAMETERS pevent Pointer to mailbox s event control block msg Pointer to message to be posted A null pointer must not be sent RETURN VALUE OS MO ERR The call was successful and the message was sent OS MBOX FULL The mailbox already contains a message Only one message at a time can be sent and thus the message MUST be consumed be fore another can b
102. pool The pool MUST be set to being a linked pool using pool _link p lt non zero gt otherwise the results are undefined PARAMETERS p Pool handle structure as previously passed to pool_xinit RETURN VALUE 0 There are no allocated elements 0 Pointer to first i e oldest allocated element LIBRARY POOL LIB SEE ALSO pool xinit pool link pxalloc pxfree pxlast pxnext pxprev Dynamic C Functions rabbit com 373 pxfirst fast xmem long pxfirst fast Pool t p DESCRIPTION Get the first allocated element in an xmem pool The pool MUST be set to being a linked pool using pool link p lt non zero gt otherwise the results are undefined This is an assembler only version of pxfirst Do not call this function from C Registers Parameter in IX Trashes F HL Return value in BCDE carry flag Example ld ix my_ pool lcall pxfirst fast jr c no_elems BCDE points to first element PARAMETERS p Pool handle structure as previously passed to pool_init Pass this in IX register RETURN VALUE C flag set There are no allocated elements C flag clear NC BCDE points to first element LIBRARY POOL LIB SEE ALSO pool xinit pool link pxfirst pxnext fast 374 rabbit com Dynamic C Functions pxfree void pxfree Pool t p longe DESCRIPTION Free an element that was previously obtained via pxalloc Note if you free an element that was not allocated
103. purpose of data re covery in the case that the application knows more about the file structure than the filesystem PARAMETERS Pointer to file descriptor initialized by fopen_rd fopen_wr or fcreate where New position or offset whence One of the following values SEEK_SET where non negative only is relative to start of file SEEK CUR where positive or negative is relative to the current posi tion SEEK END where non positive only is relative to the end of the file SEEK_RAW Similar to SEEK_END except the file descriptor is set in a special mode which allows reading beyond the end of the file RETURN VALUE 0 Success 0 The computed position was outside of the current file contents and has been adjusted to the nearest valid position ERRNO VALUES None LIBRARY FS2 LIB SEE ALSO ftell FS2 fread FS2 fwrite FS2 Dynamic C Functions rabbit com 159 fs get flash 1x FS2 FSLXnum fs get flash _1x void DESCRIPTION Returns the logical extent number of the preferred flash device This is the second flash if one is available on your hardware otherwise it is the reserved area in your program flash In order for the program flash to be available for use by the file system you must define two constants the first constant is ZMEM RESERVE SIZE near the top of BIOS RABBITBIOS C This value is set to the amount of program flash to reserve in bytes This is required by the BIOS The sec
104. reentrant The functions serEputs and serFputs may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXputs int port where port is one of the macros SER_PORT A through SER_PORT E PARAMETERS s Null terminated character string to write RETURN VALUE The number of characters actually sent from serial port X LIBRARY RS232 LIB EXAMPLE writes a null terminated string of characters repeatedly main mee neu kemc hicticm Sill lm icl len alo louse serAopen 19200 while 1 serAputs s serAclose Dynamic C Functions rabbit com 459 serxXrdFlush void serXrdFlush void where X is A F DESCRIPTION Flushes serial port X input buffer This function is non reentrant The functions serErdFlush and serFrdFlush may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXrdFlush int port where port is one of the macros SER_PORT A through SER_PORT E LIBRARY RS232 LIB serxXrdFree int serXrdFree void where X is A F DESCRIPTION Calculates the
105. sect name of section if new_sect flag is true e key key field ascii string if new_sect is false e value value as an ascii string if new_sect is false Boolean indicating whether the callback function is to be invoked for key value pairs if true In either case the callback is inkoked whenever a new section is found and the new_sect callback parameter will be set true An arbitrary pointer which will be passed through to the callback on each invocation Dynamic C Functions rabbit com 395 registry enumerate cont d RETURN VALUE lt 0 failure to write or read the resource 0 success LIBRARY registry lib SEE ALSO sspec_open registry read registry update registry get registry prep read registry finish read 396 rabbit com Dynamic C Functions registry get int registry get char basename char far section RegistryEntry re ServerContext sctx int f int keyvalues void far ptr DESCRIPTION Convenience function for reading and or enumerating registry contents This basically com bines calls to the following functions registry prep read registry read and or registry enumerate registry finish read If the field array re is not NULL then registry read will be called If the callback function f is not NULL then registry enumerate will be called If both re and f are not NULL then read will be invoked before enumerate PARAMETERS basename Base name
106. sorted however the string sort is not efficient PARAMETERS base n s cmp RETURN VALUE 0 if the operation is successful LIBRARY SYS LIB Base address of the raw string data Number of blocks to sort Number of bytes in each block User supplied compare routine for two block pointers p and q that returns an int with the same rules used by Unix strcmp p q 0 Blocks p and q are equal lt 0 p is less than q gt 0 p is greater than q Beware of using ordinary strcmp it requires a null at the end of each string EXAMPLE Sorts an array of integers int mycmp int sp int q return p q Comat ame eli const int p 10 main age al qsone pr 2101 2 moere me foe fe Astra jowainew S6l Bel Glatz eran H12 ldr 2A er Vr JA Em 9 EE AOON Il Output from the above sample program 90 D 1 3 7 9 10 12 16 34 VO OO JO Us Ai O 12 1 3 2 16 7 9 34 90 10 386 rabbit com Dynamic C Functions rad float rad float x DESCRIPTION Convert degrees 360 for one rotation to radians 27 for a rotation PARAMETERS x Degree value to convert RETURN VALUE The radians equivalent of degree LIBRARY SYS LIB SEE ALSO deg rand float rand void DESCRIPTION Returns a uniformly distributed random number in the range 0 0 lt v lt 1 0 Uses algorithm rand 5 rand modulo 27 A default seed value is set on
107. specified in brk First call with non null for src Subsequent calls with null for src continue to search tokens in the string If a token is found Oe delineators found replace the first delimiter in src with a null terminator so that src points to a proper null terminated token PARAMETERS src String to be scanned must be in SRAM cannot be a constant In contrast strings initialized when they are declared are stored in flash memory and are treated as constants brk Character delimiter RETURN VALUE Pointer to a token If no delimiter therefore no token is found returns null LIBRARY STRING LIB SEE ALSO StErGhr SELYCHY Strstr Sstrespn 514 rabbit com Dynamic C Functions strtol NEAR SYNTAX long o strtol char sptr char tailptr int base FAR SYNTAX long E strtol char far sptr char far far tailptr int base Note By default strtol is defined to pn strtol DESCRIPTION ANSI string to long conversion For Rabbit 4000 users this function supports FAR pointers The macro USE_FAR STRING will change all calls to functions in this library to their far versions by default The user may also explicitly call the far version with strfunc where strfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR STRING macro is de fined and all
108. startup but can be changed with the srand function rand is not reentrant RETURN VALUE A uniformly distributed random number 0 0 lt v lt 1 0 LIBRARY MATH LIB SEE ALSO randb randg srand Dynamic C Functions rabbit com 387 randb float randb void DESCRIPTION Uses algorithm rand 5 rand modulo 27 A default seed value is set on startup but can be changed with the srand function randb is not reentrant RETURN VALUE Returns a uniformly distributed random number 1 0 lt v lt 1 0 LIBRARY MATH LIB SEE ALSO rand randg srand randg float randg void DESCRIPTION Returns a gaussian distributed random number in the range 16 0 lt v lt 16 0 with a standard de viation of approximately 2 6 The distribution is made by adding 16 random numbers see rand This function is not task reentrant RETURN VALUE A gaussian distributed random number 16 0 lt v lt 16 0 LIBRARY MATH LIB SEE ALSO rand randb srand 388 rabbit com Dynamic C Functions RdPortE int RdPortE unsigned int port DESCRIPTION Reads an external I O register specified by the argument PARAMETERS port Address of external parallel port data register RETURN VALUE Returns an integer the lower 8 bits of which contain the result of reading the port specified by the argument Upper byte contains zero LIBRARY SYSIO LIB SEE ALSO RdPortI BitRdPortI
109. structure is invalid EUNFORMAT the device is not formatted EBADPART the partition is a non FAT partition EPERM the partition is mounted EBUSY the device is busy Only if non blocking LIBRARY FAT LIB SEE ALSO fat FormatDevice fat EnumDevice fat _FormatPartition Dynamic C Functions rabbit com 105 fat Read int fat Read FATfile file char buf int len DESCRIPTION Given file buf and len this routine reads len characters from the specified file and plac es the characters into buf The function returns the number of characters actually read on suc cess Characters are read beginning at the current position of the file and the position pointer will be left pointing to the next byte to be read The file position can be changed by the fat Seek function If the file contains fewer than len characters from the current position to the EOF the transfer will stop at the EOF If already at the EOF 0 is returned The len pa rameter must be positive limiting reads to 32767 bytes per call PARAMETERS file Handle for the file being read buf Pointer to the buffer where data are to be placed len Length of data to be read RETURN VALUE Number of bytes read success May be less than the requested amount in non blocking mode or if EOF was encountered EEOF starting position for read was at or beyond end of file EIO device I O error EINVAL file buf or len contain invalid values EPER
110. system e g if you are writing a TCP IP based application Note This function is extremely dangerous when used with large sector flash Don t do it Note The sum of the lengths in numbytes must not exceed 65535 bytes else not all data will be written PARAMETERS flashDst Physical address of the flash destination rootSre Atray of pointers to the root sources numbytes Array of numbers of bytes to write for each source numsources Number of sources specified in rootSrc and numbytes RETURN VALUE 0 Success 1 Attempt to write non 2nd flash area nothing written 2 rootsrc entry not in root 3 Time out while writing flash LIBRARY XMEM LIB Dynamic C Functions rabbit com 533 write rtc void write rtc unsigned long int time DESCRIPTION Writes a 32 bit seconds value to the RTC zeros other bits This function does not stop or delay periodic interrupt It does not affect the SEC_TIMER or MS_ TIMER variables PARAMETERS time 32 bit value representing the number of seconds since January 1 1980 LIBRARY RTCLOCK LIB SEE ALSO read rtc 534 rabbit com Dynamic C Functions writeUserBlock int writeUserBlock unsigned addr void source unsigned numbytes DESCRIPTION Rabbit based boards have a System ID block located on the primary flash See the Rabbit Mi croprocessor Designer s Handbook for more information on the System ID block Version 2 and later of this ID block has a pointer t
111. terminated string of between 0 and 6 characters in length according to the value of the TZNAME macro If TZNAME is not defined then the returned string is zero length RETURN VALUE 0 timezone obtained from DHCP 1 timezone obtained from TIMEZONE macro The value of this macro which may be int float ora variable name is multiplied by 3600 to form the return value 2 timezone is zero since the TIMEZONE macro was not defined LIBRARY RTCLOCK LIB 414 rabbit com Dynamic C Functions runwatch void runwatch void DESCRIPTION Runs and updates watch expressions if Dynamic C has requested it with a Ctrl U Should be called periodically in user program LIBRARY SYS LIB sdspi debounce int sdspi_ debounce sd device sd DESCRIPTION This function waits for and debounces the card insertion switch When it returns True 1 then a card is fully inserted PARAMETER sd The device structure for the SD card RETURN VALUE 1 Success card fully inserted 0 No card present LIBRARY SDFLASH LIB Dynamic C Functions rabbit com 415 sdspi get csd int sdspi get _csd sd device sd DESCRIPTION This function is called to execute protocol command 9 to retrieve the SD card s Card Specific Data CSD and store it in the respective SD driver configuration object The CSD data is used to determine the SD card s physical storage and timing attributes PARAMETERS sd The device structure for the SD
112. than the near version To explicitly call the near version when the USE_FAR_ STRING macro is de fined and all pointers are near pointers append np to the function name e g n_ strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS s String to be searched c Search character RETURN VALUE Pointer to last occurrence of c in s If c is not found in s return null LIBRARY STRING LIB SEE ALSO strchr strcspn strtok Dynamic C Functions rabbit com 509 strspn NEAR SYNTAX size t n_strspn char src char brk FAR SYNTAX size t fC strspn char far src char far brk Note By default strspn is defined to pn strspn DESCRIPTION Scans a string for the first segment in src containing only characters specified in brk For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_ STRING macro is de fined and all pointers are near pointers append nm tothe function name e g _n_strfunc For mo
113. the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS sptr String to convert RETURN VALUE The converted floating value If the conversion is invalid xtoxErr is setto 1 Otherwise xtoxErr is set to 0 LIBRARY STRING LIB SEE ALSO atoi atol strtod Dynamic C Functions rabbit com 13 atoi NEAR SYNTAX int _n atoi char sptr FAR SYNTAX int f atoi char far sptr Note By default atoi is defined to_n_atoi il DESCRIPTION ANSI string to integer conversion UNIX compatible For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_STRING macro is de fined and all pointers are near pointers append n_ to the function name e g n strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS sptr String to convert RETURN VALUE The converted integer value LIBRARY STRING LIB SEE ALSO atol atof strtod 14 rabbit com Dynamic C Functions ato
114. the Rabbit processor to use the main oscillator for both the CPU and peripheral clock If this is already set there is no effect This function also enables the periodic interrupt in case it was disabled by a call to use32kHzOsc and updates the TICK_TIMER MS TIMER and SEC_TIMER variables from the real time clock This function is not task reentrant LIBRARY SYS LIB SEE ALSO use32kHzOsc useClockDivider utoa char utoa unsigned value char buf DESCRIPTION Places up to 5 digit character string at buf representing value of unsigned number Suppresses leading zeros but leaves one zero digit for value 0 Max 65535 73 program bytes PARAMETERS value 16 bit number to convert buf Character string of converted number RETURN VALUE Pointer to null at end of string LIBRARY STDIO LIB SEE ALSO itoa htoa ltoa Dynamic C Functions rabbit com 527 vram2root int vram2root void dest int start int length DESCRIPTION This function copies data from the VBAT RAM Tamper detection on the Rabbit 4000 erases the VBAT RAM with any attempt to enter bootstrap mode PARAMETERS dest The address to which the data in the VBAT RAM will be copied start The start location within the VBAT RAM 0 31 length The length of data to read from VBAT RAM The length should be greater than 0 The parameters Length start should not exceed 32 LIBRARY VBAT LIB SEE ALSO root2vram 528 rabbit com Dynamic C Fu
115. this could cause problems if await for DelaySec n is pending completion in a co operative multitasking program or if the SEC_ TIMER variable is being used in another way the user so user beware PARAMETERS t Pointer to structure to read date and time from struct tm char tm_sec seconds 0 59 char tm_min 0 59 char tm_hour 0 23 char tm_mday 1 31 char tm_ mon 1 12 char tm year 80 147 1980 2047 char tm wday 0 6 0 Sunday ba RETURN VALUE 0 Success 1 Failure LIBRARY RTCLOCK LIB SEE ALSO mktm mktime tm rd rabbit com Dynamic C Functions tolower int tolower int c DESCRIPTION Convert alphabetic character to lower case PARAMETERS c Character to convert RETURN VALUE Lower case alphabetic character LIBRARY STRING LIB SEE ALSO toupper isupper islower toupper int toupper int c DESCRIPTION Convert alphabetic character to uppercase PARAMETERS c Character to convert RETURN VALUE Upper case alphabetic character LIBRARY STRING LIB SEE ALSO tolower isupper islower Dynamic C Functions rabbit com 523 updateTimers void updateTimers void DESCRIPTION Updates the values of TICK_TIMER MS_ TIMER and SEC_TIMER while running off the 32 kHz oscillator Since the periodic interrupt is disabled when running at 32 kHz these values will not updated unless this function is called LIBRARY SYS LIB SEE ALSO useMainOsc use32kHzOsc
116. time interval so as to make the peak velocity equal to the 8k counts tick which is higher than any physical motor can follow accel_ticks is set to 16384 if it is over that since rounding errors can accumulate over long periods of low acceleration If this routine is called again before the previous motion is completed then the previous motion will be overridden by the new motion This routine uses floating point since the mathematics are quite complex It takes several milliseconds to execute so should not be called to perform motions which complete in less than say 50ms This routine does not attempt to control rate of change of acceleration jerk or d 3x dt 3 It approximates the required movement profile as parabolic constant acceleration and linear constant velocity segments PARAMETERS which Servo 0 or 1 pos Position to be achieved at end of movement ticks Number of ISR executions loop update rate over which to complete the movement If less than 1 it is set to 1 accel ticks Number of ticks over which acceleration is to be applied The remainder of the interval ticks accel_ticks is performed at constant velocity If greater than ticks it is set equal to ticks final v Final velocity to be achieved at end of movement Dynamic C Functions rabbit com 439 servo move to cont d RETURN VALUE 0 OK 1 computed velocity is extremely high time interval stretched to make velocity fit within
117. total exception count minus one the error log entries have wrapped around the log buffer LIBRARY ERRORS LIB 70 rabbit com Dynamic C Functions errlogGetNthEntry root int errlogGetNthEntry int N DESCRIPTION Loads errLogEntry structure with Nth entry of the error buffer This must be called before the functions below that format the output PARAMETERS N Index of entry to load into errLogEntry RETURN VALUE 0 Success entry checksum okay 1 Failure entry checksum not okay LIBRARY ERRORS LIB errlogFormatEntry root char errlogFormatEntry void DESCRIPTION Returns a null terminated string containing the basic information contained in errLogEntry Error type 240 Address 00 16aa Time 06 11 2001 20 49 29 RETURN VALUE The null terminated string described above LIBRARY ERRORS LIB Dynamic C Functions rabbit com 71 errlogFormatRegDump root char errlogFormatRegDump void DESCRIPTION Returns a null terminated string containing a register dump using the data in errLogEntry AF 0000 AF 0000 HL 00f0 HL 15e3 BC 16ce BC 1600 DE 0000 DE 1731 TX d3f1 1Y 0560 SP d3eb XPC 0000 RETURN VALUE The null terminated string described above LIBRARY ERRORS LIB errlogFormatStackDump root char errlogFormatStackDump void DESCRIPTION Returns a null terminated string containing a stack dump using the data in errLogEntry Stack Dump 0024 04f1 d378 c146 c400 a10
118. use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXparity int port where port is one of the macros SER_PORT A through SER_PORT E PARAMETERS parity mode An integer indicating what parity mode to use It is best to use one of the macros provided PARAM NOPARITY Disables parity handling default PARAM OPARITY Odd parity parity bit set to 0 if odd number of 1 s in data bits PARAM EPARITY Even parity parity bit set to 1 if even number of 1 s in data bits PARAM MPARITY Mark parity parity bit always set to logical 1 Rabbit 4000 only PARAM SPARITY Space parity parity bit always set to logical 0 Rabbit 4000 only PARAM 2STOP 2 stop bits From a logical standpoint the first three of these PARAM_ macros cannot be combined but even PARAM _2STOP must stand alone due to limita tions in the UART hardware that will not allow parity bits and extra stop bits LIBRARY RS232 LIB 456 rabbit com Dynamic C Functions serXpeek int serXpeek void where X is A F DESCRIPTION Returns first character in input buffer X without removing it from the buffer This function is non reentrant The functions serEpeek and serFpeek may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this func
119. using removable media such as an SD card you should call sdspi_debounce to determine when the card is fully inserted into the socket There are two arrays of data structures that are populated by calling fat_AutoMount The array named fat_part_mounted is an array of pointers to fat_part structures A fat part structure holds information about a specific FAT partition The other array Cat device table is composed of pointers to mbr_dev structures Anmbr_dev structure holds information about a specific device Partition and device structures are needed in many FAT function calls to specify the device and partition to be used An example of using Cat part _mounted was shown in the sample program fat create o FAT applications will need to scan fat_part_mounted to locate val id FAT partitions A valid FAT partition must be identified before any file and directory opera tions can be performed These pointers to FAT partitions may be used directly by indexing into the array or stored in a local pointer The fat _shell1 c sample uses an index into the array whereas most other sample programs make a copy of the pointer An example of using fat device _table is inthe sample program fat_shell c This array is used in FAT operations of a lower level than fat part mounted Specifi cally when the device is being partitioned formatted and or enumerated Calling fat AutoMount relieves most applications of the need to directly use
120. variable containing physical address of DMA buffer LIBRARY DMA LIB SEE ALSO DMAsetBufDesc DMAsetDirect Dynamic C Functions rabbit com 53 DMAmatchSetup int DMAmatchSetup dma _ chan t handle int mask int byte DESCRIPTION This function sets up the mask and match registers for the DMA These registers are only used when the DMA_F_STOP_MATCH flag is passed to the transfer function PARAMETERS handle mask byte LIBRARY DMA LIB SEE ALSO Handle for the DMA channel Mask for termination byte parameter 3 A value of all zeros disables the termination byte match feature A value of all ones uses the full termination byte for comparison Byte that if matched will terminate the buffer DMAmem2mem DMAtimerSetup 54 rabbit com Dynamic C Functions DMAmem2io0e int DMAmem2ioe dma_chan t handle unsigned int dest dma _ addr _t src unsigned int len unsigned int flags DESCRIPTION This function performs an immediate DMA operation from memory to external I O PARAMETERS handle Handle for channel to use in transfer dest External I O destination address sre Memory location source len Length to send cannot equal zero flags Various flag options See DMAioce2mem fora full list of flags and their descriptions RETURN VALUE 0 Success EINVAL Invalid handle EBUSY Resources are busy LIBRARY DMA LIB SEE ALSO DMAmem2mem DMAcompleted DMAstop Dynamic C Functions rabbit co
121. ve Zeg desse diene aR Age 196 Dynamic C Functions rabbit com vii EE Eeer 196 IMEMICHP eegend Seed EENEG 237 io E E E 197 MEMCMP EEN 238 E EE A E T 197 EHNEN degen ER EREN 239 ISAIPNA secies setres ean aaie gees 198 TON E 240 Eea a ME 198 MMEMISCE EE suvadecergies 241 ISCODONE asisicsapscicgedieaiadastaseadeaes REENEN 199 ALAT CEP 242 isCoRunning ssssssesssessessssesreereessssesreereesesses 199 LE E A E 243 isdi pit EE 200 OS 3c tesecs24isvcsdashaeiech idacessagnadcesdhidvestatneaeente 244 ISEEap ceesessscctocd ceed tepassoessuacedas sess casteteerestiones 201 SLOWER sedis cosccds dE EE EE EE E EKES 201 N Isprint SE 202 nf_eraseBIOCk c ccscscecscessccesscesscesseceseeeseees 245 ERR EE 203 nf_getPageCount c cccceessscscsssseseesescsseseseeeees 246 ISSPACE esssseesssesssecesseesssecesneesssessnneesneeeeeneeeny 202 P A 247 EAU a A tiaiensa dees anien ier sshaeaanaehieanensh teen inantea dss 204 ME IMtDEVICE cosses ieri is eege 248 isxdi DIE cssesdissssvebessund svcvecsccsevadeserivsudesverwesesves 204 nf InitDriver cccccccccscssesessececessessscecscsecesseces 250 Ion EE 205 nf isBusyRBHW cccccesssscscessesssseseesceseaeees 251 K t ASBUSYSUAWS den dASEAk EE d Ae de ER SE ai SS i E e eA oT AEE sees E E E AA 212 nf_writePage sesssesesssssessseeeesessssoseeeesessesee 254 L nf XD Detect u28deegeguge enge gu sea Ed us 255 EI GE 212 9 US EE 213 OpenInputCompressedFile ccceeesecteees 256 Ets 213 OpenOutput
122. versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_ STRING macro is de fined and all pointers are near pointers append n_ tothe function name e g n strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS dst Pointer to location to receive string sre Pointer to location to supply string n Maximum number of bytes to copy If equal to zero this function has no effect RETURN VALUE Pointer to destination string LIBRARY STRING LIB SEE ALSO strcat 504 rabbit com Dynamic C Functions strncemp NEAR SYNTAX int po strnemp char strl char str2 n FAR SYNTAX int f strncemp char far strl char far str2 unsigned n Note By default strncmp is defined to_n_strncemp DESCRIPTION Performs unsigned character by character comparison of two strings of length n For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_ STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string fu
123. will allocate additional sectors if needed Data will be written into the file starting at the current file position regardless of existing data Overwriting at specific points in the file can be accomplished by calling the fat_Seek function before calling fat _xWrite PARAMETERS file Handle for the open file being written xbuf xmem address of the buffer to be written len Length of data to write RETURN VALUE Number of bytes written success may be less than len or zero if non blocking mode EIO device I O error EINVAL file xbuf or len contain invalid values ENOENT the file directory does not exist ENOSPC there are no more sectors to allocate on the device EFAULT there is a problem in the file broken cluster chain etc EPERM the file is locked or write protected EBUSY the device is busy only if non blocking EFSTATE file is in inappropriate state only if non blocking LIBRARY FAT LIB SEE ALSO fat Open fat Read fat Write fat Seek 124 rabbit com Dynamic C Functions fclose void fclose File f DESCRIPTION Closes a file PARAMETERS f The pointer to the file to close LIBRARY FILESYSTEM LIB Dynamic C Functions rabbit com 125 fcreate FS1 int fcreate File FileNumber fnum DESCRIPTION Creates a file Before calling this function a variable of type File must be defined in the ap plication program File file fcreate amp file 1 PARAMETERS
124. word start word nlines word samples word what int low int high DESCRIPTION Draw ASCII art graph of servo response This is primarily intended for debugging It should be called after resetting the sample collection table using servo _ stats reset then exe cuting a movement whose response is to be graphed PARAMETERS which Servo 0 or 1 start Starting sample number nlines Number of lines sample bins in graph vertical axis samples Number of samples to cover should be multiple of nlines what Which statistic to print 0 is for error 1 for error integral 2 for error rate differential 3 for PWM output setting These may be customized to have different meanings low Low range of horizontal axis high High range of horizontal axis RETURN VALUE 0 OK 1 error LIBRARY SERVO LIB SEE ALSO servo alloc table servo read table servo stats reset Dynamic C Functions rabbit com 437 servo init void servo init void DESCRIPTION This function must be called once at the beginning of application code to initialize the servo li brary LIBRARY SERVO LIB SEE ALSO servo stats reset servo alloc table servo set _coeffs servo enable 0 servo millirpm2vcmd long servo millirpm2vcmd int which long millirpm DESCRIPTION Convert 1 1000 RPM units to velocity command value Basic formula is SERVO COUNT PER REV n millirpm 65536 vemd 60000 SERVO LOOP RATE HZ Floating point is us
125. 0 bit Bit location where 0 represents the least significant bit LIBRARY UTIL LIB SEE ALSO RES RES void RES void address unsigned int bit DESCRIPTION Dynamic C may expand this call inline Clears specified bit at memory address to 0 bit may be from 0 to 31 This is equivalent to the following expression but more efficient long address amp 1L lt lt bit PARAMETERS address Address of byte containing bits 7 0 bit Bit location where 0 represents the least significant bit LIBRARY UTIL LIB SEE ALSO res Dynamic C Functions rabbit com 411 ResetErrorLog void ResetErrorLog void DESCRIPTION This function resets the exception and restart type counts in the error log buffer header This function is not called by default from anywhere It should be used to initialized the error log when a board is programmed by means other than Dynamic C cloning the Rabbit Field Utility RFU or a service processor For example if boards are mass produced with pre programmed flash chips then the test program that runs on the boards should call this function LIBRARY ERRORS LIB root2vram int root2vram void src int start int length DESCRIPTION This function copies data to the VBAT RAM Tamper detection on the Rabbit 4000 erases the VBAT RAM with any attempt to enter bootstrap mode PARAMETERS sre The address to the data in root to be copied to vbat ram start The start location within
126. 2 fwrite FS2 172 rabbit com Dynamic C Functions fwrite FS1 int fwrite File char buf int len DESCRIPTION Appends len bytes from the source buffer to the end of the file PARAMETERS f A pointer to the file to write to buf A pointer to the source buffer len The number of bytes to write RETURN VALUE The number of bytes written Success 0 Failure LIBRARY FILESYSTEM LIB Dynamic C Functions rabbit com 173 fwrite FS2 int fwrite File f void buf int len DESCRIPTION Write data to file opened for writing The data is written starting at the current position This is zero start of file when it is opened or created but may be changed by fread fwrite fshift or fseek functions After writing the data the current position is advanced to the position just after the last byte written Thus sequential calls to fwrite will add or ap pend data contiguously Unlike the previous file system FILESYSTEM LIB this library allows files to be overwrit ten not just appended Internally overwrite and append are different operations with differing performance depending on the underlying hardware Generally appending is more efficient es pecially with byte writable flash memory If the application allows it is preferable to use ap pend shift rather than overwrite In order to ensure that data is appended use fseek f 0 SEEK END before calling fwrite The same current p
127. 2 BitWrPorti orssicscsn a 21 ET D 223 XX rabbit com Dynamic C Functions M O10 0 re 289 OSQPOStFront cccccceeseseseeeeseeeeeeeees 290 MDS OSQPostO pt irapa endear 291 Ee 235 OSQQUETY eececcccececeeesessetseeeeeeeeeensenaees 292 EH EE 236 OSSchedL OCK ooooooooooocoovooooocccccccccn 293 mds E ENEE deed 235 OSSchedUnIOCK eocoooooooooocooceecccecce 293 MicroC OS II OS em Accent cece ceesesteeceeeeeeeseeees 294 OOSQDEL ernn 286 OSSemCreate ccccccceeeseseeseeeeeeeees 295 OS_ENTER CRITICAL o 258 OS Sem fend 295 OS_EXIT CRITICAL o 258 OSSemPost cceeceseeccessccesceceesceeencs 296 OSFlagACCEpt egener dees end 259 OSSemQUETY En 297 OSFlagCreate ces seacesgusisicinieatarcuncastenss 261 OSSetTickPerSec en 298 aa E ee 262 OSSIA aeae icin toe 298 E EE 263 OSStatlnit dees ie 299 OSElag POST suegieu ider gesid ENKEN 265 OSTaskChangePrio ssssseseseessseeen 299 OSFlagQuery csssesccsssssecscsssseeesesssseeees 266 OSTaskCreate cccessessccececeeseesensees 300 SC 267 OSTaskCreateE xt en 301 OSMboxAccept Aeddi denger 267 OSTaskCreateHOok nn 302 EE ENEE 268 OS TaskDel csissssvessssesseasssdeecessdetsesivasess 303 OSMboxDel sssssssssssssssssssssesssssssesesseee 269 OSTaskDelHook en 304 OSMboxPenid saena See 270 OSTaskDelReq en 305 OSMDOXPOSt cccccececececececececeeeeeeeeeees 271 OSTaskIdleHook en 306 OSMboxPostOpt onssas 272 OSTaskQuery cecceesessessceececeeeenseaees 306 OSM
128. 232 LIB EXAMPLE main echoes null terminated character strings int getOk char s 16 serAopen 19200 loopinit while 1 loophead costate wid getOk cof _serAgets s 15 20 if getOk wid cof _serAputs s else timed out s null terminated but incomplete serAclose j 32 rabbit com Dynamic C Functions cof serxXputc void cof serXputc int c where X is A F DESCRIPTION This single user cofunction writes a character to serial port X yielding to other tasks when the input buffer is locked This function is non reentrant The functions cof_serEputc and cof _serFputc may be used with the Rabbit 3000 or Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is cof_serXputc int port where port is one of the macros SER_PORT A through SER_PORT E PARAMETERS c Character to write LIBRARY RS232 LIB EXAMPLE echoes characters main mee serAopen 19200 Loopimir while 1 loophead wee COE secret wid cof serAputc c serAclose Dynamic C Functions rabbit com 33 cof serXputs void cof serXputs char str where X is A F DESCRIPTION This single user cofunction writes a null terminated string to port X It yields to other tasks
129. 39 KR D RE 540 X Xa llO arsane ae e A E SEET 541 KAO stats sisisi inie ENEE ENEE AEN EZE 543 Ehe EEN 544 XCalculateECC256 csiis ccc cccecececececececeeseeeeees 546 XChkCorrectECC256 ccccccccsesssscccsesesseceeeeeess 547 El TTT 548 ET 548 gelong eu Dead DEN EENS REENEN ENEE SEAN 549 KIMGMZGOOGE ing gue ag deene cease dense Caen EEN 550 XMEMZXMEM E 551 XMEMCHL E E E 552 Ee EE 553 HEEN 554 Xsetfloat EE 555 EE EE 555 XSCUODS sosisini REENEN ENEE ENEE 556 XS Cll EE A E 556 Dynamic C Functions rabbit com xiii xiv rabbit com Dynamic C Functions RABE Tete Group Listing of Dynamic C Functions New releases of Dynamic C often contain new API functions You can check if your version of Dynamic C contains a particular function by checking the Function Lookup feature in the Help menu If you see func tions described in this manual that you want but do not have please consider updating your version of Dynamic C To update Dynamic C go to www rabbit com products dc or call 1 530 757 8400 A TS MOD ee 203 EE egener 202 Arithmetic POUL NEE E 204 ADS ee 2 EE 204 EE A E E aauen 176 E 226 D B Data Encryption i f E sersssisieiisriieisiesens risens 4 Bit Manipulation AESdecryptStream4x4_CBC eceeeeeee 5 E 17 EE eege e E 16 Eege ie 7 LE 411 EEN eege g E ERE A E PA E E EE E 411 VNS S O AN ANA 9 S A K vat bsenctathupleuaieivesanbannavasnens 466 SEL a E eens 466 Direct Memory Access Rabbit 4000 5000
130. 520 rabbit com Dynamic C Functions tm rd int tm_rd struct tm t DESCRIPTION Reads the current system time from SEC_TIMER into the structure t WARNING The variable SEC_TIMER is initialized when a program is started If you change the Real Time Clock RTC this variable will not be updated until you restart a program and the tm_rd function will not return the time that the RTC has been reset to The read_rtc function will read the actual RTC and can be used if necessary PARAMETERS t Pointer to structure to store time and date struct tm char tm _ sec seconds 0 59 char tm min 0 59 char tm_hour 0 23 char tm_mday 1 31 char tm_mon 1 12 char tm_year 80 147 1980 2047 char tm wday 0 6 0 Sunday ts RETURN VALUE 0 Successful 1 Clock read failed LIBRARY RTCLOCK LIB SEE ALSO mktm mktime tm wr Dynamic C Functions rabbit com 521 tm wr int tm_wr struct tm t DESCRIPTION Sets the system time from a tm struct It is important to note that although tm_rd reads the SEC_TIMER variable not the RTC tm_wr writes to the RTC directly and SEC_TIMER is not changed until the program is restarted The reason for this is so that the DelaySec function continues to work correctly after setting the system time To make tm_rd match the new time written to the RTC without restarting the program the following should be done tm_wr tm SEC_TIMER mktime tm But
131. 6 EE Renee 117 fs set UK Sica ere vee eect eects 165 fat Truncate 2iccc cstecenessvcceccsteaedecnsnes 118 fs SEUD EE 166 fat_UnmountDevice ccccceccccceceeeeeeee 119 FS SYNC tee 168 fat_UnmountPartition cccccccceeeeee 120 A EEEE 159 Tat WI EENS AA 121 E E 171 fat XREAG eegene 122 123 POEM cece cwedsverencessvavacassnteacdsevavacedenveacesadss 170 Pat X Write E 124 EEN 174 I format cccccecccccccccseeesesseceeseeseeeenees 228 File System FS1 Eeer 126 File System Registry fcreate_UNUSEd eee eeeecceeececeeeceeeseees 128 registry_enumerate cccsesseeeeeeeees 395 FOCI ELE isc csaxscakecesssseccaseccanvensvccensecsicn canes 130 registry_finish_read csesseeeeeeees 398 E 146 registry_finish_write cssccsecesseeeasceseses 399 E E 148 EE CE ee 397 fread EE 150 registry_prep_read EE 400 fe Tomat eceesecsccececeessessensneeeeeeeens 153 registry_prep_write eeeeeesesseeeeeeees 403 LE 155 registry_read oo eee eeeeececeeeeeseeserteeeeeeeees 405 fs_reserve_blocks sisecsssndsccseiseaconseeans 157 registry_update tssgesbe eegene 406 e ee E E Ee E 157 E EE 158 Flash NAND fiell 169 nf_eraseBlock 245 fwrite 173 nf_getPageCount sssssssssssssessessresssseseeee 246 nf getPageSize Ze ee 247 File System FS2 nf initDevice ee 248 gel 125 nf _InitDriver oo cccceeeeccseeeeeeseeee 250 Eeer SE 127 nf_isBusyRBHW oseese 251 fcreate_unused s ss oosseseessoonesssessseeenne 129 n
132. 8 2404 0000 RETURN VALUE The null terminated string describe above LIBRARY ERRORS LIB 72 rabbit com Dynamic C Functions errlogGetMessage root char errlogGetMessage void DESCRIPTION Returns a null terminated string containing the 8 byte message in errLogEntry RETURN VALUE A null terminated string LIBRARY ERRORS LIB errlogReadHeader root int errlogReadHeader void DESCRIPTION Reads error log header into the structure errlogInfo RETURN VALUE 0 Success entry checksum OK 1 Failure entry checksum not OK LIBRARY ERRORS LIB Dynamic C Functions rabbit com 73 error message unsigned long error message int message index DESCRIPTION Returns a physical pointer to a descriptive string for an error code listed in errno lib The sample program Samples ErrorHandling error message test cillustrates the use of error _ message The error message strings are defined in errors lib PARAMETER message index Positive or negative value of error return code RETURN VALUE Physical address of string or zero if error code is not listed LIBRARY ERRORS LIB 74 rabbit com Dynamic C Functions exception int exception int errCode DESCRIPTION This function is called by Rabbit libraries when a runtime error occurs It puts information relevant to the runtime error on the stack and calls the default runtime error handler pointed to by the ERROR_EXIT macro T
133. 8 SE E EE 209 e ER RE E 210 HDLCabortP cccccccceccccceseeeeseeeeeseeeees 186 12C SUOW TK gue 211 HDLCCIOSCE cccccccccccceeeessssceeeeeceees 186 T 211 HDLCceloseF 0 ccccccccccceesesssseeeeeeceees 186 HDLCdropE ccccccccceceeeeessersneeeeeeeens 187 Interrupts HDLCdropF siejcciniecexsincessdvidcaviioebuass 187 GetVectExtern2000 cccccccccccccccccccccceee 180 HDLCerrorE 0 0 ccccccceceeeeessersceeeeeeeees 187 GetVectExtern3000 cccccceceesesececeeees 181 LE 187 GetVectIntern ccceccccesscecsseceesseees 182 HDLCextClockE tisacassatatessantavas araniead sis 188 IPTS EE 196 HDLCextClockF 0 cscssssssessseseseesens 188 EISE 197 HDLCopenE ssssacssnesesanansesereonsteasiiuaence 189 SetVectExtern2000 ccccccceeeeeeeeeees 473 HDLCopenF eneen 189 SetVectExtern3000 c ccssessecsesesseeeeseens 474 HDLCpeekE oo ccsceetssseessssseeteesees 190 SetVectExtern4000 ccccccceeeeeeeeeees 475 HDLCpeekE ees 190 SetVectinteri eege eeng 476 HDLCreceiveE ccccccccceessssseeceeeeeees 191 HDLCreceiveF 0 ccccccccceesesseseceeeeeees 191 L HDIECSENGE ies scccscacziavesossestwadsoseveessens 192 Logging Subsystem HDLCsendF ee 192 TN 214 HDLCsendingE e 193 NGG CLOSE EE 215 HDLCSendingF neen 193 E E 216 log format EE 217 l g MAP aserre rors i re E 218 UO 1G Met eCeE eeh een 219 Bi RP itl eege 18 EE 220 BitRdPortI sscdesotehict ae vaentioa caduceus 19 Jog E 221 BitWrPortE ed 20 PORN ee 22
134. 95 sqrt float sqrt float x DESCRIPTION Calculate the square root of x PARAMETERS x Value to compute RETURN VALUE The square root of x LIBRARY MATH LIB SEE ALSO exp pow powl0d srand void srand unsigned long seed DESCRIPTION Sets the seed value for the rand function PARAMETER seed This must be an odd number LIBRARY MATH LIB SEE ALSO rand randb randg 496 rabbit com Dynamic C Functions strcat NEAR SYNTAX char n strcat char dst char src FAR SYNTAX char far f strcat char far dst char far src Note By default strcat is defined to_n_strcat DESCRIPTION Concatenate string src to the end of dst For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with_f_strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR STRING macro is de fined and all pointers are near pointers append _n tothe functionname e g n_ strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS dst Pointer to location to
135. ALSO DMAstartAuto DMAstopDirect Dynamic C Functions rabbit com 65 DMAstop int DMAstop dma chan t handle DESCRIPTION Stop a DMA operation started with one of the DMAmem2ioe series functions DMAcompleted will return TRUE after for an operation stopped with this function but with less data length than the original request It is OK to stop an operation that has currently completed this has no effect DMAcompleted may be called to determine the actual amount of data transferred PARAMETER Handle for channel to stop RETURN VALUE 0 Success EINVAL Invalid handle LIBRARY DMA LIB SEE ALSO DMAcompleted DMAstopDirect 66 rabbit com Dynamic C Functions DMAstopDirect void DMAstopDirect int channel DESCRIPTION This function is defined to the following WrPortI DMHR NULL 1 lt lt channel Halt the corresponding DMA channel The DMA registers obtain the current state and the DMA can be restarted using the DMCSR PARAMETER channel DMA channel obtainable through DMAhandle2chan LIBRARY DMA LIB SEE ALSO DMAstartAuto DMAstartDirect DMAtimerSetup void DMAtimerSetup unsigned int divisor DESCRIPTION This function sets up the DMA 16 bit divisor To use the divisor the DMA_F_TIMER flag must be passed to the transfer function PARAMETER divisor 16 bit divisor for the DMA timer LIBRARY DMA LIB SEE ALSO DMAmem2mem DMAmatchSetup Dynamic C Functions rabbit
136. AMETERS x Number to round up RETURN VALUE The rounded up number LIBRARY MATH LIB SEE ALSO floor fmod 24 rabbit com Dynamic C Functions chkHardReset int chkHardReset void DESCRIPTION This function determines whether this restart of the board is due to a hardware reset Asserting the RESET line or recycling power are both considered hardware resets A watchdog timeout is not a hardware reset RETURN VALUE 1 The processor was restarted due to a hardware reset 0 Ifit was not LIBRARY SYS LIB SEE ALSO chkSoftReset chkWDTO _sysIsSoftReset chkSoftReset int chkSoftReset void DESCRIPTION This function determines whether this restart of the board is due to a software reset from Dy namic C or a call to forceSoftReset RETURN VALUE 1 The board was restarted due to a soft reset o If it was not LIBRARY SYS LIB SEE ALSO chkHardReset chkWDTO _sysIsSoftReset Dynamic C Functions rabbit com 25 chkWDTO int chkWDTO void DESCRIPTION This function determines whether this restart of the board is due to a watchdog timeout Note A watchdog timeout cannot be detected on a BL2000 or SmartStar RETURN VALUE 1 If the board was restarted due to a watchdog timeout 0 If it was not LIBRARY SYS LIB SEE ALSO chkHardReset chkSoftReset sysIsSoftReset 26 rabbit com Dynamic C Functions clockDoublerOn void clockDoublerOn void DESCRIPTION Enable
137. AR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where strfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR STRING macro is de fined and all pointers are near pointers append _n tothe function name e g D strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS sre Pointer to memory source ch Character to search for n Number of bytes to search RETURN VALUE Pointer to first occurrence of ch if found within n characters Otherwise returns null LIBRARY STRING LIB SEE ALSO Strnchr strstr Dynamic C Functions rabbit com 237 memcmp NEAR SYNTAX int no memcmp void sl void s2 size tn FAR SYNTAX int _f memcmp void far sl void far s2 size tn Note By default memcmp is defined to np memcmp DESCRIPTION Performs unsigned character by character comparison of two memory blocks of length n For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_ STRING will change all calls to functions in this li brary to
138. Array PARAMETERS addr Address offset in User block to write to sources Array of pointer to sources to copy data from numbytes Array of number of bytes to copy for each source The sum of the lengths in this array must not exceed 32767 bytes or an error will be returned numsources Number of data sources RETURN VALUE 0 Successful 1 Invalid address or range 2 No valid User block found block version 3 or later 3 Flash writing error The return values below are applicable only if SPI USE UCOS MUTEX is not defined ETIME Serial flash only time out waiting for SPI postive N Serial flash only SPI in use by device N LIBRARY IDBLOCK LIB 538 rabbit com Dynamic C Functions WrPortE void WrPortE unsigned int port char portshadow int data value DESCRIPTION Writes an external I O register with 8 bits and updates shadow for that register The variable names must be of the form port and port shadow for the most efficient operation A null pointer may be substituted if shadow support is not desired or needed PARAMETERS port Address of external data register portshadow Reference pointer to a variable shadowing the register data Substitute with null pointer or 0 if shadowing is not required data_value Value to be written to the data register LIBRARY SYSIO LIB SEE ALSO RdPortI BitRdPortI WrPortI BitWrPortI RdPortE BitRdPortE BitWrPortE Dynamic C Functions rabbit com 539 WrPortl v
139. BRARY I2C LIB SEE ALSO Technical Note 215 Using the I2C Bus with a Rabbit Microprocessor Dynamic C Functions rabbit com 211 kbhit int kbhit void DESCRIPTION Detects keystrokes in the Dynamic C Stdio window RETURN VALUE 0 if a key has been pressed 0 otherwise LIBRARY UTIL LIB labs long labs long x DESCRIPTION Computes the long integer absolute value of long integer x PARAMETERS x Number to compute RETURN VALUE x ifx 20 x otherwise LIBRARY MATH LIB SEE ALSO abs fabs 212 rabbit com Dynamic C Functions ldexp float ldexp float x int n DESCRIPTION Computes x 2 PARAMETERS x The value between 0 5 inclusive and 1 0 n An integer RETURN VALUE The result of x 2 LIBRARY MATH LIB SEE ALSO frexp exp log float log float x DESCRIPTION Computes the logarithm base e of real float value x PARAMETERS x Float value RETURN VALUE The function returns INF and signals a domain error when x lt 0 LIBRARY MATH LIB SEE ALSO exp logl0 Dynamic C Functions rabbit com 213 log clean int log clean LogDest ld DESCRIPTION Reset only the specified destination class and stream encoded as a LogDest value This is only applicable to filesystem or XMEM destinations since they are locally persistent storage XMEM is automatically cleaned at start up time since it is not assumed to be non volatile If thi
140. CompressedFile ceeseeseeeeees 257 l g CLEAN essri aans aesan EER ENS 214 OS_ENTER_CRITICAL ccc eececceeeeeeee ees 258 TEE 215 OS_EXIT_CRITICAL cececceeecceeeeeeeeeceee scene 258 US EE 216 OSFlag A eet eegenen 259 log format eege iis dasdsseestteie cavsvaiiena laces 217 OSFlagCreate c cccccecceessesecsececeeeeessesenaeees 261 TOS sap seed 218 OSFlas RE 262 TOS TEX edd HA dee te edd ged ege kA 219 OSFlagPend EEN 263 log OPeM sistant Ee SE e 220 OS Flao Postee aine See 265 log prev are eder aee E Ze vets dieses E 221 OSFlagQuery ssssssssssessessssesrserressssesrrereesesse 266 JEDEN ee 222 OS Tite eee e 267 TEE 223 OSMboxAccept ccecececececececeeeceeeceeeceeeeeeesees 267 lop IO intial ee eA 224 OSMboxCreate EEN 268 TOME Mp seke enr engen de ceavtiarzent tates 224 OSMboxDel ccccceceeeeessesseececeeseessnsnaeees 269 loophead sers caerra nien r EE E EE 225 SMboxPend ENER 270 COTES Ei oti ove Ao 523 dade seda eae caddeedsnasatandsbesseaeaetaieaes 225 OSMDbOxXPOSt c sccececeeeeeesesscececeeeeeseesenaeees 271 ISG E Ee 226 OSMbos Poet 272 Wai Geesse leese 226 OSMDOXQUETY ccecececececececeeeceeeceeeceeeseeeeees 273 M tte 227 OSMemCreate EEN 274 I Tomat 228 OSMemGet ssssssssesssesssesssessersseesserssersserssers 275 O SMemPut geet ges p a Ra 276 M OSMemQuery cccccccececececececececeseceeeeeeeeeees 277 mbr_CreatePartition 229 OSMutex Accept Een 278 e EENEG 230 OSMutexCreate sssssssesss
141. CreceivexX int HDLCreceiveX char rx buffer int length Where X is E or F DESCRIPTION Copies a received packet into rx_ buf fer if there is one Packets are received in the order they arrive even if multiple packets are currently stored in buffers This function is intended for use with the Rabbit 3000 and Rabbit 4000 PARAMETERS rx buffer Pointer to the buffer to copy a received packet into length Size of the buffer pointed to by rx_buffer RETURN VALUE 20 Size of received packet 1 No packets are available to receive 2 The buffer is not large enough for the received packet In this case the packet remains in the receive buffer LIBRARY HDLC PACKET LIB Dynamic C Functions rabbit com 191 HDLCsendxX int HDLCsendx char tx buffer int length Where X is E or F DESCRIPTION Transmits a packet out serial port E or F in HDLC mode The tx_buffer is read directly while transmitting therefore it cannot be altered until a subsequent call to HDLCsendingX re turns false indicating that the driver is done with it This function is intended for use with the Rabbit 3000 and Rabbit 4000 PARAMETERS tx buffer A pointer to the packet to be sent This buffer must not change while trans mitting see above length The size of the buffer in bytes RETURN VALUE 1 Sending packet 0 Cannot send another packet is currently being transmitted LIBRARY HDLC PACKET LIB 192 rabbit com Dynami
142. DMA operation from external I O to memory PARAMETERS handle Handle for channel to use in transfer dest Memory destination address sre External I O location source address len Length to send cannot equal zero flags Various flag options DMA_F_REPEAT indicates that the transfer will be a cycle DMA _ F INTERRUPT indicates an interrupt will be triggered at the completion of the transfer The interrupt vector and function must be set up in the user s code DMA_F LAST SPECIAL only for Ethernet or HDLC peripherals Internal Source Status byte written to initial buffer descriptor before last data Internal Destination Last byte written to offset address for frame termi nation All Others no effect DMA_F_SRC_DEC only for transfers with memory source Indicates the source address should be decremented DMA_F DEST DEC only for transfers with memory destination Indi cates the destination address should be incremented DMA_F_STOP_MATCH indicates whether or not to stop the dma transfer when a character is reached The match byte and mask should have pre viously been set by calling the DMAmat chSetup function DMA_F_ TIMER indicates the DMA timer will be used The divisor should have already been set by calling the DMAt imerSetup func tion DMA_F_TIMER_1BPR indicates that the timed transfers will send one byte per request instead of the entire descriptor 50 rabbit com Dynamic C Functions DMAioe2mem cont d
143. DOXQUETY sscescccssssececcssseeescesssseees 273 OSTaskResume e scceceeeeeeeeensees 307 TT BALE EE 274 OSTaskStatHook sccececeeeeesentees 307 OSMemGeEt sirriciikrecnirriiiiinriciiinenis 275 OSTaskStkChk En 308 OSMemPut sissen die E 276 OSTaskSuspend En 309 OSMemOQuery san 277 OSTaskSwHook eiosrugre ec eessen 310 OSMutexAccept ssscccccssssssccsssseeccsssseeees 278 OSTCBInitHook ccssscccsccasescnnsascccens 310 e EEN 279 OS Time Dy cereis eas 311 OSMutexDel EE 280 OSTimeDIYHMSM s ssssessseessesieen 312 OSMutexPend cccccccccceceeeceeeeeeeeees 281 OSTimeDlyResume seeesesssees 313 OSMutexPost ccccccccccccceceeeceeeeeeeeees 282 OSTimeDlySec een 314 OSMutexQuery nossos 283 ADS TL vases aatnsactateastecsese caniieisee 315 DEER 284 OSTimeSet srren serenon he 315 OSQCreate cccccccccccccccccecceeeeeeeeeeeeees 285 OSTimeTick enen 316 SE 287 OSTimeTiCKHOOK nn 316 EG 288 OS Nieren a sssivacoscsassceveacveeoaseadscessacacacs 317 Dynamic C Functions rabbit com xxi Miscellaneous mbr_UnmountPartition oo 233 hekstrtobyt sisirin 193 mbr_ValidatePartitions ccscee 234 NOU My eege 224 Pulse Width Modulation Rabbit 3000 AGEL Aere 386 4000 5000 EU ach get sneen 415 E O 368 Cen 471 er eee 369 Multitasking Q COBESIN se E ieee 29 Ee eege 38 Quadrature Decoder Rabbit 3000 4000 okeset desiere 38 5000 CORRE EE 39 RE E 383 DelayMs w ccccccccsssssesesesesesese
144. DWIFILCE E 463 SerCdatabits ccecessessecececeesesseesees 448 SCPDWIILE dressieira 464 SET HSH sscse ccaveccsessuncaterevecersveredes 449 SPD WrU sed 3 sivacecccscesssesvencagesteseatens cede 465 SCrCdMaOn isesiiiisrissisiesresiiirerenis trenis 450 SEFECIOSE opier etinege Kierf tensta eiert ie 448 serCflowcontrolONn c cccceceeeeeeeesees 452 SerEdatabits ccccesessessecececeesesseesees 448 SETO RIG Venedeg 453 s rEdmaOff enge 449 SOP COLE CIOL tege 454 GE 450 serCheckParity a scacesvansvaeciniconecesdnreontas 447 serEflowcontrolOff ccsesscccessecees 451 Ser C Open ee EE eee 455 serEflowcontrolOn 452 SECC PALILY vases toannanteacnnasnumepeansdacnsgengeeed 456 SEE OGIO eer 453 GOL OCIS Eege 457 REESEN eegen geeegigeg 454 SECC PUG sirosti siiniga aasi 458 REENEN ege ege eessen 455 EE 459 Ser Epari y E 456 serCrdFlush E 460 BERG E R 457 SertCrdfiree EEN 460 SOPH PUIG areiseisecteedeseread vase sien deeg geng 458 s rCrdUsed E 461 BEER 459 S rC redd icsssessgucedesavessqassnieaterevecesavasece 462 Serbrgdblueb s scsacesscsvessssssvaeasaeadeseasesieese 460 serCwrFlush geed esteieg 463 SEENEN 460 Dynamic C Functions rabbit com XXV serErdUsed cccceceeeceeseeeseeeseeeseeeseeees 461 e104 00 e lt n eee ee 460 Ser bread si iseiicisviaihersdvsectasavciarssevsenasys 462 SErXIdUSEO EE 461 serEwrFlush 000 cecccececeessesececeeeeeeeenens 463 serXread scssesscssecscssesssssconensccsssssessses 462 S
145. Dynamic C Functions sdspi isWriting int sdspi isWriting sd device dev DESCRIPTION Returns 1 if the SD card is busy writing a sector PARAMETER dev Pointer to initialized sd_device structure for the flash chip RETURN VALUE 1 Busy 0 Ready not currently writing LIBRARY SDFLASH LIB sdspi notbusy int sdspi notbusy int port DESCRIPTION This function tests for a busy status from the SD card on the port given It is assumed that the card is already enabled PARAMETER port The base address for the SD card s SPI port RETURN VALUE 1 The card is not busy write erase has ended 0 The card is busy write erase in progress LIBRARY SDFLASH LIB Dynamic C Functions rabbit com 421 sdspi print dev void sdspi print dev sd device dev DESCRIPTION Prints parameters from the SD device structure PARAMETER dev Pointer to sd_ device structure of the SD card LIBRARY SDFLASH LIB 422 rabbit com Dynamic C Functions sdspi process command int sdspi process command sd device sd SD CMD REPLY cmd reply int mode DESCRIPTION This function sends the command placed in the cmd_ rep1y structure and retrieves a reply and data optional as defined in the cmd_rep1y structure Pointers to TX and RX buffers are re trieved from the cmd_rep1y structure and used for command transmission and reply data re ception Reply is parsed and placed in cmd_reply reply Errors encountered will give a negativ
146. EE EE 375 SASp print EE 422 pxfree_fast ccsessenscccceceessessensccecececseeseens 376 DEE 423 E arere EE E 377 GE 424 EE E E 378 ENEE 425 PREX EE 379 sdspi_sendingAP Ee 426 IL E 380 sdspi_set_block_length c cssccssssssssssceesseeeeeees 427 PXPTEV vererien rE R EEEE 381 e a eas tsecpacdeaasie eed stssastace 426 PRPTCV EE 382 sdspi_write_SeCtOF c cssesesessssessesteeesveeseeseeeees 429 Q sdspi_WriteContinue eesssessssssssssseseseseeeeses 428 SEFACIOSE siceecciiwacertiececeesececcdsetseseponndenceatins 448 G0 C1POR cede casvassensceetastaversashtere tei averdencsceedas 383 serAdatabits EE 448 GOAN TE 384 SETAGMAOLE EE 449 oa E e E EES 385 SErAdMma OMi EEN sonis 450 Eege ee 385 serAflowcontrolOff sssesscceceeeeeeessenenaeees 451 SEN ik ue 386 serAflowcontrolOn ssssessececeeeeeseesesteaeees 452 SETA BCIC gege eege deet EEN ee Edge EEN 453 R SrA PCUBITOL es ESN ZENNER SEENEN ege 454 E tee eebe 387 EE 455 Tand pisent aa 387 Ee 456 TANAD ene dieegAssg et Sege SES aaria 388 Ee oe LE vevedcsseeusdevevasarcis does cavdvided ede NESEY 388 SELAPUIC ssseeseesserscessseverscssceerenssneseaseneseseness RPE nananana 389 SELAPULS EENS 459 EE 390 Eeer SC TOA TC sic sosecescsegeas EEN DEET EES EEN 392 SE read E EES 392 SerArdU sed wisice sens scesdecetdes ease ZS ENSCH EEN 461 ReadCompressedFile s ssssscssssssesscseeseeeeeees 391 E e EE 462 D rabbit com Dynamic C Functions SETA WIFIUSH sivecexecsdseeesessada
147. EEXIST the device has already been enumerated EBUSY the device is busy nonblocking mode only LIBRARY FAT LIB SEE ALSO fat AutoMount fat Init fat EnumPartition 86 rabbit com Dynamic C Functions fat EnumPartition int fat EnumPartition mbr dev dev int pnum fat part part DESCRIPTION This routine is called to enumerate a partition on the given device The partition information will be put into the FAT partition structure pointed to by part The partition pointer will be linked to the device structure registered with the write back cache and will then be active The partition must be of a valid FAT type This function is called by fat_AutoMount and fat _Init PARAMETERS dev Pointer to an MBR device structure pnum Partition number to link and enumerate part Pointer to an FAT partition structure to be filled in RETURN VALUE 0 success EIO error trying to read the device or structure EINVAL partition number is invalid EUNFORMAT the device is accessible but not formatted EBADPART the partition is not a FAT partition EEXIST the partition has already been enumerated EUNFLUSHABLE there are no flushable sectors in the write back cache EBUSY the device is busy Only if non blocking LIBRARY FAT LIB SEE ALSO fat _EnumDevice fat _FormatPartition fat _MountPartition Dynamic C Functions rabbit com 87 fat FileSize int fat FileSize FATfile file unsigned long
148. ESCRIPTION Splits x into a fraction and exponent f 2 PARAMETERS x Number to split n An integer RETURN VALUE The function returns the exponent in the integer n and the fraction between 0 5 inclusive and 1 0 LIBRARY MATH LIB SEE ALSO exp ldexp 152 rabbit com Dynamic C Functions fs format FS1 int fs format long reserveblocks int num blocks unsigned long wearlevel DESCRIPTION Initializes the internal data structures and file system All blocks in the file system are erased PARAMETERS reserveblocks Starting address of the flash file system When FS_FLASH is defined this value should be 0 or a multiple of the block size When FS_RAM is defined this parameter is ignored num blocks The number of blocks to allocate for the file system With a default block size of 4096 bytes and a 256K flash memory this value might be 64 wearlevel This value should be 1 on a new flash memory and some higher value on an unformatted used flash memory If you are reformatting a flash memory you can set wearlevel to 0 to keep the old wear leveling RETURN VALUE 0 Success 1 Failure LIBRARY FILESYSTEM LIB EXAMPLE This program can be found in samples filesystem format CG define FS FLASH use filesystem lib define RESERVE 0 define BLOCKS 64 define WEAR 1 main i1 fs_format RESERVE BLOCKS WEAR printf error formatting flash n Prelee 4 printf flash successfu
149. For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS dst Block of memory to set chr Character that will be written to memory n Amount of bytes to set RETURN VALUE dst Pointer to block of memory LIBRARY STRING LIB Dynamic C Functions rabbit com 241 mktime unsigned long mktime struct tm timeptr DESCRIPTION Converts the contents of structure pointed to by timeptr into seconds struct tm char tm_sec seconds 0 59 char tm_min 0 59 char tm_hour 0 23 char tm_mday 1 31 char tm_mon 1 12 char tm_year 80 147 1980 2047 char tm wday 0 6 0 sunday Ka PARAMETERS timeptr Pointer to tm structure RETURN VALUE Time in seconds since January 1 1980 LIBRARY RTCLOCK LIB SEE ALSO mktm tm_rd tm_wr 242 rabbit com Dynamic C Functions mktm unsigned int mktm struct tm timeptr unsigned long time DESCRIPTION Converts the seconds t ime to date and time and fills in the fields of the tm structure with the result struct tm char char char char char char char Za PARAMETERS timeptr time RETURN VALUE 0 LIBRARY RTCLOCK LIB SEE ALSO tm_sec seconds 0 59 tm_min 0 59 tm_hour 0 23 tm_mday 1 31 tm_mon 1 12 tm_year 80 147 1980 2047 tm_wday 0 6 O0 sunday Address to store date and time into structure Seconds since January 1 1980
150. Functions pxnext long pxnext Pool t p long e DESCRIPTION Get the next allocated element in an xmem pool The pool MUST be set to being a linked pool using pool _link p lt non zero gt otherwise the results are undefined You can easily iterate through all of the allocated elements of a root pool using the following construct long e Pool t p for e pxfirst p e e pxnext p e PARAMETERS p Pool handle structure as previously passed to pool_xinit e Previous element address obtained by e g pxfirst This must be an allocated element in the given pool otherwise the results are undefined Be careful when iterating through a list and deleting elements using pxfree once the element is deleted is is no longer valid to pass its address to this function If this parameter is zero then the result is the same as pxfirst This ensures the invariant pxnext p pxprev p eil e RETURN VALUE 0 There are no more elements 0 Pointer to the next allocated element LIBRARY POOL LIB SEE ALSO pool xinit pool link pxalloc pxfree pxfirst pxprev Dynamic C Functions rabbit com 379 pxnext fast xmem long pxnext fast Pool t p long e DESCRIPTION Get the next allocated element in an xmem pool The pool MUST be set to being a linked pool using pool _link p lt non zero gt otherwise the results are undefined This is an assembler only version of pxnext Do not
151. G INVALID PGRP null pointer passed e OS ERR EVENT TYPE Not pointing to an event flag group e OS FLAG INVALID OPT Invalid option specified RETURN VALUE The new value of the event flags bits that are still set LIBRARY OS FLAG C Prior to DC 8 UCOS2 LIB Dynamic C Functions rabbit com 265 OSFlagQuery OS FLAGS OSFlagQuery OS FLAG GRP pgrp INT8U err DESCRIPTION This function is used to check the value of the event flag group PARAMETERS pgrp Pointer to the desired event flag group err Pointer to an error code returned to the called e OS NO ERR The call was successful e OS FLAG INVALID PGRP null pointer passed e OS ERR EVENT TYPE Not pointing to an event flag group RETURN VALUE The current value of the event flag group LIBRARY OS FLAG C Prior to DC 8 UCOS2 LIB 266 rabbit com Dynamic C Functions OSInit void OSInit void DESCRIPTION Initializes uC OS II data must be called before any other uC OS II functions are called LIBRARY UCOS2 LIB SEE ALSO OSTaskCreate OSTaskCreateExt OSStart OSMboxAccept void OSMboxAccept OS EVENT pevent DESCRIPTION Checks the mailbox to see if a message is available Unlike OSMboxPend OSMboxAccept does not suspend the calling task if a message is not available PARAMETERS pevent Pointer to the mailbox s event control block RETURN VALUE l void 0 This is the message in the mailbox if one is available The mailbox
152. GOPTION EOL option Caution If this pointer is NULL then the entire section is deleted Each element in this array is as follows typedef struct char far key Entry key Must not contain or newlines and must not start with Must be null terminated void far value Entry value Type determined by options If the REGOPTION_STRING option is set this must not contain newlines and must be null terminated int options Entry options and flags If value is greater than zero then value is an arbitrary binary value with the specified length It will be stored in the registry with twice that many ascii hex digits If value is lt 10 then it i ascii string with max length of options 8 Otherwise this field is a simple enumeration indicating the data type as follows define REGOPTION EOL D End of list define REGOPTION SHORT 1 Signed short 2 byte stored as decimal define REGOPTION LONG 2 Signed long 4 byte tored as decimal define REGOPTION BOOL 3 int 2 byte stored as 1 if non zero or 0 define REGOPTION FLOAT 4 IEEE float 4 byte Only avail if STDIO_DISABLE_FLOATS not defined stored in f format 5 1 2 3 4 define REGOPTION_RESV5 define REGOPTION_RESV6 define REGOPTION DELETE 6 7 Delete this entry if found define REGOPTION_NOP 8 No operation convenience for constructingRegistryEntry lis
153. HIVE This tells you when the file was last modified e FATATTR LONG NAME This is a FAT32 or long file name It is not supported PARAMETERS file Handle to the open file RETURN VALUE Attributes on success EINVAL invalid file handle LIBRARY FAT LIB SEE ALSO fat Open fat Status 92 rabbit com Dynamic C Functions fat GetName int fat GetName fat _dirent entry char buf word flags DESCRIPTION Translates the file or directory name in the fat_dirent structure into a printable name FAT file names are stored in a strict fixed field format in the fat_dirent structure returned from fat Status for example This format is not always suitable for printing so this function should be used to convert the name to a printable null terminated string PARAMETERS entry but flags RETURN VALUE 0 success Pointer to a directory entry obtained by fat_Status Pointer to a char array that will be filled in This array must be at least 13 characters long May be one of the following e 0 standard format e g AUTOEXEC BAT or XYZ GIF s FAT LOWERCASE standard format but make lower case EINVAL invalid NULL parameter s LIBRARY FAT LIB SEE ALSO fat ReadDir fat Status Dynamic C Functions rabbit com 93 fat GetPartition int fat GetPartition fat part part char file char fullpath DESCRIPTION Split a full pathname e g a filename txt i
154. ION Disables serial port X The functions pktEclose andpktFclose may be used with the Rabbit 3000 and Rabbit 4000 LIBRARY PACKET LIB pktXgetErrors char pktXgetErrors void X is A F DESCRIPTION Gets a bit field with flags set for any errors that occurred on port X These flags are then cleared so that a particular error will only cause the flag to be set once The functions pktEgetErrors and pktFgetErrors may be used with the Rabbit 3000 and Rabbit 4000 RETURN VALUE A bit field with flags for various errors The errors along with their bit masks are as follows PKT BUFFEROVERFLOW 0x01 DEI RXOVERRUN 0x02 PKT_PARITYERROR 0x04 PKT_NOBUFFER 0x08 LIBRARY PACKET LIB 332 rabbit com Dynamic C Functions pktXinitBuffers int pktXinitBuffers int buf count int buf size X is A F DESCRIPTION Allocates extended memory for channel X receive buffers This function should not be called more than once in a program The total memory allocated is buf_count buf_size 2 bytes The functions pktEinitBuffers and pktFinitBuffers may be used with the Rabbit 3000 and Rabbit 4000 PARAMETERS buf count The number of buffers to allocate Each buffer can store one received pack et Increasing this number allows for more pending packets and a larger la tency time before packets must be processed by the user s program buf size The number of bytes each buffer can accommodate This should be set to
155. If you specify 0 however your task will wait forever at the specified mutex or until the resource becomes available Pointer to where an error message will be deposited Possible error mes sages are os os os os os NO_ERR The call was successful and your task owns the mutex TIMEOUT The mutex was not available within the specified time ERR_EVENT_TYPE If you didn t pass a pointer to a mutex ERR_PEVENT_NULL pevent is a null pointer ERR_PEND_ISR If you called this function from an ISR and the re sult would lead to a suspension Dynamic C Functions rabbit com 281 OSMutexPost INT8U OSMutexPost OS EVENT pevent DESCRIPTION This function signals a mutual exclusion semaphore PARAMETERS pevent Pointer to mutex s event control block RETURN VALUE OS NO ERR The call was successful and the mutex was signaled OS ERR EVENT TYPE If you didn t pass a pointer to a mutex OS ERR PEVENT NULL pevent is a null pointer OS ERR POST ISR Attempted to post from an ISR invalid for mutexes OS_ERR_NOT MUTEX OWNER The task that did the post is NOT the owner of the MUTEX LIBRARY OS _MUTEX C 282 rabbit com Dynamic C Functions OSMutexQuery INT8U OSMutexQuery OS EVENT pevent OS MUTEX DATA pdata DESCRIPTION This function obtains information about a mutex PARAMETERS pevent Pointer to the event control block associated with the desired mutex pdata Pointer to a structure that will c
156. LIBRARY LZSS LIB CloseOutputCompressedFile void CloseOutputCompressedFile ZFILE ifp DESCRIPTION Close an output compression file This file is an FS2 ZF ILE which was previously opened with OpenOutput CompressionFile This function should always be called when done writing to a compression output ZF ILE to free up the associated output buffer PARAMETERS ifp File descriptor of an output compression ZFILE RETURN VALUE None LIBRARY lzss lib 28 rabbit com Dynamic C Functions CoBegin void CoBegin CoData p DESCRIPTION Initialize a costatement structure so the costatement will be executed next time it is encountered PARAMETERS p Address of costatement LIBRARY COSTATE LIB cof pktXreceive int cof pktXreceive void buffer int buffer size X is A F DESCRIPTION Receives an incoming packet This function returns after a complete packet has been read into the buffer The functions cof_pktEreceive and cof_pktFreceive are available when us ing the Rabbit 3000 or Rabbit 4000 PARAMETERS buffer A buffer for the packet to be written into buffer size Length of the buffer RETURN VALUE gt 0 The number of bytes in the received packet on success 0 No new packets have been received 1 The packet is too large for the given buffer 2 Aneeded test_packet function is not defined LIBRARY PACKET LIB Dynamic C Functions rabbit com 29 cof pktxXsend void cof pk
157. M the file is locked ENOENT the file directory does not exist EFSTATE file is in inappropriate state Only if non blocking LIBRARY FAT LIB SEE ALSO fat Open fat Write fat Seek 106 rabbit com Dynamic C Functions fat ReadDir int fat ReadDir FATfile dir fat _dirent entry int mode DESCRIPTION Reads the next entry of the desired type from the given directory filling in the entry structure PARAMETERS dir entry mode Pointer to the handle for the directory being read Pointer to the handle to the entry structure to fill in 0 next active file or directory entry including read only no hidden sys label deleted or empty A nonzero value sets the selection based on the following attributes e FATATTR_READ_ ONLY include read only entries e FATATTR_HIDDEN include hidden entries e FATATTR_SYSTEM include system entries e FATATTR_VOLUME_ID include label entries e FATATTR_DIRECTORY include directory entries e FATATTR_ARCHIVE include modified entries s FAT FIL RD ONLY filter on read only attribute e FAT FIL HIDDEN filter on hidden attribute s FAT FIL SYSTEM filter on system attribute e FAT FIL LABEL filter on label attribute e FAT FIL DIR filter on directory attribute s FAT FIL ARCHIVE filter on modified attribute The FAT_INC_ flags default to FAT _INC_ ACTIVE if none set s FAT _INC_DELETED include deleted entries s FAT _INC_EMPTY include empty entries
158. NT8U wait type INT8U err DESCRIPTION This function is called to check the status of a combination of bits to be set or cleared in an event flag group Your application can check for ANY bit to be set cleared or ALL bits to be set cleared This call does not block if the desired flags are not present PARAMETERS pgrp Pointer to the desired event flag group flags Bit pattern indicating which bit s i e flags you wish to check E g if your application wants to wait for bits 0 and 1 then f 1ags should be 0x03 wait type Specifies whether you are checking for ALL bits to be set cleared or ANY of the bits to be set cleared You can specify the following argument OS FLAG WAIT CLR ALL You will check ALL bits in flags to be clear 0 OS FLAG WAIT CLR ANY You will check ANY bit in flags to be clear 0 OS FLAG WAIT SET ALL You will check ALL bits in flags to be set 1 OS FLAG WAIT SET ANY You will check ANY bit in flags to be set 1 Note Add OS_ FLAG CONSUME if you want the event flag to be consumed by the call Example to wait for any flag in a group AND then clear the flags that are present set the wait _ type parameter to OS FLAG WAIT SET ANY OS FLAG CONSUME Dynamic C Functions rabbit com 259 OSFlagAccept cont d err Pointer to an error code Possible values are e OS_NO_ERR No error e OS_ERR_EVENT_TYPE Not pointing to an event flag group e OS_FLAG_ERR_WAIT_TYPE Proper wa
159. OLE WIETCE 5535452 siaii tenaa 5440 dnndeses ee 463 serXwrFlush ccceceeeeeeseeeseeeseeeeeeens 463 serEwrite cccccccccccccecsssesseececeeeeeeeenses 464 serXwrFree oo ceceecccccceceesessnsececeeeeeeeenes 463 SerE WU Sed WEE 465 BEE ee 464 Ser Foseid eniai 448 serXwrUsed eesesseessesseesseereressesererreerss 465 serFdatabits ccccceesessesecececeeeeeenees 448 serFdma Off cccccesssssesnccsecscsssensenes 449 Seral Packet Driver serFdmaOn sessessseeesessssssooreresssseserreerse 450 OTL a aees prrasceznnenstageitaiae 29 BE EE TEEN 45 cof_pktAsend oo csciscantsetesascgiesssbanctennetsenns 30 Se EE EE 452 cof_pktBreceive eeh 29 ROT CCUG eege 453 Ar EASE saraet arangie aaaea w Be eege 454 OT APRA o i eT UPC teren 455 DEE Se ser Fparity tee 456 FREE RET POE eege 457 EE eege a REES eege 458 OT TEI COPING eege eg Steng sen sasvesenasadenaeda shaves sarisunsssesontess 459 Seege ge serFrdFlush oo cececeesessssececeeeeeeeenees 460 ea a a 29 S rFrdFre eege EEN NENNdNeERedieegerd 460 COP DIVES eseu 30 getFrdUSCd ooooooooooooooooooccooocccec 461 PKA CIOSG Age 332 d HE 462 PELA EE ee 332 SELF WIFIUSH s ssc0sccccessessessceidescesiesasvsenee 463 EE 333 serFwrFree c cccccesessssseenesccscsssessses 463 Eeer 334 SOPH WHILE o orrs nt a E Ea 464 Ee 336 V sed 465 pktAsend ege 337 SerXdatabits ccccessssssscececeeeeseeees 448 i 338 serXdmaOff cccccecccessessssecececeeeesenees 449 i 338 O EE 450 PRIBCIOSE gn
160. ON Get the first allocated element in a root pool The pool MUST be set to being a linked pool by using pool link p lt non zero gt Otherwise the results are undefined This is an assembler only version of pfirst Do not call this function from C REGISTERS Parameter in IX Trashes F DE Return value in HL carry flag EXAMPLE ld ix my_pool lcall pfirst fast jr c no_elems HL points to first element PARAMETERS P Pool handle structure as previously passed to pool_init Pass this in the IX register RETURN VALUE C flag set HL 0 There are no allocated elements C flag clear NC HL points to first element LIBRARY POOL LIB SEE ALSO pool_init pool_link pfirst pnext_fast 328 rabbit com Dynamic C Functions pfree void pfree Pool t p void e DESCRIPTION Free an element that was obtained via palloc Note if you free an element that was not allocated from this pool or was already free or was outside the pool then your application will crash You can detect most of these programming errors by defining the following symbols be fore use pool 1lib POOL_ DEBUG POOL VERBOSE PARAMETERS p Pool handle structure as previously passed to palloc e Element to free which was returned from palloc RETURN VALUE None LIBRARY POOL LIB SEE ALSO pool init palloc pcalloc phwm pavail Dynamic C Functions rabbit com 329 pfree fast xmem void pfree fast
161. OOL LIB SEE ALSO pool init pxalloc fast pavail fast pfree fast 376 rabbit com Dynamic C Functions pxlast long pxlast Pool t p DESCRIPTION Get the last allocated element in an xmem pool The pool MUST be set to being a linked pool using pool _link p lt non zero gt otherwise the results are undefined PARAMETERS p Pool handle structure as previously passed to pool_xinit RETURN VALUE 0 There are no allocated elements 0 Pointer to last i e youngest allocated element LIBRARY POOL LIB SEE ALSO pool xinit pool link pxalloc pxfree pxfirst Dynamic C Functions rabbit com 377 pxlast fast xmem long pxlast fast Pool t p DESCRIPTION Get the last allocated element in an xmem pool The pool MUST be set to being a linked pool using pool link p lt non zero gt otherwise the results are undefined This is an assembler only version of pxlast Do not call this function from C Registers Parameter in IX Trashes F HL Return value in BCDE carry flag Example ld ix my_pool lcall pxlast_ fast jr c no_elems BCDE points to last element PARAMETERS p Pool handle structure as previously passed to pool_xinit Pass this in IX register RETURN VALUE C flag set There are no more elements C flag clear NC BCDE points to last element LIBRARY POOL LIB SEE ALSO pool xinit pool link pxlast pxprev_ fast 378 rabbit com Dynamic C
162. Only one of the following flags if any should be set They indicate that the DMA transfer is gated using the named pin e DMA P PD2 DMA F PE2 DMA F PE6 DMA F PD3 DMA_F_PE3 DMA_F_PE7 The following flags indicate the polarity of the gating signal e DMA_F_ FALLING default DMA_F RISING DMA F_LOW DMA F HIGH RETURN VALUE 0 Success EINVAL Invalid handle EBUSY Resources are busy LIBRARY DMA LIB SEE ALSO DMAmem2mem DMAcompleted DMAstop Dynamic C Functions rabbit com 51 DMAio0i2mem int DMAioi2mem dma_chan t handle dma_addr_t dest unsigned int src unsigned int len unsigned int flags DESCRIPTION This function performs an immediate DMA operation from internal I O to memory PARAMETERS handle Handle for channel to use in transfer dest Memory destination address sre Internal I O location source address len Length to send cannot equal zero flags Various flag options See DMAioe2mem fora full list of flags and their descriptions RETURN VALUE 0 Success EINVAL Invalid handle EBUSY Resources are busy LIBRARY DMA LIB SEE ALSO DMAmem2mem DMAcompleted DMAstop 52 rabbit com Dynamic C Functions DMAloadBufDesc void DMAloadBufDesc int dmaChannel dma addr GC bufPtr DESCRIPTION This function loads the appropriate DMA Initial Address Registers for the requested DMA channel with the address provided PARAMETERS dmaChannel DMA channel number to load bufPtr Pointer to
163. PARAMETERS P Pool handle structure as previously passed to pool_xinit RETURN VALUE 0 No free elements are available 0 Physical xmem address of an element If the pool is not linked your application can use this element provided it does not write more than p gt elsize bytes to it this was the elsize parameter passed to pool _xinit If the pool is linked you can write up to p gt elsize 8 bytes to it Each element has 8 bytes of overhead when the pool is linked LIBRARY POOL LIB SEE ALSO pool xinit pxcalloc pxfree phwm pavail 370 rabbit com Dynamic C Functions pxalloc fast xmem long pxalloc fast Pool t p DESCRIPTION Return next available free element from the given pool Eventually your application should re turn this element to the pool using pxfree to avoid memory leaks This is an assembler only version of pxalloc Do not call this function from C pxalloc_fast does not perform any IPSET protection parameter validation or update the high water mark pxalloc_ fast is a root function The parameter must be passed in IX and the returned element address is in BCDE REGISTERS Parameter in IX Trashes AF HL Return value in BCDE carry flag EXAMPLE ld ix my_pool lcall pxalloc_ fast jr c no free BCDE points to element PARAMETERS p Pool handle structure as previously passed to pool_init Pass this in the IX register RETURN VALUE C flag set No free e
164. PGDR define SERVO ENABLE PORTSHADOW 0 PGDRShadow define SERVO ENABLE PIN 0 6 and optionally define SERVO ENABLE DDR_0 PGDDR define SERVO ENABLE DDRSHADOW 0 PGDDRShadow define SERVO ENABLE ACTIVEHIGH_0 This function is limited to toggling the output pin If enabling or disabling the servo motor re quires more complicated actions you can substitute your own function by defining define SERVO DISABLE 0 yyyy where yyyy is the name of your own function which is assumed to take no parameters and have no return value LIBRARY SERVO LIB SEE ALSO servo enable 0 Dynamic C Functions rabbit com 431 servo disable 1 void servo disable 1 void DESCRIPTION Disable drive to the second servo motor This function only works if an auxiliary control signal is connected to the motor driver The I O pin used for this function is specified by the macros define SERVO ENABLE PORT 1 PGDR define SERVO ENABLE PORTSHADOW 1 PGDRShadow define SERVO ENABLE PIN 1 7 and optionally define SERVO ENABLE DDR 1 PGDDR define SERVO ENABLE DDRSHADOW 1 PGDDRShadow define SERVO ENABLE ACTIVEHIGH 1 This function is limited to toggling the output pin If enabling or disabling the servo motor re quires more complicated actions you can substitute your own function by defining define SERVO DISABLE 1 yyyy where yyyy is the name of your own function which is assumed to take no parameters and have no return value LIBRARY
165. PI functions e You must run the FAT in blocking mode define FAT BLOCK e You must not call low level non API FAT or write back cache functions Only call FAT functions appended with fat_ and with public function descriptions PARAMETERS file Handle for the file being read buf Pointer to buffer where data is to be placed May be NULL in order to dis card data len Length of data to be read If this is zero then the return code will be 1 if not at EOF or 0 if at EOF 122 rabbit com Dynamic C Functions fat xRead cont d RETURN VALUE Number of bytes read on Success May be less than the requested amount in non blocking mode or if EOF was encountered EEOF stating position for read was at or beyond EOF EIO on device IO error EINVAL if file buf or len contain invalid values EPERM if the file is locked ENOENT if file directory does not exist EFSTATE if file in inappropriate state non blocking SEE ALSO fat Open fat Read fat Write fat _xWrite fat Seek Dynamic C Functions rabbit com 123 fat xWrite int fat _xWrite FATfile file long xbuf int len DESCRIPTION Writes characters into the file specified by the file pointer beginning at the current position in the file Characters will be copied from the xmem string pointed to by xbuf The len variable con trols how many characters will be written This can be more than one sector in length and the write function
166. RARY STDIO LIB SEE ALSO utoa itoa getchar char getchar void DESCRIPTION Busy waits for a character to be typed from the stdio window in Dynamic C The user should make sure only one process calls this function at a time RETURN VALUE A character typed in the Stdio window in Dynamic C LIBRARY STDIO LIB SEE ALSO gets putchar Dynamic C Functions rabbit com 175 get cpu frequency unsigned long get cpu frequency DESCRIPTION Returns the clock speed of the CPU as calculated by the BIOS adjusted for the clock doubler if it is enabled Due to the limited precision of the clock speed calculation the calculated and actual clock speeds may differ slightly RETURN VALUE The clock speed of the CPU in Hz LIBRARY sys lib getcre int getcrc char dataarray char count int accum JI DESCRIPTION Computes the Cyclic Redundancy Check CRC or check sum for count bytes maximum 255 of data in buffer Calls to get crc can be concatenated using accum to compute the CRC for a large buffer PARAMETERS dataarray Data buffer count Number of bytes Maximum is 255 accum Base CRC for the data array RETURN VALUE CRC value LIBRARY MATH LIB 176 rabbit com Dynamic C Functions getdivider19200 char getdivider19200 void DESCRIPTION This function returns a value that is used in baud rate calculations The correct value is returned regardless of the compile mode In separate I
167. RN VALUE Pointer to end null terminator of string in buf LIBRARY STDIO LIB SEE ALSO itoa utoa ltoa 194 rabbit com Dynamic C Functions IntervalMs int IntervalMs long ms DESCRIPTION Similar to DelayMs but provides a periodic delay based on the time from the previous call Intended for use with wait for PARAMETERS ms The number of milliseconds to wait RETURN VALUE 0 Not finished 1 Delay has expired LIBRARY COSTATE LIB IntervalSec int IntervalSec long sec DESCRIPTION Similar to De layMs but provides a periodic delay based on the time from the previous call Intended for use with wait for PARAMETERS sec The number of seconds to delay RETURN VALUE 0 Not finished 1 Delay has expired LIBRARY COSTATE LIB Dynamic C Functions rabbit com 195 IntervalTick int IntervalTick long tick DESCRIPTION Provides a periodic delay based on the time from the previous call Intended for use with waitfor A tick is 1 1024 seconds PARAMETERS tick The number of ticks to delay RETURN VALUE 0 Not finished 1 Delay has expired LIBRARY COSTATE LIB ipres void ipres void DESCRIPTION Dynamic C expands this call inline Restore previous interrupt priority by rotating the IP regis ter LIBRARY UTIL LIB SEE ALSO ipset 196 rabbit com Dynamic C Functions ipset void ipset int priority DESCRIPTION Dynamic C expands this call
168. RZI e HDLC MANCHESTER e HDLC _BIPHASE SPACE e HDLC _BIPHASE MARK buffers A pointer to the start of the extended memory block containing the receive buffers This block must be allocated beforehand by the user The size of the block should be of buffers size of buffer 4 buffer count The number of buffers in the block pointed to by buffer buffer size The capacity of each buffer in the block pointed to by buffer RETURN VALUE 1 Actual baud rate is within 5 of the requested baud rate 0 Otherwise LIBRARY HDLC PACKET LIB SEE ALSO SetSerialTATxRValues TAT1R_SetValue Dynamic C Functions rabbit com 189 HDLCpeekx int HDLCpeekx unsigned long bufptr int lenptr Where X is E or F DESCRIPTION Reports the location and size of the next available received packet if one is available This func tion can be used to efficiently inspect a received packet without actually copying it into a root memory buffer Once inspected the buffer can be received normally see HDLCreceivexX or dropped see HDLCdropxX This function is intended for use with the Rabbit 3000 and Rabbit 4000 PARAMETERS bufptr Pointer to location in xmem of the received packet lenptr Pointer to the size of the received packet RETURN VALUE 1 The pointers bufptr and lenptr have been set for the received packet 0 No received packets available LIBRARY HDLC PACKET LIB 190 rabbit com Dynamic C Functions HDL
169. SCRIPTION Read one or more table entries returning average max and min of all samples in the specified group starting at entry for nent samples PARAMETERS which Servo 0 or 1 entry First sample number nent Number of entries starting at entry data 12 Returned data 3 sets of 4 contiguous entries The first set data 0 data 3 contains the average the second set data 4 data 7 contains the maxi mum and the last set data 8 data 11 contains the minimum The ele ments of each set correspond with the table data the first element is the instantaneous error the second is the error integral the third is the error rate and the 4th is the PWM output These may be customized to have dif ferent meanings RETURN VALUE 0 OK 1 no such entry or entries LIBRARY SERVO LIB SEE ALSO servo_alloc_ table servo graph servo stats reset 442 rabbit com Dynamic C Functions servo Set _coeffs void servo set coeffs int which int prop int integral int diff DESCRIPTION Set the PID closed loop control coefficients The normal sign for all coefficients should be pos itive in order to implement a stable control loop See Technical Note 233 for details PARAMETERS which Servo 0 or 1 prop Proportional coefficient integral Integral reset coefficient diff Derivative rate coefficient LIBRARY SERVO LIB SEE ALSO servo _closedloop servo _openloop Dynamic C Functions rabbit com 443 servo Set pos
170. SCRIPTION Use putc to output n times the character c PARAMETERS c Character to output n Number of times to output putc Routine to output one character The function pointed to by putc should take a character argument RETURN VALUE The character in parameter c LIBRARY STDIO LIB SEE ALSO EE EE Dynamic C Functions rabbit com 317 outstr char outstr char string int putc DESCRIPTION Output the string pointed to by st ring via calls to putc putc should take a one character parameter PARAMETERS string String to output putc Routine to output one character The function pointed to by putc should take a character argument RETURN VALUE Pointer to null at end of string LIBRARY STDIO LIB SEE ALSO outchrs 318 rabbit com Dynamic C Functions paddr unsigned long paddr void pointer DESCRIPTION Converts a logical pointer into its physical address This function is compatible with both shared and separate I amp D space compile modes Use caution when converting a pointer in the xmem window i e in the range OxE000 to OXFFFF as this function will return the physical address based on the XPC on entry PARAMETERS pointer The pointer to convert RETURN VALUE The physical address of the pointer LIBRARY XMEM LIB SEE ALSO paddrDS paddrsSs Dynamic C Functions rabbit com 319 paddrDs unsigned long paddrDS void pointer DESCRIPTION Converts a Data Se
171. SERVO LIB SEE ALSO servo _enable 1 432 rabbit com Dynamic C Functions servo enable 0 void servo enable 0 void DESCRIPTION Enable drive to the first servo motor This function only works if an auxiliary control signal is connected to the motor driver The I O pin used for this function is specified by the macros define SERVO ENABLE PORT o PGDR define SERVO ENABLE PORTSHADOW D PGDRShadow define SERVO ENABLE PIN 0 6 and optionally define SERVO ENABLE DDR_0 PGDDR define SERVO ENABLE DDRSHADOW 0 PGDDRShadow define SERVO ENABLE ACTIVEHIGH_0 This function is limited to toggling the output pin high or low If enabling or disabling the servo motor requires more complicated actions you can substitute your own function by defining define SERVO ENABLE D xxxx where xxxx is the name of your own function which is assumed to take no parameters and have no return value LIBRARY SERVO LIB SEE ALSO servo disable 0 Dynamic C Functions rabbit com 433 servo enable 1 void servo enable 1 void DESCRIPTION Enable drive to the second servo motor This function only works if an auxiliary control signal is connected to the motor driver The I O pin used for this function is specified by the macros define SERVO ENABLE PORT 1 PGDR define SERVO ENABLE PORTSHADOW 1 PGDRShadow define SERVO ENABLE PIN 1 7 and optionally define SERVO ENABLE DDR_1 PGDDR define SERVO ENABLE DDRSHADOW_1 PGDDR
172. SO strnemp strempi strncmpi Dynamic C Functions rabbit com 499 strcmpi NEAR SYNTAX int n strempi char strl char str2 FAR SYNTAX int f strcempi char far strl char far str2 Note By default strcmpi is definedto pn strempi DESCRIPTION Performs case insensitive unsigned character by character comparison of two null terminated strings For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_STRING macro is de fined and all pointers are near pointers append n_ tothe function name e g n strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS str1 Pointer to string 1 str2 Pointer to string 2 RETURN VALUE lt 0 str1 is less than str2 because character in str1 is less than corresponding character in str2 or str1 is shorter than but otherwise identical to str2 0 str1 is identical to str2 gt 0 str1 is greater than str2 because character in str1 is greater than correspon
173. Shadow define SERVO ENABLE ACTIVEHIGH_1 This function is limited to toggling the output pin high or low If enabling or disabling the servo motor requires more complicated actions you can substitute your own function by defining define SERVO ENABLE 1 xxxx where xxxx is the name of your own function which is assumed to take no parameters and have no return value LIBRARY SERVO LIB SEE ALSO servo disable 1 434 rabbit com Dynamic C Functions servo gear void servo gear int count0O int countl int Slaven int slavel DESCRIPTION NOTE this function is currently not efficient enough for production use owing to use of long multiplication and division It is provided as an example of the use of callbacks from the ISR If two servos are in use couple or cross couple their positioning This only works if NUM_SERVOS is 2 and both servos are in closed loop mode There are four possible sub modes of operation which depend on the slave0 1 parameters slaved slave1 Operation Non gear mode neither servo is slaved This is the normal default mode Second servo is slaved from first servo For every count0 0 1 increments of the first servo s encoder the second servo will be moved countl increments First servo is slaved from second servo For every count1 1 0 increments of the second servo s encoder the first servo will be moved countO increments Both servos cross coupled Movement will
174. TION DOCUMENTATION YOU ON BEHALF OF YOURSELF OR AS AN AUTHORIZED REPRESENTATIVE ON BEHALF OF AN ENTITY AGREE TO ALL THE TERMS OF THIS END USER LICENSE AGREEMENT LICENSE REGARDING YOUR USE OF THE SOFTWARE IF YOU DO NOT AGREE WITH ALL OF THE TERMS OF THIS LICENSE DO NOT INSTALL COPY OR OTHERWISE USE THE SOFTWARE AND IMMEDI ATELY CONTACT RABBIT FOR RETURN OF THE SOFTWARE AND A REFUND OF THE PUR CHASE PRICE FOR THE SOFTWARE We are sorry about the formality of the language below which our lawyers tell us we need to include to protect our legal rights If You have any questions write or call Rabbit at 530 757 4616 2900 Spafford Street Davis California 95616 1 Definitions In addition to the definitions stated in the first paragraph of this document capitalized words used in this License shall have the following meanings 1 1 Qualified Applications means an application program developed using the Software and that links with the development libraries of the Software 1 1 1 Qualified Applications is amended to include application programs developed using the Sof tools WinIDE program for Rabbit processors available from Softools Inc 1 1 2 The MicroC OS II uC OS ID library and sample code and the Point to Point Protocol PPP library are not included in this amendment 1 1 3 Excluding the exceptions in 1 1 2 library and sample code provided with the Software may be modified for use with the Softools WinIDE program in Qual
175. TURN VALUE Pointer to a message or if a timeout occurs a null pointer LIBRARY OS_Q C Prior to DC 8 UCOS2 LIB SEE ALSO OSQAccept OSQCreate OSQFlush OSQPost OSQPostFront OSQQuery 288 rabbit com Dynamic C Functions OSQPost INT8U OSQPost OS EVENT pevent void msg DESCRIPTION Sends a message to the specified queue PARAMETERS pevent Pointer to message queue s event control block msg Pointer to the message to send A null pointer must not be sent RETURN VALUE OS MO ERR The call was successful and the message was sent Os Q FULL The queue cannot accept any more messages because it is full OS_ERR_EVENT TYPE Ifa pointer to a queue not passed OS ERR PEVENT NULL If pevent is a null pointer OS ERR POST NULL PTR If attempting to post to a null pointer LIBRARY OS OC Prior to DC 8 UCOS2 LIB SEE ALSO OSQAccept OSQCreate OSQFlush OSQPend OSQPostFront OSQQuery Dynamic C Functions rabbit com 289 OSQPostFront INT8U OSQPostFront OS EVENT pevent void msg DESCRIPTION Sends a message to the specified queue but unlike OSQPost the message is posted at the front instead of the end of the queue Using OSQPost Front allows priority messages to be sent PARAMETERS pevent Pointer to message queue s event control block msg Pointer to the message to send A null pointer must not be sent RETURN VALUE OS NO ERR The call was successful and the message was sent Os Q
176. USY the device is busy only if non blocking EFSTATE file is in inappropriate state only if non blocking LIBRARY FAT LIB SEE ALSO fat Open fat Read fat_xWrite fat Seek Dynamic C Functions rabbit com 121 fat xRead fat xRead FATfile file char far buf int len DESCRIPTION Given file buf and len this routine reads len characters from the specified file and places the characters into string buf Returns the number of characters actually read on success Characters will be read beginning at the current position of the file and the position pointer will be left pointing to the next byte to be read The file position can be manually set with the fat Seek function If the file contains less the len characters from the current position to the end of the file EOF then the transfer will stop at the EOF If already at the EOF EEOF is returned The len parameter must be positive limiting reads to 32767 bytes per call uC OS II USERS e The FAT API is not reentrant from multiple tasks To use the FAT from multiple uC OS II tasks put the following statement in your application define FAT _USE_UCOS MUTEX e Mutex timeouts or other mutex errors cause a run time error ERR_FAT_MUTEX_ERROR The default mutex timeout is 5 seconds and can be changed by define ing a different value for FAT MUTEX TIMEOUT SEC You MUST call fat_InitUCOSMutex after calling OSInit and before calling any other FAT A
177. WIUSEd REENEN 465 sySResetChain cccceeseesensecececeeseeesensnaenes 517 E NEE 466 OO N E 466 T set_cpu_power mode EEN 469 CAN EE 518 set32kHzDivider ENEE 467 HAND Siccccescenvectinesacussdecanstewessectavecanesenvsaeetates 519 SetClockKModulation en 468 TATIR SetValue ccecsscscssssssssssessesseeseeseeees 520 Em EE SC E EE 521 SetSerialTATXR VALUES En 472 ONE 522 GES Ee DEE EECH yf ele EE 523 et VectExtern3000 00000ccceeeeeeseeeeeeeeeeees oo 475 EE 523 SetVectIntern cccccccceceesssssecceceeeceeuseeseeees 476 U sf_getPageCoumt ceseesessecececeeeeeesentnaeees 478 sf_getPageSize eccccccssssssessscsseseesescsesseeeees 478 update Timers 2 isccsccessseccsscsencecesssarcesscavcccersoes 524 E sails ae cited ee AT9 Y8e32KHZOSC eene 524 useClockDivider ccccccceescececeeseeeeeeeeeeees 525 xii rabbit com Dynamic C Functions useClockDivider3000 ccececeseeceeeceseeceees 526 USEMaAINOSC see scccdssvavcesivesdcddsesszceseeesdeedoevess 527 HS ge Ee ee 527 V VdGetEree WO svsisesisadsdessssidesvesacecdassvacdevedsets 529 Kier L 530 VdR leaseWd ssicsssisvccssssseceveassevessveivcdcsssvees 531 KE E ss saacetesaa reves sansdiesderedeessbae ceseasseoeees 528 WwW Write Renee ee Ee E AER 534 WritePlash sivsccdccsisvdssavssssccesssvcaseseesieecseesves 532 WriteFlash2Array ENEE 533 WhiteUserBlock e okee NN deed NNN dE NNN 535 writeUserBlockArray c sccececeeeeessessnteeeees 537 Kee E 5
178. When running stand alone not talking to Dynamic C this function reads the header directly from the log buffer When in debug mode this function reads the header from the copy in flash When a Dynamic C cold boot takes place the header in RAM is zeroed out to initialize it but first its contents are copied to an address in the BIOS code before the BIOS in RAM is copied to flash This means that on the second cold boot the data structure in flash will be zeroed out The configuration of the log buffer may still be read and the log buffer entries are not affected Because the exception mechanism resets the processor by causing a watchdog time out the number of watchdog time outs reported by this functions is the number of actual WDTOs plus the number of exceptions RETURN VALUE A null terminated string containing the header information Status Byte 0 Exceptions 5 Index last exception 5 SW Resets 2 HW Resets 2 WD Timeouts 5 The string will contain Header checksum invalid if a checksum error occurs The meaning of the status byte is as follows bit 0 An error has occurred since deployment bit 1 The count of SW resets has rolled over bit 2 The count of HW resets has rolled over bit 3 The count of WDTOs has rolled over bit 4 The count of exceptions has rolled over bit 5 7 Not used The index of the last exception is the index from the start of the error log entries If this index does not equal the
179. a diancnenacieetncnemicns 332 P POEET eseu az 451 pktBgetErrors soi icsissnancdunsasacdpasderescanaciac 332 E PEET 452 pktBinitBuffers scccscceisitiversetcrcenssedecenade 333 SEEN OBIS usteet eseou 453 EE 24 SN SELB een 454 le 336 See 456 PIB SENG srice deacons 337 Get ORC eege 457 Eege SE Ee 458 Pere EAL eege oo SE eege 459 EE Leger 332 serXrdFlush 460 Eeer 332 xxvi rabbit com Dynamic C Functions PRICMINBUNIENS saseinsteasecesenscreareesceeriies 333 GE Ee srice 334 PRC CCI ee 336 PIU SOM Sirion ntedpaenretanencennieeetaten 337 pktCsending E 338 GE E 338 EIER tee 332 pktDgetErrors ss sssssssessssssessseeesseeesses 332 pktDinitBuffers jccccssncicesesnsncdssanecdeveaenes 333 GERT 334 GL 336 PRED SGI ET 337 pPktDsending siirsi icerisine 338 pktDsetParity e ssesssssessssesesssereessrssrs 338 PRECIOS E n eene E 332 pktEgetErrors scssiccsssssicesascesedevseesevesnezs 332 EE EE 333 PKEODEM E 334 GEES scorie 336 Gap E 337 PCE SONI S250 acdscessddssasumiedecbsutenctoutntivs 338 pktEsetParity ccsterieasersicoereeantes 338 PKRIFCIOSE cronos easi 332 E EE 332 pktFinitBuffers sesssesssseeeesseeeeseeesses 333 PREP OPC ege geed 334 pktFreceiv geet 336 Dib send eege 337 pktFsending esssesesssesssssseesseeessseesses 338 GE 338 Servo Control Rabbit 3000 4000 SPI Stdio servo_graph sicceccecctsssnaceneeuunses 437 SETVO E 438 servo_millirpm2vemd ssssssessseseseeeseee 438 ServOo move Io 439 servo_openloo
180. abbit 4000 5000 xv Number to String Conversion xxii Dynamic Memory Allocation xvi Partitions xxii ECC xvi Pulse Width Modulation Rabbit 3000 4000 5000 Error Handling xvi xxii Extended Memory xvii Quadrature Decoder Rabbit 3000 4000 5000 Fast Fourier Transforms xvii xxii File Compression xvii Rabbit 3000 4000 xxii File System FAT xvii Rabbit 3000 4000 5000 xxiii File System FS1 xviii Rabbit 4000 5000 xxiii File System FS2 xviii Real Time Clock XXiV File System Registry xviii Serial Communication xxiv Flash NAND xviii Serial Packet Driver xxvi Flash Parallel xviii Servo Control Rabbit 3000 4000 xxvii Flash SD xix SPI xxvii Flash Serial xix Stdio xxvii Floating Point Math xix String Manipulation xxvii Global Positioning System XX String to Number Conversion xxviii HDLC Protocol Rabbit 3000 4000 5000 XX System xxviii UO XX User Block xxviii 12C Protocol XX VBAT RAM Rabbit 4000 5000 xxviii Interrupts XX Watchdogs xxviii Chapter 1 Function Descriptions 1 Software License Agreement 557 Dynamic C Function Reference rabbit com iii rabbit com RABE Tete Alphabetical Listing of Dynamic C Functions New releases of Dynamic C often contain new API functions You can check if your version of Dynamic C contains a particular function by checking the Function Lookup feature in the Help menu If you see func tions described in this manual that you want but do not have please consider updating your version of
181. ait ing tasks RETURN VALUE OS NO ERR The call was successful and the message was sent Os Q FULL The queue is full cannot accept any more messages OS ERR EVENT TYPE A pointer to a queue was not passed OS ERR PEVENT NULL If pevent is a null pointer OS_ERR_POST NULL PTR Attempting to post a null pointer LIBRARY OS OC Prior to DC 8 UCOS2 LIB Dynamic C Functions rabbit com 291 OSQQuery INT8U OSQQuery OS EVENT pevent OS Q DATA pdata DESCRIPTION Obtains information about a message queue PARAMETERS pevent Pointer to message queue s event control block pdata Pointer to a data structure for message queue information RETURN VALUE OS NO ERR The call was successful and the message was sent OS ERR EVENT TYPE Attempting to obtain data from a non queue OS ERR PEVENT NULL f pevent is a null pointer LIBRARY OS OC Prior to DC 8 UCOS2 LIB SEE ALSO OSQAccept OSQCreate OSQFlush OSQPend OSQPost OSQPostFront 292 rabbit com Dynamic C Functions OSSchedLock void OSSchedLock void DESCRIPTION Prevents task rescheduling This allows an application to prevent context switches until it is ready for them There must be a matched call to OSSchedUnlock for every call to OSSchedLock LIBRARY UCOS2 LIB SEE ALSO OSSchedUnlock OSSchedUnlock void OSSchedUnlock void DESCRIPTION Allow task rescheduling There must be a matched call to OSSchedUnlock for every call to OSS
182. al lowable fixed point limits i e 8192 encoder counts per sample LIBRARY SERVO LIB SEE ALSO servo set vel servo set pos servo millirpm2vcmd servo openloop void servo openloop int which word pwm DESCRIPTION Run specified servo in open loop mode no PID control Note that this bypasses dynamic cur rent limiting if any defined so should be used with caution PARAMETERS which Servo 0 or 1 pwm Output PWM setting 0 1024 0 indicates maximum reverse speed 1024 is maximum forward speed 512 is nominally zero speed but this depends on amplifier offset LIBRARY SERVO LIB SEE ALSO servo _closedloop servo torque 440 rabbit com Dynamic C Functions servo qd zero 0 void servo qd zero 0 void DESCRIPTION Reset the first servo encoder reading to zero The servo motor is not moved only the notion of the current position is reset to zero This should only be called when the servo is in open loop mode LIBRARY SERVO LIB SEE ALSO servo qd zero 1 servo qd zero 1 void servo qd zero 1 void DESCRIPTION Reset the second servo encoder reading to zero The servo motor is not moved only the notion of the current position is reset to zero This should only be called when the servo is in open loop mode LIBRARY SERVO LIB SEE ALSO servo qd zero 0 Dynamic C Functions rabbit com 441 servo read table int servo read table int which word entry word nent int data 12 DE
183. al variable of type Pool_t base Base address of the xmem data memory area to be managed in this pool This must be nel elsize bytes long Typically this would be an area allocated by xalloc when your program starts nel Number of elements in the memory area 1 65535 elsize Size of each element in the memory area 4 65535 RETURN VALUE Currently always zero If you define the macro POOL_ DEBUG then parameters are checked If the parameters look bad then an exception is raised You can define POOL VERBOSE to get printf messages LIBRARY POOL LIB SEE ALSO pool init pxalloc pxcalloc pxfree phwm pavail 352 rabbit com Dynamic C Functions pow float pow float x float y DESCRIPTION Raises x to the yth power PARAMETERS x Value to be raised y Exponent RETURN VALUE x to the yth power LIBRARY MATH LIB SEE ALSO exp powl0 sqrt pow10 float powl10 float zi DESCRIPTION 10 to the power of x PARAMETERS x Exponent RETURN VALUE 10 raised to power x LIBRARY MATH LIB SEE ALSO pow exp sqrt Dynamic C Functions rabbit com 353 powerspectrum void powerspectrum int x int N int blockexp DESCRIPTION Computes the power spectrum from a complex spectrum according to Power k Re X k Im X k The N point power spectrum replaces the N point complex spectrum The power of each com plex spectral component is computed as a 32 bit fraction Its more si
184. allocated elements are not added to the list The application must call preorder or pmovebetween to insert the element This op tion is only available for root pools WARNING if you set the POOL _ LINKED DY App option then the al located element must NOT be passed to any other pool API function except DH for pfree preorder as the e parameter or DNH pmovebetween as the e parameter After calling preorder or pmovebetween then it is safe to pass this element to all appropri ate functions RETURN VALUE Currently always zero If you define the macro POOL_ DEBUG then parameters are checked If the parameters look bad then an exception is raised You can define POOL_ VERBOSE to get printf messages LIBRARY POOL LIB SEE ALSO pool init pool xinit pavail 350 rabbit com Dynamic C Functions pool xappend int pool xappend Pool t p long base word nel DESCRIPTION Add another xmem memory area to an existing pool It is assumed that the element size is the same as the element size of the existing pool The data area does not have to be contiguous with the existing data area but it must be nel elsize bytes long where el size is the element size of the existing pool and nel is the parameter to this function The total pool size must obey the constraints documented with pool _xinit PARAMETERS p Pool handle structure as previously passed to pool_xinit base B
185. amic C Functions OSMboxQuery INT8U OSMboxQuery OS EVENT pevent OS MBOX DATA pdata DESCRIPTION Obtains information about a message mailbox PARAMETERS pevent Pointer to message mailbox s event control block pdata Pointer to a data structure for information about the message mailbox RETURN VALUE OS NO ERR The call was successful and the message was sent OS ERR EVENT TYPE Attempting to obtain data from a non mailbox LIBRARY UCOS2 LIB SEE ALSO OSMboxAccept OSMboxCreate OSMboxPend OSMboxPost Dynamic C Functions rabbit com 273 OSMemCreate OS MEM OSMemCreate void addr INT32U nblks INT32U blksize INT8U err DESCRIPTION Creates a fixed sized memory partition that will be managed by wC OS II PARAMETERS addr Pointer to starting address of the partition nblks Number of memory blocks to create in the partition blksize The size in bytes of the memory blocks err Pointer to variable containing an error message RETURN VALUE Pointer to the created memory partition control block if one is available null pointer otherwise LIBRARY UCOS2 LIB SEE ALSO OSMemGet OSMemPut OSMemQuery 274 rabbit com Dynamic C Functions OSMemGet void OSMemGet OS MEM pmem INT8U err DESCRIPTION Gets a memory block from the specified partition PARAMETERS pmem Pointer to partition s memory control block err Pointer to variable containing an error message RETURN VALUE Pointe
186. and should be released by filesystem use that is its Cas part pointer must be null The new partition values should be placed in the appropriate partition structure within the drive structure For example drive drive drive drive drive drive drive drive part partnum part partnum part partnum part partnum part partnum part partnum part partnum part partnum bootflag 0 starthead Oxfe startseccyl 0 parttype Oxda endhead Oxfe endseccyl 0 Startsector start _partsecsize PART SZ 512 1 mbr CreatePartition amp drive partnum Oxda For more information on the partition structure mbr_ part lookin part defs 1lib The type parameter should match the type as it currently exists on the drive unless this is un used Some values for the t ype parameter are already in use A list of known partition types is at www win tue nl aeb partitions partition types 1 html Note Starting with Dynamic C 9 01 this function BLOCKS PARAMETERS drive pnum type RETURN VALUE O for success Pointer to a MBR drive structure Partition number to be created or modified Type that exists on the physical drive partition now EIO for Error trying to read drive device or structures EINVAL if drive structure Drum or type is invalid EPERM if the partition has not been enumerated or is currently mounted EUNFORMAT if the drive is accessible but not formatted
187. are possible from the fat _Open call LIBRARY FAT LIB SEE ALSO fat ReadDir fat Status fat Open fat Close 104 rabbit com Dynamic C Functions fat PartitionDevice int fat PartitionDevice mbr dev dev int pnum DESCRIPTION This function partitions the device by modifying the master boot record MBR which could destroy access to information already on the device The partition information contained in the specified mbr_dev structure must be meaningful and the sizes and start positions must make sense no overlapping etc If this is not true you will get an EINVAL error code The device being partitioned must already have been formatted and enumerated This function will only allow changes to one partition at a time and this partition must either not exist or be of a FAT type The validity of the new partition will be verified before any changes are done to the device All other partition information in the device structure for those partitions that are not being modi fied must match the values currently existing on the MBR The type given for the new partition must either be zero if you are deleting the partition or a FAT type You may not use this function to create or modify a non FAT partition PARAMETERS dev Pointer to the device structure of the device to be partitioned pnum Partition number of the partition being modified RETURN VALUE 0 success EIO device I O error EINVAL pnum or device
188. ase address of the xmem data memory area to append to this pool This must be nel elsize bytes long Typically this would be an area allo cated using xalloc nel Number of elements in the memory area 1 65534 The sum of this and the current number of elements must not exceed 65535 RETURN VALUE Currently always zero If you define the macro POOL_ DEBUG then parameters are checked If the parameters look bad then an exception is raised You can define POOL VERBOSE to get printf messages LIBRARY POOL LIB SEE ALSO pool xinit Dynamic C Functions rabbit com 351 pool xinit int pool xinit Pool t p long base word nel word elsize DESCRIPTION Initialize an xmem memory pool A pool is a linked list of fixed size blocks taken from a con tiguous area You can use pools instead of malloc when fixed size blocks are all that is needed You can have several pools with different size blocks Using memory pools is very efficient compared with more general functions like malloc There is currently no malloc implemen tation with Dynamic C This function should only be called once at program startup time for each pool to be used After calling this function your application must not change any of the fields in the Pool _t structure PARAMETERS P Pool handle structure This is allocated by the caller but this function will initialize it Normally this would be allocated in static memory by declar ing a glob
189. ase the existing last element is re turned as per plast LIBRARY POOL LIB SEE ALSO pmovebetween pool link Dynamic C Functions rabbit com 357 pputlast fast void pputlast fast Pool t p void e DESCRIPTION See description under pput last This is an assembler callable version do not call from C It does not issue IPSET protection or check parameters Registers Parameters in IX p and DE e Trashes F DE BC Return value in HL PARAMETERS p Pointer to pool handle structure as previously passed to pool_init Pass in IX register e Address of element to move Pass in DE register If NULL then this func tion behaves as plast_fast RETURN VALUE In HL Same as the e parameter unless e is NULL in which case the existing last element is returned as perplast_fast LIBRARY POOL LIB SEE ALSO pmovebetween pool link premain void premain void DESCRIPTION Dynamic C calls premain to start initialization functions such as VdInit The final thing premain does is call main This function should never be called by an application program It is included here for informational purposes only LIBRARY PROGRAM LIB 358 rabbit com Dynamic C Functions preorder void preorder Pool t p void e void where word options DESCRIPTION Atomically remove allocated element e and re insert it before or after element where Atomically
190. ask will wait until the resource becomes available or the event occurs err Pointer to error message LIBRARY UCOS2 LIB SEE ALSO OSSemAccept OSSemCreate OSSemPost OSSemQuery Dynamic C Functions rabbit com 295 OSSemPost INT8U OSSemPost OS EVENT pevent DESCRIPTION This function signals a semaphore PARAMETERS pevent Pointer to the desired semaphore s event control block RETURN VALUE OS MO ERR The call was successful and the semaphore was signaled OS SEM OVF If the semaphore count exceeded its limit In other words you have signalled the semaphore more often than you waited on it with either OSSemAccept orOSSemPend OS ERR EVENT TYPE If a pointer to a semaphore not passed OS ERR PEVENT NULL f pevent isa null pointer LIBRARY UCOS2 LIB SEE ALSO OSSemAccept OSSemCreate OSSemPend OSSemQuery 296 rabbit com Dynamic C Functions OSSemQuery INT8U OSSemQuery OS EVENT pevent OS SEM DATA pdata DESCRIPTION Obtains information about a semaphore PARAMETERS pevent Pointer to the desired semaphore s event control block pdata Pointer to a data structure that will hold information about the semaphore RETURN VALUE OS MO ERR The call was successful and the message was sent OS_ERR_ EVENT TYPE Attempting to obtain data from a non semaphore OS ERR PEVENT NULL f the pevent parameter is a null pointer LIBRARY UCOS2 LIB SEE ALSO OSSemAccept OSSemCreate OSSemPend OSSemPost
191. at_Status fat_LastAccess fat_LastWrite Dynamic C Functions rabbit com 97 fat IsOpen int fat IsOpen FATfile far file DESCRIPTION Returns TRUE if the FATfile passed is in an open state and FALSE otherwise Currently implemented as a macro but may be modified to be an actual function in a future release PARAMETER file Pointer to a FATfile structure to check RETURN VALUE 10 if file is open 0 if file is closed LIBRARY fat lib SEE ALSO fat ReadDir fat Status fat LastAccess fat _LastWrite 98 rabbit com Dynamic C Functions fat LastAccess int fat LastAccess fat dirent entry struct tm t DESCRIPTION Puts the last access date of the specified entry into the system time structure t The time is al ways set to midnight The function does not fill in the tm_wday field in the system time struc ture PARAMETERS entry Pointer to a directory entry t Pointer to a system time structure RETURN VALUE 0 success EINVAL invalid directory entry or time pointer LIBRARY FAT LIB SEE ALSO fat ReadDir fat Status fat CreateTime fat _LastWrite Dynamic C Functions rabbit com 99 fat LastWrite int fat LastWrite fat dirent entry struct tm St DESCRIPTION Puts the date and time of the last write for the given entry into the system time structure t The function does not fill in the tm_wday field in the system time structure PARAMETERS entry Pointer to a directory entr
192. ate state long message long output unsigned int count DESCRIPTION Perform an AES CBC decryption operation See Samples Crypt AES STREAMTEST C for a sample program and a detailed expla nation of the encryption decryption process PARAMETERS state The AESstreamState structure initialized via AESinitStream4x4 This memory must be allocated in the program code before calling AESdecrptyStream4x4 CBC static AESstreamState decrypt state message Cipher text message an xmem buffer output Output buffer for return of decrypted text in xmem Must be as large as the cipher text buffer May be the same as the cipher text buffer count Length of the message Must a multiple of AES CBC BLK SZ_ 16 RETURN VALUE 0 on success non zero on failure LIBRARY AES CORE LIB Dynamic C Functions rabbit com AESencrypt4x4 void AESencrypt4x4 char far expandedkey char far plain char far crypt DESCRIPTION Encrypts a block of data using an implementation of the Rijndael AES cipher with 128 bit key and block size The block of data may be overwritten by the encrypted block of data PARAMETERS expandedkey plain crypt RETURN VALUE None LIBRARY AES CORE LIB A set of round keys generated by AESexpandKey4 from a 16 byte 128 bit key Total of 176 bytes 44 longwords Note when using an AESstreamState structure e g state then call this function using AESencrypt4x4 st
193. ate gt expanded_ key plain crypt A block of 16 bytes of data to be encrypted crypt and plain may point to the same place A block of 16 bytes of resulting encrypted data crypt and plain may point to the same place rabbit com Dynamic C Functions AESencryptStream4x4 CBC int AESencryptStream4x4 CBC AESstreamState state long message long output unsigned int count DESCRIPTION Perform an AES CBC encryption operation on XMEM data Encryption is not in place See Samples Crypt AES STREAMTEST C for a sample program and a detailed expla nation of the encryption decryption process PARAMETERS state An AES stream state structure initialized via AESinitStream4x4 This memory must be allocated in the program code before calling AESencrptyStream static AESstreamState encrypt state message The message in plaintext an xmem buffer output The output buffer for return of encrypted text in xmem must be as large as the plaintext buffer and may be the same as the plaintext buffer count The length of the message Must be a multipleof AES CBC BLK SZ 16 RETURN VALUE 0 on success non zero on failure count was not multiple of 16 LIBRARY AES CORE LIB Dynamic C Functions rabbit com AESexpandKey4 void AESexpandKey4 char far expanded char far key DESCRIPTION Prepares a key for use by expanding it into a set of round keys A key is a password to dec
194. bbit com Dynamic C Functions flash erasechip void flash erasechip FlashDescriptor fd DESCRIPTION Erases an entire flash memory chip Note fd must have already been initialized with flash_init before calling this func tion See flash _init description for further restrictions PARAMETERS fd Pointer to flash descriptor of the chip to erase LIBRARY FLASH LIB SEE ALSO flash _erasesector flash gettype flash init flash read flash_readsector flash_sector2xwindow flash _writesector Dynamic C Functions rabbit com 137 flash erasesector int flash erasesector FlashDescriptor fd word which DESCRIPTION Erases a sector of a flash memory chip Note fd must have already been initialized with flash _init before calling this func tion See flash nit description for further restrictions PARAMETERS fd Pointer to flash descriptor of the chip to erase a sector of which The sector to erase RETURN VALUE 0 Success LIBRARY FLASH LIB SEE ALSO flash erasechip flash gettype flash init flash read flash readsector flash _sector2xwindow flash writesector 138 rabbit com Dynamic C Functions flash gettype int flash gettype FlashDescriptor fd DESCRIPTION Returns the 16 bit flash memory type of the flash memory Note fd must have already been initialized with flash_init before calling this func tion See flash _init description for further restrictions PARAMETERS
195. be deleted to make room If this cannot be done or an unrecoverable error occurs then 2 is returned For non circular destinations 2 is returned when it becomes full Since multiple log destinations can result from the given facility priority it can be difficult to determine which actual destination caused an error You can use the log_map function to determine the destinations then check each destination s state using log_condition Note Please see the comments at the top of log 1ib for a description of the message logging subsystem PARAMETERS ifp Facility priority code Facility in 5 MSBs priority in 3 LSBs fmt Format code 0 for ascii string others user defined data Pointer to first byte of data to store length Length of data Must be between 0 and 115 LOG_MAX_ MESSAGE inclu sive RETURN VALUE 0 success 1 Message too long over 115 2 Unrecoverable error in destination This return code usually means that the destination is unusable and further entries for that destination will probably meet the same fate This can also mean that the destination has not been opened LIBRARY log lib 222 rabbit com Dynamic C Functions Log seek int log seek LogDest ldst int DESCRIPTION Position log for readback The next call to log_next will return the first entry in the log if whence 0 or log_prev will return the last entry if whence 1 Note Please see the comments at the top of log 1ib
196. bility YOU AGREE THAT UNDER NO CIRCUMSTANCES INCLUDING NEG LIGENCE SHALL RABBIT BE LIABLE FOR ANY INCIDENTAL SPECIAL OR CONSEQUEN TIAL DAMAGES INCLUDING DAMAGES FOR LOSS OF BUSINESS PROFITS BUSINESS INTERRUPTION LOSS OF BUSINESS INFORMATION AND THE LIKE ARISING OUT OF THE USE AND OR INABILITY TO USE THE SOFTWARE EVEN IF RABBIT OR ITS AUTHO RIZED REPRESENTATIVE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES SO THE ABOVE LIMITATION OR EXCLUSION MAY NOT APPLY TO YOU IN NO EVENT SHALL RABBIT S TOTAL LIABILITY TO YOU FOR ALL DAMAGES LOSSES AND CAUSES OF ACTION WHETHER IN CON TRACT TORT INCLUDING NEGLIGENCE OR OTHERWISE EXCEED THE AMOUNT PAID BY YOU FOR THE SOFTWARE 8 Termination This License is effective for the duration of the copyright in the Software unless termi nated You may terminate this License at any time by destroying all copies of the Software and its docu mentation This License will terminate immediately without notice from Rabbit if You fail to comply with any provision of this License Upon termination You must destroy all copies of the Software and its documentation Except for Section 2 License all Sections of this Agreement shall survive any expiration or termination of this License Dynamic C Functions rabbit com 559 9 General Provisions No delay or failure to take action under thi
197. bit com 245 nf getPageCount long nf getPageCount nf device dev DESCRIPTION Returns the number of program pages on the particular NAND flash device PARAMETERS dev Pointer toannf_device structure for an initialized NAND flash device RETURN VALUE The number of program pages on the NAND flash device LIBRARY NFLASH LIB This function was introduced in Dynamic C 9 01 SEE ALSO CalculateECC256 ChkCorrectECC256 xCalculateECC256 xChkCorrectECC256 246 rabbit com Dynamic C Functions nf getPageSize long nf getPageSize nf device dev DESCRIPTION Returns the size in bytes excluding spare bytes of each program page on the particular NAND flash device PARAMETERS dev Pointer toannf_device structure for an initialized NAND flash device RETURN VALUE The number of data bytes in the NAND flash s program page excluding the spare bytes used for ECC storage etc LIBRARY NFLASH LIB This function was introduced in Dynamic C 9 01 SEE ALSO CalculateECC256 ChkCorrectECC256 xCalculateECC256 xChkCorrectECC256 Dynamic C Functions rabbit com 247 nf initDevice int nf initDevice nf device dev int which DESCRIPTION Initializes a particular NAND flash device This function must be called before the particular NAND flash device can be used Seenf_devtable in NFLASH LIB for the user updat able list of supported NAND flash devices Note that xalloc is called to allocate buffe
198. bits 7 0 bit Bit location where 0 represents the least significant bit RETURN VALUE 1 Specified bit is set 0 Bit is clear LIBRARY UTIL LIB SEE ALSO BEIT 16 rabbit com Dynamic C Functions BIT unsigned int BIT void address unsigned int bit DESCRIPTION Dynamic C may expand this call inline Reads specified bit at memory address bit may be from 0 to 31 This is equivalent to the fol lowing expression but more efficient long address gt gt bit amp 1 PARAMETERS address Address of byte containing bits 7 0 bit Bit location where 0 represents the least significant bit RETURN VALUE 1 bit is set 0 bit is clear LIBRARY UTIL LIB SEE ALSO bit Dynamic C Functions rabbit com 17 BitRdPortE root int BitRdPortE unsigned int port int bitnumber DESCRIPTION Returns 1 or 0 matching the value of the bit read from the specified external I O port PARAMETERS port Address of external parallel port data register bitnumber Bit to read 0 7 RETURN VALUE O or 1 The value of the bit read LIBRARY SYSIO LIB SEE ALSO RdPortI BitRdPortI WrPortI BitWrPortI RdPortE WrPortE BitWrPortE 18 rabbit com Dynamic C Functions BitRdPortI int BitRdPortI int port int bitnumber DESCRIPTION Returns 1 or 0 matching the value of the bit read from the specified internal I O port PARAMETERS port Address of internal parallel port data register bitnumber Bit to read
199. ble free element from the given pool Eventually your application should re turn this element to the pool using pfree to avoid memory leaks Assembler code can call palloc_fast instead PARAMETERS p Pool handle structure as previously passed to pool init RETURN VALUE Null No free elements available Otherwise pointer to an element LIBRARY POOL LIB SEE ALSO pool init pcalloc pfree phwm pavail palloc fast pxalloc pool link 322 rabbit com Dynamic C Functions palloc fast xmem void palloc fast Pool t p DESCRIPTION Return next available free element from the given pool which must be a root pool This is an assembler only version of palloc Do not call this function from C palloc_ fast does not perform any IPSET protection parameter validation or update the high water mark palloc_ fast is aroot function The parameter must be passed in IX and the returned element address is in HL REGISTERS Parameter in IX Trashes F BC DE Return value in HL carry flag EXAMPLE ld ix my_pool lcall palloc_ fast jr c no_free HL points to element PARAMETERS P Pool handle structure as previously passed to pool_init Pass this in IX RETURN VALUE C flag set no free elements were available C flag clear NC HL points to an element If the pool is not linked your application can use this element provided it does not write more than p gt elsize bytes to it th
200. c use32kHzOsc Dynamic C Functions rabbit com 467 setClockModulation void setClockModulation int setting DESCRIPTION Changes the setting of the Rabbit 3000 CPU clock modulation Calling this function will force a 500 clock delay before the setting is changed to ensure that the previous modulation setting has cleared before the next one is set See the Rabbit 3000 Microprocessor User s Manual for more details about clock modulation for EMI reduction PARAMETER setting Clock modulation setting Allowed values are e 0 no modulation e 1 weak modulation e 2 strong modulation LIBRARY SYS LIB 468 rabbit com Dynamic C Functions set cpu power mode int set cpu power model int mode char clkDoubler char shortChipSelect DESCRIPTION Sets operating power of the controller Suspend serial communication and other data transmis sion activity prior to calling this function which sets higher priority interrupt while switching clock frequencies This function is non reentrant PARAMETERS mode Mode operation Use the following table values below The higher the val ue the lower the power consumption of controller Mode Description Comments 1 Cclk Pclk MainOsc Debug capable 2 Cclk Pclk MainOsc 2 Debug capable 19200 baud 3 Cclk Pclk MainOsc 4 Debug capable 9600 baud 4 Cclk Pclk MainOsc 6 5 Cclk Pclk MainOsc 8 6 Celk Pclk 32 768KHz Periodic Interrupt disabled so call
201. c C Functions HDLCsendingX int HDLCsendingX void Where X is E or F DESCRIPTION Returns true if a packet is currently being transmitted This function is intended for use with the Rabbit 3000 and Rabbit 4000 RETURN VALUE 1 Currently sending a packet 0 Transmitter is idle LIBRARY HDLC PACKET LIB hexstrtobyte int hexstrtobyte char far p DESCRIPTION Converts two hex characters 0 9A Fa f to a byte RETURN VALUE The byte 0 255 represented by the two hex characters or 1 on error invalid character string less than 2 bytes EXAMPLES hexstrtobyte FF returns 255 hexstrtobyte 0 returns 1 error because lt 2 characters hexstrtobyte ABCDEF returns 0OxAB ignores additional chars Dynamic C Functions rabbit com 193 hitwd void hitwd void DESCRIPTION Hits the watchdog timer postponing a hardware reset for 2 seconds Unless the watchdog timer is disabled a program must call this function periodically or the controller will automatically reset itself If the virtual driver is enabled which it is by default it will call hit wd in the back ground The virtual driver also makes additional virtual watchdog timers available LIBRARY VDRIVER LIB htoa char htoa int value char buf DESCRIPTION Converts integer value to hexadecimal number and puts result into buf PARAMETERS value 16 bit number to convert buf Character string of converted number RETU
202. ce the update is successful If there is a power outage or reset during this pro cess it is possible for two registry files to exist when the system is restarted This causes prob lems since one of the registries may be corrupt This API imposes a naming convention on the old new resources so that a non corrupt registry can always be found The algorithm used appends an extension to the basename resource name The extension is 1 2 or 3 The current registry resource will cycle through these extensions It is assumed that exactly 0 1 or 2 of these resources will exist at any time This means that at least one of the possible resource names will not exist If all three exist then the behavior is undefined since the resources must have been created outside the registry system The application is responsible for ensuring this does not happen otherwise the ability to find a non corrupt registry will be compromised 400 rabbit com Dynamic C Functions registry prep read cont d If none of the resources exist then this indicates a brand new registry If exactly one exists then this is the old and presumed non corrupt registry If two exist it is assumed that one of the resources is OK and the other corrupt Since there are only 3 possible extensions and they in crement in wrap around fashion the lowest numbered extension is assumed to be the non cor rupt one with lowest being in the sense of modulo 3 This is summarize
203. ceaeecagseavsasacinaaesas 463 Ser DOPEN Ge teese cerp Zen araa EE EE EEE 455 SCTAWIFTCE NEEN 463 SEP D Parity i sc sudeccaienadessacdsdaavedactasaendlensceaeeas 456 SEA WIE cearcan deias ue e 464 Ser Dpeek E 457 E 465 SEET eege a nai R eti 458 SEGBCIOSE eege geed ine geg g E rE ASER T 448 Ser KT 459 serBdatabits cccccccscecsceesceeseeesceeeeeeseeeseesss 448 serDrdFlush cccccecececececececeeececececeeeeesenenes 460 SCrBAMaOLE cccccccsceescececeeseeesceeseeeeeeeseeess 449 SCLDICFLee ccccceceeeceescececeeseecsceeseeeseeeeseess 460 serBdmaOn ccccecececececececececeeecececececeeeeeeeses 450 SOrDrdU sed s3isses s00555 o8se0sdsedseedadesecsaveseesseteets 461 serBflowcontrolOff cccccccccecececececeseceeeeeees 451 SEMDTCA A teg SC eg ged deed 462 serBflowcontrolOn ccccccececececececececeeeeeeeses 452 SOP WIFIUSH zeg deegehudEegeSAdE EES dedd use 463 SPB SEC eet Eddie Ee 453 SCTDWIFTEE NEEN 463 serBgetError EE 454 NK 464 Ser BOpEN 3s csveceterececssseavesccesneaessauvvasessacsees 455 serDWrUSEd ssa tcacheasssecssvaieas sacedccergeazescadexacess 465 SCTBPALILY s ss 0c cdecedecdesiestecdeaesccsesseadecteeesas 456 SEFECIOSE E 448 SerB peeks nee 457 serEdatabits EE 448 SCT BPUte vei ssasschaeadensda ssesdesaesdeceas cvensedddecanedas 458 serEdmaOff ecccccceceeeeessenscececeeeeessessnteeeees 449 SerB puts ed EE 459 Ser Edina On seraa er E toes 450 serBrdFlush ccccccccecececececececececeeeceeeeeeeeee
204. cececececeeeceeseeeseeeseeeseeeeseess 463 BEES e e E A EET 453 e E E 463 serDgetError Een 454 ser FWrite as i3sce eddcdentiadessaseaeadiechedacaseaencntatens 464 Dynamic C Functions rabbit com xi serFwrUsed vicccccsccassorsdsacsbvaSoaseseacdeedeoaccad srst 465 Sf_imitDeVICE ccccccccceceesessseeeeceeeceeueeeseeces 480 servo_alloc_table ccccccssecccesseccseceeecceeeses 430 SE AS WHUING Seed SEENEN Ae 481 servo_closedloop ceeeeeseesersecececeeeeessestnteees 430 sf_pageTORAM cccceeseesessececeeeeesessentnaeees 481 Servo d sable D 431 sf RAMToPage sccseceseeesseeseeessesssesesesens 482 servo d aable 1 432 sf_readDeviceRAM cssecccessccnseceesecceences 483 servo enable 0 433 sfo readPage siciisvieiissisavsinjssevssasssevssassvevesariee 484 servo enable 1 434 Sf_readRAM AAA 485 SE POAT TE T 435 sf_writeDevicORAM csecceeesccnseccesecceseces 486 e s sseus eceetensazassesesenvedeaascseusaeddeders 437 Ee 487 See ADI geesde dee SES ee 438 Sf_WriteRAM cecccssecccecceessecnssccesscceences 488 servo_millirpm2VCMd e scccceceeeseeserseeees 438 SESPU AMIE EE deene ease 488 SEEVO MOVE EE 439 EIDEN 489 servo_openloop ceceeeeeseesertececeeeessessentnaeees 440 Beggen 489 Servo Od Zero D 441 SNPHINEL E 490 servo Od Zeng le 441 SPINI 491 servo_read_table ccceccssecccssscceeeccnsecceseces 442 SPIRead ccccceseeccssceccescccuccccesceceeseceseceeseees 492 seryo_set_co
205. character string with a minus sign in the leftmost digit when appropriate at buf The string represents value a signed number Leading zeros are suppressed in the character string except for one zero digit when value 0 The longest possible string is 32768 PARAMETERS value 16 bit signed number to convert buf Character string of converted number in base 10 RETURN VALUE Pointer to the end null terminator of the string in buf LIBRARY STDIO LIB SEE ALSO atoi utoa ltoa Dynamic C Functions rabbit com 205 i2c check ack int i2c_ check ack void DESCRIPTION Checks if slave pulls data low for ACK on clock pulse Allows for clocks stretching on SCL going high RETURN VALUE 0 ACK sent from slave 1 NAK sent from slave 1 Timeout occurred LIBRARY I2C LIB SEE ALSO Technical Note 215 Using the DC Bus with a Rabbit Microprocessor 206 rabbit com Dynamic C Functions i2c_ init void i2c init void DESCRIPTION Sets up the SCL and SDA port pins for open drain output LIBRARY I2C LIB SEE ALSO Technical Note 215 Using the I2C Bus with a Rabbit Microprocessor i2c read char int i2c read char char ch DESCRIPTION Reads 8 bits from the slave Allows for clocks stretching on all SCL going high This is not in the protocol for IC but allows DC slaves to be implemented on slower devices PARAMETERS ch A one character return buffer RETURN VALUE 0 Success
206. chedLock LIBRARY UCOS2 LIB SEE ALSO OSSchedLock Dynamic C Functions rabbit com 293 OSSemAccept INT16U OSSemAccept OS EVENT pevent DESCRIPTION This function checks the semaphore to see if a resource is available or if an event occurred Un like OSSemPend OSSemAccept does not suspend the calling task if the resource is not available or the event did not occur PARAMETERS pevent Pointer to the desired semaphore s event control block RETURN VALUE Semaphore value If gt 0 semaphore value is decremented value is returned before the decrement If 0 then either resource is unavailable event did not occur or null or invalid pointer was passed to the function LIBRARY UCOS2 LIB SEE ALSO OSSemCreate OSSemPend OSSemPost OSSemQuery 294 rabbit com Dynamic C Functions OSSemCreate OS EVENT OSSemCreate INT16U cnt DESCRIPTION Creates a semaphore PARAMETERS ent The initial value of the semaphore RETURN VALUE Pointer to the event control block OS_ EVENT associated with the created semaphore or null if no event control block is available LIBRARY UCOS2 LIB SEE ALSO OSSemAccept OSSemPend OSSemPost OSSemQuery osSSemPend void OSSemPend OS EVENT pevent INT16U timeout INT8U err DESCRIPTION Waits on a semaphore PARAMETERS pevent Pointer to the desired semaphore s event control block timeout Time in clock ticks to wait for the resource If 0 the t
207. com 309 OSTaskSwHook void OSTaskSwHook void DESCRIPTION Called whenever a context switch happens The task control block TCB for the task that is ready to run is accessed via the global variable OSTCBHighRdy and the TCB for the task that is being switched out is accessed via the global variable OSTCBCur LIBRARY UCOS2 LIB OSTCBInitHook void OSTCBInitHook OS TCB ptcb DESCRIPTION This function is called by OSTCBInit after setting up most of the task control block TCB Interrupts may or may not be enabled during this call PARAMETER ptcb Pointer to the TCB of the task being created LIBRARY UCOS2 LIB 310 rabbit com Dynamic C Functions OSTimeDly void OSTimeDly INT16U ticks DESCRIPTION Delays execution of the task for the specified number of clock ticks No delay will result if ticks is 0 If ticks is gt 0 then a context switch will result PARAMETERS ticks Number of clock ticks to delay the task LIBRARY UCOS2 LIB SEE ALSO OSTimeD1LyHMSM OSTimeDlyResume OSTimeDlySec Dynamic C Functions rabbit com 311 OSTimeD1lyHMSM INT8U OSTimeDlyHMSM INT8U hours INT8U minutes INT8U seconds INT16U milli DESCRIPTION Delays execution of the task until specified amount of time expires This call allows the delay to be specified in hours minutes seconds and milliseconds instead of ticks The resolution on the milliseconds depends on the tick rate For example a 10 ms
208. com Dynamic C Functions fat Open cont d RETURN VALUE 0 success EINVAL invalid arguments Trying to create volume label or conflicting flags ENOENT file directory could not be found EPATHSTR Invalid path string for parent directory EEXIST object existed when FAT _MUST_CREATE flag set EPERM trying to create a file directory on a read only partition EMFILE too many open files If you get this code increase the FAT _MAXMARKERS defi nition in the BIOS Other negative values indicate I O error etc Non blocking mode only EBUSY the device is busy nonblocking mode only EFSTATE file structure is not in a valid state Usually means it was not zerod before calling this function for the first time for that file struct when in non blocking mode can also occur if the same file struct is opened more than once LIBRARY FAT LIB SEE ALSO fat ReadDir fat Status fat Close Dynamic C Functions rabbit com 103 fat OpenDir int fat OpenDir fat _ part part char dirname FATfile dir DESCRIPTION Opens a directory for use filling in the FAT ile handle PARAMETERS part Pointer to the partition structure being used dirname Pointer to the full path name of the directory to be opened or created dir Pointer to directory requested RETURN VALUE 0 success EINVAL invalid argument ENOENT the directory cannot be found EBUSY the device is busy Only if non blocking Other negative values
209. crs saraveateaetnicoaeretaees 31 a E 521 E Ge tecspeccaasatetetecseteatenecte 32 BCEE enee 522 E ene ee ee 33 BEE PA cof_serFputs eet Eege ee 34 USEBLKHZOSC ee 524 cof_serFread woe cccceeeeessescccceceeseesseeees 35 Write Tte onered ennn aia 534 A EE EE 36 e ger cleoeg erain eaaa a deed 448 serAdatabits cccccccssessssececeeeeeeeenens 448 Serial Communication e EE 449 COF_SCTAQEtC sassessssesseseeseseererrerrsreseeseseese 31 EE 450 COf_SeErA gets sn spscctesseraccsnentacncasenedeaseaeears 32 INE Ee EENEG 452 COF_SELAPULC En 33 BEER 25 severe those laassveensernenenseneene 453 E E CN 34 Ser gefor esceesesssssssesesssscseeseceeeseees 454 cof_serAread eege e 35 Ber ADEM gie 455 COP SETA WHILE Age TEEN 36 SCrAParity ccscscesesseessssseseesesssseseesesssee 456 cof_serBgete EEN 31 BEE GE 457 cof_serBgets ENEE 32 BEE 5 svavaspanseannesvenassacnnedasonsvaoaeeys 458 COF_SEFBPULC EE 33 BEER 459 cof_serBputs cesssssesesessesseeeeeeteseteees 34 serArdFlush ett taire eege 460 cof_serBread EEN 35 serArdFree c ccccccsesssssesnecsecscssssnsses 460 cof_serBwrite Agen geess 36 AVANTE ENEE 461 Gol sert gei ENEE 31 GE 462 Col sert ges ENEE 32 serAwrFlush 00 0 ceccccceesesssseceeeeeeeeeenes 463 COF_SCTCPULC sssssssssssesessesserserestsneseeseseene 33 S TA WIFTOG dosssssscvsnanrdesnsisnavsnraavderaais 463 COfF_SErCPUtS ENER 34 SErAWTIte eege 464 xxiv rabbit com Dynamic C Functions SCYAWIUSE ooo ececeeeeeesesseeeceeeeeeesetsees 465 SCLC
210. cssasesveateccasseesseaewadanes 32 errlogGetHeaderInfo sesscceceeeeeseseeneeaeees 70 COE GELE PUtC ves E E as ventas 33 errlogGetMessage ccceeseesesscececeeeeeseessnaeees 73 cof_serEputs ENEE 34 errlogGetNthEntry cececeesseeceeeeeeeseenenaeees 71 cof_serEread sseesseesseesseessessseessecssecsssesssesee 35 errlogReadHeader ccccccecececesecececeeeeeseeeeeees 73 cof_serEwrite eesseesseesseessessseessecsseesescsseese 36 error message ccececececececececececececececeeeeeseeeeees 74 TE DEE 31 aO E E 75 COL SELF EE 32 E EEN 76 EE E 33 EXP E AEA E teteeenseateddeareac 76 E UC isinai oinn ansa iEn a iaai 34 COL serFread 5 sca cese sonsciecnesseiseisdesvetdeceavavesisconeses 35 F CO were EEN 36 MAUS E A 77 CompressFile ccccccccecececececececceeceeeseeeseeeees 37 ET EES 78 COPAUSE dieses ie ge E Eed 38 EE EE 81 Cokeget serors erre gedoe sus Eege EN 38 fat Create DIF onanan aaan 82 CoResume EEN 39 fat CreateFile og gesgeegess eege gege dd 83 CO eeh 40 SIC EENEG 84 COSHH aan aaa dee ESAS 40 E E E sn teoctaite Gace aitaeets 85 D fat_EnumDeVvice cccceccceecececescececceseceseecs 86 fat_EnumPartition ccccccssecccssscceeeccescceeens 87 DecompressFile cccccsessessececeeeeeeeesensaeees 41 fat_FileSize ENEE 88 defineErrorHandler ecsesscecceceeeeeseesenaeees 42 fat_FormatDevice sssesesossesssesressssesssesreresseseo 89 depa a eh 43 fat_FormatPartition
211. cture to fill with new UTC time sentence A string containing a line of GPS data in NMEA 0183 format RMC sen tence RETURN VALUE 0 Success 1 Parsing error 2 Sentence marked invalid LIBRARY GPS LIB gps _ ground distance float gps ground distance GPSPosition a GPSPosition b DESCRIPTION Calculates ground distance in km between two geographical points Uses spherical earth model PARAMETERS a First point b Second point RETURN VALUE Distance in kilometers LIBRARY GPS LIB Dynamic C Functions rabbit com 183 hanncplx void hanncplx int x int N int blockexp DESCRIPTION Convolves an N point complex spectrum with the three point Hann kernel The filtered spec trum replaces the original spectrum The function produces the same results as would be obtained by multiplying the corresponding time sequence by the Hann raised cosine window The zero crossing width of the main lobe produced by the Hann window is 4 DFT bins The adjacent sidelobes are 32 db below the main lobe Sidelobes decay at an asymptotic rate of 18 db per octave N must be a power of 2 and between 4 and 1024 An invalid N causes a RANGE exception PARAMETERS x Pointer to N element array of complex fractions N Number of complex elements in array x blockexp Pointer to integer block exponent LIBRARY FFT LIB SEE ALSO fftcplx fftcplxinv fftreal fftrealinv hanncplx powerspectrum 184
212. d 2 define QD2 USEPORTEH use port E pins 7 and 6 If no macro is defined for a decoder that decoder will be disabled PARAMETERS iplevel The interrupt priority for the ISR that handles the count overflow This should usually be 1 LIBRARY QD LIB was in R3000 LIB prior to DC 10 384 rabbit com Dynamic C Functions qd read long qd read int channel DESCRIPTION Reads the current quadrature decoder count Since this function waits for a clear reading it can potentially block if there is enough flutter in the decoder count This function is intended to be used with the Rabbit 3000 and Rabbit 4000 PARAMETERS channel The channel to read currently 1 or 2 RETURN VALUE Returns a signed long for the current count LIBRARY QD LIB was in R3000 LIB prior to DC 10 qd zero void qd zero int channel DESCRIPTION Sets the count for a channel to 0 This function is intended to be used with the Rabbit 3000 and Rabbit 4000 PARAMETERS channel The channel to reset currently 1 or 2 LIBRARY QD LIB was in R3000 LIB prior to DC 10 Dynamic C Functions rabbit com 385 qsort int qsort char base unsigned n unsigned s int cmp DESCRIPTION Quick sort with center pivot stack control and easy to change comparison method This ver sion sorts fixed length data items It is ideal for integers longs floats and packed string data without delimiters Raw integers longs floats or strings may be
213. d in the following table Existing Extensions Assumed Non corrupt None new registry 1 1 2 2 3 3 1 2 1 2 will be deleted 2 3 2 3 will be deleted 1 3 3 1 will be deleted Should not happen will 1 2 3 arbitrarily pick 1 and delete SCH In the case that more than one registry extension was found the presumed corrupt resource is automatically deleted to clean up the registry PARAMETERS r RegistryContext structure This is used to pass information in a consistent manner between the major registry API functions It may be passed unini tialized to this function This function fills in the r gt old_spec field to indi cate the open resource which will be used by registry_read The value may also be set to 1 if there was an error or no existing resource could be located basename Base name including path of the registry This should NOT include any extension e g foo since the extension is manipulated by this function In practice this will need to be a resource name on non volatile storage which supports names with extensions In practice this limits the appro priate filesystem to FAT filesystem only For example registry prep read A myreg amp spec will select from a set of registry files called A myreg 1 A myreg 2 A myreg 3 of which normally only one will exist at any time Dynamic C Functions rabbit com 401 registry prep read cont d context S
214. d must have already been initialized with flash _init before calling this func tion See flash nit description for further restrictions PARAMETERS fd The FlashDescriptor of the flash memory to read from sector The source sector to read buffer The physical address of the destination buffer TIP A logical address can be changed to a physical with the function paddr RETURN VALUE 0 Success LIBRARY FLASH LIB SEE ALSO flash erasechip flash _erasesector flash gettype flash init flash_read flash_sector2xwindow flash _writesector 142 rabbit com Dynamic C Functions flash sector2xwindow void flash sector2xwindow FlashDescriptor fd word sector DESCRIPTION This function sets the MB3CR and XPC value so the requested sector falls within the XPC win dow The MB3CR is the Memory Interface Unit bank register XPC is one of four Memory Management Unit registers See flash init description for restrictions PARAMETERS fd The FlashDescriptor of the flash memory sector The sector to set the XPC window to RETURN VALUE The logical offset of the sector LIBRARY FLASH LIB SEE ALSO flash _ erasechip flash _erasesector flash _gettype flash init flash read flash readsector flash writesector Dynamic C Functions rabbit com 143 flash writesector int flash writesector FlashDescriptor fd word sector unsigned long buffer DESCRIPTION Writes the contents of buffer to sector on the flash mem
215. d serXclose where X is A F DESCRIPTION Disables serial port X This function is non reentrant The functions serEclose and serFclose may be used with the Rabbit 3000 and Rabbit 4000 LIBRARY RS232 LIB serXdatabits void serXdatabits state where X is A F DESCRIPTION Sets the number of data bits in the serial format for this channel Currently seven or eight bit modes are supported A call to serXopen must be made before calling this function This function is non reentrant The functions serEdatabits and serFdatabits may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXdatabits int port where port is one of the macros SER_PORT A through SER_PORT E PARAMETERS state An integer indicating what bit mode to use It is best to use one of the mac ros provided for this e PARAM 7BIT Configures serial port to use 7 bit data e PARAM 8BIT Configures serial port to use 8 bit data default condi tion LIBRARY RS232 LIB 448 rabbit com Dynamic C Functions serxXdmaOff int serXdmaOff void where X is A F DESCRIPTION Stops DMA transfers and unallocates the channels Restarts the serial interrupt capability Note Alternatively you can use another form of this fu
216. deleted This call back function resides in UCOS2 LIB Interrupts are disabled during this call therefore it is recommended that code be kept to a minimum PARAMETERS ptcb Pointer to TCB of task being deleted LIBRARY UCOS2 LIB SEE ALSO OSTaskCreateHook 304 rabbit com Dynamic C Functions OSTaskDelReq INT8U OSTaskDelReq INT8U prio DESCRIPTION Notifies a task to delete itself A well behaved task is deleted when it regains control of the CPU by calling OSTaskDelReq OSTaskDelReq and monitoring the return value PARAMETERS prio The priority of the task that is being asked to delete itself OS PRIO_ SELF is used when asking whether another task wants the current task to be deleted RETURN VALUE OS MO ERR The task exists and the request has been registered OS TASK NOT EXIST The task has been deleted This allows the caller to know whether the request has been executed OS TASK DEL IDLE If requesting to delete uC OS II s idletask OS PRIO INVALID The priority specified is higher than the maximum allowed i e OS LOWEST PRIO or OS PRIO_ SELF is not specified OS TASK DEL REQ A task possibly another task requested that the running task be de leted LIBRARY UCOS2 LIB SEE ALSO OSTaskDel Dynamic C Functions rabbit com 305 OSTaskIdleHook void OSTaskIdleHook void DESCRIPTION This function is called by the idle task This hook has been added to allow you to do such things as STOP the CPU t
217. died you MUST be careful because the resource s will no longer be guarded by the mutex PARAMETERS pevent Pointer to mutex s event control block opt May be one of the following delete options e OS DEL NO PEND Delete mutex only if no task pending e OS DEL ALWAYS Deletes the mutex even if tasks are waiting In this case all pending tasks will be readied err Pointer to an error code that can contain one of the following values e OS_NO_ERR The call was successful and the mutex was deleted e OS ERR DEL ISR Attempted to delete the mutex from an ISR e OS ERR INVALID OPT An invalid option was specified e OS ERR TASK WAITING One or more tasks were waiting on the mutex e OS ERR _EVENT_TYPE If you didn t pass a pointer to a mutex point er RETURN VALUE pevent On error OS EVENT 0 Mutex was deleted LIBRARY OS MUTEX C 280 rabbit com Dynamic C Functions OSMutexPend void OSMutexPend OS EVENT pevent INT16U timeout INT8U err Ir DESCRIPTION This function waits for a mutual exclusion semaphore Note that e The task that owns the Mutex MUST NOT pend on any other event while it owns the mutex e You MUST NOT change the priority of the task that owns the mutex PARAMETERS pevent timeout err LIBRARY OS MUTEX C Pointer to mutex s event control block Optional timeout period in clock ticks If non zero your task will wait for the resource up to the amount of time specified by this argument
218. ding character in str2 or str2 is shorter than but otherwise identical to st r1 LIBRARY STRING LIB SEE ALSO strnempi strncmp strcmp 500 rabbit com Dynamic C Functions strcpy NEAR SYNTAX char n strcpy char dst char src FAR SYNTAX char far f strcepy char far dst char far src Note By default strcpy is defined to pn strcpy DESCRIPTION Copies one string into another string including the null terminator For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_ STRING macro is de fined and all pointers are near pointers append np to the function name e g n_ strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS dst Pointer to location to receive string sre Pointer to location to supply string RETURN VALUE Pointer to destination string LIBRARY STRING LIB SEE ALSO strncpy Dynamic C Functions rabbit com 501 strcspn NEAR SYNTAX unsigned int n _s
219. dle returned in oldp The numeric return code indicates which of the extensions was located Note that the new registry file will be this number plus 1 except that 4 becomes 1 LIBRARY register lib SEE ALSO registry read registry finish read registry prep read registry write registry finish write registry enumerate registry update registry get 404 rabbit com Dynamic C Functions registry read int registry read RegistryContext r char far section RegistryEntry far entries DESCRIPTION Read the registry r gt old_spec using the specified registry entries Only entries in the named section are read and the results are placed at the locations pointed to by the RegistryEntry array elements Note Since this function requires some temporary malloc memory you should ensure that there is at least_REGBUF SIZE bytes of available system space malloc memory The _REGBUF_ SIZE macro defaults to 1025 bytes but you may override this definition before use registry lib r RegistryContext structure with at least the old_spec field initialized For example use registry _prep_read to set up this structure cor rectly r gt old_spec Open resource handle of a readable resource containing the registry set tings This is read from the current seek position thus in most cases you will want to call this function with a freshly opened resource handle section Section name If NULL or empty string then the fir
220. dma pri unsigned int chunkiness unsigned int min cpu pct DESCRIPTION This function sets up DMA parameters The chunkiness parameter determines the amount of CPU time needed to transfer data according to this chart chunkiness 1 2 3 4 8 16 32 64 CPU_cycles 11 15 19 23 39 71 135 263 The min_cpu_pct parameter determines the minimum time between bursts and is calculated with this formula CPU_cycles min_cpu_pct free time cpu free time 100 min_cpu_pct This is then rounded up to the nearest value out of 12 16 24 32 64 128 256 or 512 PARAMETERS transfer pri DMA transfer priority 0 1 2 or 3 transfers can occur when the CPU interrupt priority is less than or equal to this value interrupt pri DMA interrupt priority 0 1 2 or 3 a value of 0 will disable the DMA interrupts inter dma pri Relative prioritization amongst the DMA channels It is one of the fol lowing constants e DMA _IDP FIXED fixed priorities with higher channel numbers tak ing precedence e DMA_IDP ROTATE FINE priorities are rotated after every byte transferred e DMA_IDP ROTATE COARSE priorities rotated after every transfer request the size of which is determined by the chunkiness parameter chunkiness Maximum transfer burst size Allowed values are 1 2 3 4 8 16 32 or 64 Other numbers will be rounded down to the nearest allowed val ue Dynamic C Functio
221. e 0 Logical extent number of the RAM device LIBRARY FS2 LIB SEE ALSO fs get flash 1x FS2 fs get other 1x FS2 164 rabbit com Dynamic C Functions fs eet 1x FS2 int fs_set_1x FSLXnum meta FSLXnum data DESCRIPTION Sets the default logical extent LX numbers for file creation Each file has two parts the main bulk of data and the metadata which is a relatively small fixed amount of data used to journal changes to the file Both data and metadata can reside on the same extent or they may be sep arated The metadata no matter where it is located consumes one sector The file creation functions allow the metadata extent to be explicitly specified in the high byte of the file number however it is usually easier to call Ca __set_1x to set appropriate de faults Calling Co sert Lil is the only way to specify the data extent Iffs_set_1x is never called both data and metadata will default to the first non reserved extent number PARAMETERS meta Extent number for metadata data Extent number for data RETURN VALUE 0 Success 0 Error e g non existent LX number ERRNO VALUES ENODEV no such extent number or extent is reserved LIBRARY FS2 LIB SEE ALSO fcreate FS2 Dynamic C Functions rabbit com 165 fs setup FS2 FSLXnum fs_setup FSLXnum 1xn word 1s shift int reserve it void rfu int partition it word part word part ls shift int part reserve void part
222. e called PARAMETERS p Address of costatement LIBRARY COSTATE LIB CoReset void CoReset CoData p DESCRIPTION Initializes a costatement structure so the costatement will not be executed next time itis encoun tered PARAMETERS p Address of costatement LIBRARY COSTATE LIB 38 rabbit com Dynamic C Functions CoResume void CoResume CoData p DESCRIPTION Resume execution of a costatement that has been paused PARAMETERS p Address of costatement LIBRARY COSTATE LIB Dynamic C Functions rabbit com 39 cos float cos float x DESCRIPTION Computes the cosine of real float value x Note The Dynamic C functions deg and rad convert radians and degrees PARAMETERS x Angle in radians RETURN VALUE Cosine of the argument LIBRARY MATH LIB SEE ALSO acos cosh sin tan cosh float cosh float x DESCRIPTION Computes the hyperbolic cosine of real float value x This functions takes a unitless number as a parameter and returns a unitless number PARAMETERS x Value to compute RETURN VALUE Hyperbolic cosine If Ixl gt 89 8 approx the function returns INF and signals a range error LIBRARY MATH LIB SEE ALSO cos acos sin sinh tan tanh 40 rabbit com Dynamic C Functions DecompressFile void DecompressFile ZFILE input ZFILE output DESCRIPTION This is the expansion routine for the LZSS algorithm It performs the opposit
223. e created by an ISR This function is similar to OSTaskCreate except that it allows additional information about a task to be specified PARAMETERS task pdata prio id stk_ size pext opt RETURN VALUE OS_NO ERR OS PRIO EXIT Pointer to task s code Pointer to optional data area used to pass parameters to the task at start of execution The task s unique priority number the lower the number the higher the pri ority The task s identification number 0 65535 Size of the stack in number of elements If OS_ STK is set to INT8U stk_size corresponds to the number of bytes available If OS_ STK is set to INT16U stk_size contains the number of 16 bit entries avail able Finally if OS_STKis set to INT32U stk_size contains the num ber of 32 bit entries available on the stack Pointer to a user supplied Task Control Block TCB extension The lower 8 bits are reserved by uC OS II The upper 8 bits control appli cation specific options Select an option by setting the corresponding bit s The call was successful Task priority already exists each task MUST have a unique priori ty OS PRIO INVALID The priority specified is higher than the maximum allowed LIBRARY UCOS2 LIB SEE ALSO OSTaskCreate i e 2 gt 0S LOWEST _PRIO Dynamic C Functions rabbit com OSTaskCreateHook void OSTaskCreateHook OS TCB ptcb DESCRIPTION Called by uC OS II whenever a task is created
224. e created on the current default extent s as specified by Ce ser Let Other behavior is the same as Fcreate PARAMETERS f Pointer to file descriptor to fill in RETURN VALUE gt 0 Success the FileNumber 1 255 of the new file 0 Failure ERRNO VALUE ENFILE No unused file number available LIBRARY fs2 LIB SEE ALSO fereate FS2 fs_set_l1x FS2 fdelete FS2 Dynamic C Functions rabbit com 129 fdelete FS1 int fdelete FileNumber fnum DESCRIPTION Deletes a file PARAMETERS fnum A number in the range 1 to 127 inclusive that identifies the file in the flash file system RETURN VALUE 0 Success 1 Failure LIBRARY FILESYSTEM LIB 130 rabbit com Dynamic C Functions fdelete FS2 int fdelete FileNumber name DESCRIPTION Delete the file with the given number The specified file must not be open The file number i e name is composed of two parts the low byte contains the actual file number and the high byte if not zero contains the metadata extent number of the file PARAMETERS name File number 1 to 255 inclusive RETURN VALUE 0 Success 0 Failure LIBRARY fs2 LIB ERRNO VALUES ENOENT File doesn t exist or metadata extent number doesn t match an existing file EBUSY File is open EIO I O error when releasing blocks occupied by this file SEE ALSO fcreate FS2 Dynamic C Functions rabbit com 131 fflush FS2 int ffl
225. e given must have been enumerated with fat_EnumDevice This function was introduced in FAT module version 2 06 Applications using prior versions of the FAT module would call fat_Unmount Partition instead PARAMETER dev Pointer to a FAT device structure to unmount RETURN VALUE 0 success EINVAL device structure dev is invalid EBUSY the device is busy Only if non blocking LIBRARY FAT LIB SEE ALSO fat EnumDevice fat AutoMount fat UnmountPartition Dynamic C Functions rabbit com 119 fat UnmountPartition int fat UnmountPartition fat part part DESCRIPTION Marks the enumerated partition as unmounted on both the FAT and the master boot record lev els The partition must have been already enumerated using Cat EnumPartition which happens when you call fat _AutoMount To unmount all FAT partitions on a device call fat_UnmountDevice a function intro duced with FAT version 2 06 It not only commits all cache entries to the device but also pre pares the device for power down or removal Note The partitions on a removable device must be unmounted in order to flush data before removal Failure to unmount a partition that has been written could cause damage to the FAT file system PARAMETERS part Pointer to a FAT partition structure to unmount RETURN VALUE 0 success EINVAL device or partition structure or pnum is invalid EBADPART the partition is not a FAT partitio
226. e inverse complex DFT of the N point complex spectrum contained in the array x and returns the complex result in x N must be a power of 2 and lie between 4 and 1024 An invalid N causes a RANGE exception The value of blockexp is increased by 1 each time array x has to be scaled to avoid arithmetic overflow The value of blockexp is also de creased by log gt N to include the 1 N factor in the definition of the inverse DFT PARAMETERS x Pointer to N element array of complex fractions N Number of complex elements in array x blockexp Pointer to integer block exponent LIBRARY FFT LIB SEE ALSO fftcplx fftreal fftrealinv hanncplx hannreal powerspectrum 134 rabbit com Dynamic C Functions fftreal void fftreal int x int N int blockexp DESCRIPTION Computes the N point positive frequency complex spectrum of the 2N point real sequence in array x The 2N point real sequence in array x is replaced with its N point positive frequency complex spectrum The value of blockexp is increased by 1 each time array x has to be scaled to avoid arithmetic overflow The imaginary part of the X 0 term stored in x 1 is set to the real part of the fmax term The 2N point real sequence is stored in natural order The zeroth element of the sequence is stored in x 0 the first element in x 1 and the kth element in x k N must be a power of 2 and lie between 4 and 1024 An invalid N causes a RANGE exception PARAMETERS x
227. e operation of CompressFile The input file a compressed ZFILE opened with OpenInputCompressedFile is decompressed to the output file an empty FS2 ZFILE opened with OpenOutput CompressedFile PARAMETERS input Input bit file output Output bit file RETURN VALUE None LIBRARY LZSS LIB Dynamic C Functions rabbit com 41 defineErrorHandler void defineErrorHandler void errfcn DESCRIPTION Sets the BIOS function pointer for runtime errors to the function pointed to by errfcn This user defined function must be in root memory Specify root at the start of the function defini tion to ensure this When a runtime error occurs the following information is passed to the error handler on the stack Stack Position Stack Contents SP 0 Return address for exceptionRet SP 2 Error code SP 4 0x0000 can be used for additional information SP 6 XPC when exception was called upper byte SP 8 Address where exception was called PARAMETERS errfcn Pointer to user defined run time error handler LIBRARY SYS LIB 42 rabbit com Dynamic C Functions deg float deg float x DESCRIPTION Changes float radians x to degrees PARAMETERS x Angle in radians RETURN VALUE Angle in degrees a float LIBRARY MATH LIB SEE ALSO rad Dynamic C Functions rabbit com 43 DelayMs int DelayMs long delayms DESCRIPTION Millisecond time mechanism for the costate
228. e return value The SPI semaphore is obtained before the command is sent The mode parameter controls whether the semaphore will be released after command execution and reply data reception If mode is zero both semaphore and chip select are active on a successful return An end com mand sequence and release of the semaphore must be handled by caller If mode is not 0 the semaphore will be released before returning In addition if mode is 2 then an SD card reset is in progress This enables the distinguishing of certain I O error conditions that would normally be grouped with the EIO error code and instead return the EAGAIN error code indicating reset retries should continue PARAMETER sd Pointer to sd_ device structure of the SD card cmd reply Pointer to cmd_reply structure which contains cmd command to be executed argument arguments for the command reply storage for command reply reply_size size in bytes of expected reply data_size size in bytes of expected data tx_buffer pointer to TX buffer to use rx_buffer pointer to RX buffer to use mode One of the following 0 SPI port semaphore should be retained 1 If SPI port to be released before return 2 Attempting SD card reset otherwise same as mode 1 Enables EAGAIN return value Dynamic C Functions rabbit com 423 sdspi process command cont d RETURN VALUE 0 Success EIO I O error EAGAIN Allowable I O error during card reset
229. e sent OS ERR EVENT TYPE Attempting to post to a non mailbox OS ERR PEVENT NULL If pevent is a null pointer o ERR POST NULL PTR If you are attempting to post a null pointer LIBRARY OS MBOX C Prior to DC 8 UCOS2 LIB SEE ALSO OSMboxAccept OSMboxCreate OSMboxPend OSMboxQuery Dynamic C Functions rabbit com 271 OSMboxPostOpt INT8U OSMboxPostOpt OS EVENT pevent void msg INT8U opt DESCRIPTION This function sends a message to a mailbox Note Interrupts can be disabled for a long time if you do a broadcast The interrupt dis able time is proportional to the number of tasks waiting on the mailbox PARAMETERS pevent Pointer to mailbox s event control block msg Pointer to the message to send A null pointer must not be sent opt Determines the type of POST performed e OS POST OPT NONE POST to a single waiting task Identical to OS MboxPost e OS POST OPT BROADCAST POST to ALL tasks that are waiting on the mailbox RETURN VALUE OS NO ERR The call was successful and the message was sent OS MBOX FULL The mailbox already contains a message Only one message at a time can be sent and thus the message MUST be consumed be fore another can be sent OS ERR EVENT TYPE Attempting to post to a non mailbox OS ERR PEVENT NULL If pevent is a null pointer o ERR POST NULL PTR If you are attempting to post a null pointer LIBRARY OS MBOX C Prior to DC 8 UCOS2 LIB 272 rabbit com Dyn
230. e system space malloc memory The _REGBUF_SIZE macro defaults to 1025 bytes but you may override this definition before use registry lib Registry resources are similar to Windows ini file format They are ASCII formatted and thus human readable and consist of one or more sections each of which has zero or more key value lines For example net settings ip 10 10 6 100 ssid Rabbit app settings some integer 23 a string hello world Each section is headed by a string enclosed in square brackets Within each section is a list of key strings followed by followed by the value of that entry The key string is arbitrary except that it cannot start with or contain any null or newline characters The value string is ar bitrary except that newline and null characters are not allowed Section names are arbitrary ex cept they cannot contain null or newline characters Spaces are always significant In particular don t put spaces on either side of the separator If there are duplicate keys in the entries table then it is undefined which of the entries actually gets stored Don t do it Normally you do not need to be concerned with the above format rules since the library func tions enforce them Dynamic C Functions rabbit com 407 registry write cont d If you need to store null binary zero or newline binary OxOA or in C syntax n then your application will need to use some sort of conve
231. e timer B clocked by PCLK 2 is then enabled A run time error occurs if parameter s are invalid and also this function is not reentrant Note This function does not attempt to manage interrupts that are associated with timers A or B that work is left entirely up to the application PARAMETERS requestor The requestor of the TATIR resource Use exactly one of the following macros to specify the appropriate requestor es TATIR_A1TIMER_REQ e g direct use of Timer A1 e TATIR A2TI e TAT1IR A3TIMER_REOQ e g use by serial port F MER REQ e g use by serial port E M e TATIR A4TIMER_REOQ e g use by serial port A M M bi e TATIR ASTI e DATIR A6TIMER_REQ e g use by serial port C e TAT1LR_A7TIMER_REOQ e g use by serial port D e TAT1R BTIMER_ REQ eg use with PWM servo or triac R_REQ e g use by serial port B value Either the new TAT IR setting value 0 to 255 inclusive or the macro TAT1R_RELEASE_ REQ to release the TATIR resource in use by the specified requestor RETURN VALUE The new or current TATIR setting The caller should check their requested new TATIR value against this return value If the two values are not the same the caller may decide the return val ue is acceptable after all and make another request using the previous return value A valid re lease request always succeeds in this case there is no need for the caller to check the return value LIBRARY sys lib
232. e will not be initialized a second time PARAMETERS pnum Partition number to mount 0 3 driver Pointer to the driver structure to fill in dev Pointer to the device structure to fill in part Pointer to the partition structure to fill in norecovery Boolean flag set to True to ignore power recovery data True is any value except zero RETURN VALUE 0 success EIO device I O error EINVAL pnum driver or device or part is invalid EUNFORMAT the device is not formatted EBADPART the partition requested is not a valid FAT partition ENOPART no partitions exist on the device EBUSY the device is busy Only if non blocking LIBRARY FAT LIB SEE ALSO fat AutoMount fat _EnumDevice fat _EnumPartition fat MountPartition Dynamic C Functions rabbit com 95 fat InitUCOSMutex void fat InitUCOSMutex int mutexPriority DESCRIPTION This function was introduced in FAT version 2 10 Prior versions of the FATfile system are com patible with uC OS II only if FAT API calls are confined to one uC OS II task The FAT API is not reentrant from multiple tasks without the changes made in FAT version 2 10 If you wish to use the FAT file system from multiple uC COS tasks you must do the following 1 The statement define FAT USE UCOS_ MUTEX must come before the statement use FAT LIB 2 After calling OSInit and before starting any tasks that use the FAT call fat _InitUCOSMutex mutexPriority The parameter mu
233. ebouncing interval is done e g waitfor rc nf XD Detect 1 EAGAIN EAGAIN will be returned until done RETURN VALUE gt 0 The ID that was found on the device and in the table EBUSY NAND flash device is busy ENODEV No device found EAGAIN if debounceMode equals 2 then not done debouncing try again LIBRARY NFLASH FAT LIB Dynamic C Functions rabbit com 255 OpenInputCompressedFile int OpenInputCompressedFile ZFILE ifp long fn DESCRIPTION Opens a file for input This function sets up the LZ compression algorithm window associated with the ZFILE file The second parameter is the file handle FS2 or address zimport of the input file to be opened If the file is already compressed after calling this function the file can be decompressed by calling ReadCompressedFile If the file handle points to an uncompressed FS2 file after calling this function the resulting ZFILE file can be compressed by calling CompressFile The INPUT_COMPRESSION_ BUFFERS macro controls the memory allocated by this func tion It defaults to 1 PARAMETERS ifp ZFILE file descriptor fn Address or handle of input file RETURN VALUE 0 Failure 1 Success LIBRARY LZSS LIB SEE ALSO CloseInputCompressedFile CompressFile ReadCompressedFile 256 rabbit com Dynamic C Functions OpenOutputCompressedFile int OpenOutputCompressedFile ZFILE ofp int fn DESCRIPTION Open an FS2 file for compressed ou
234. eceive When serXdmaOn is called a continuous chain of DMA transfers begins sending any data received on the serial line to the circular buffer With flowcontrol on there is an interrupt after each segment of the data transfer At that point if receiving another segment would overwrite data the RTSoff function is called For more information see the description at the beginning of RS232 LIB PARAMETERS tcmask Channel mask for DMA transmit Use DMA_CHANNEL_ANY to choose any available channel remask Channel mask for DMA receive Use DMA_CHANNEL_ANY to choose any available channel RETURN VALUE DMA error code or 0 for success LIBRARY RS232 LIB SEE ALSO serxdmaOff 450 rabbit com Dynamic C Functions serXflowcontrolOfEt void serXflowcontrolOff void where X is A F DESCRIPTION Turns off hardware flow control for serial port X A call to serXopen must be made before calling this function This function is non reentrant The functions serEf lowcontrolOff and serFflowcontrolOff may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXflowcontrolOff int port where port is one of the macros SER_PORT A through SER_PORT E LIBRARY RS232 LIB Dynamic C Functions rabbit com 451 serxXf
235. ecesssssssececeeeceesensaeeeeees 29 AESinitStream4x4 o cceeeseessseseseesseseeseseeeseees 9 CGE E 30 DEE Eet e 10 COF_SErAgEtC pine eeegeeeEgCekEEdeEEeEgkee 31 SEU 10 GET 32 ARAM eeh 11 COE SEAS DUNC sazacanntednecnaspvoeceees iacexapivneceesmurenee 33 Atan ar eoa r EO 12 COF_SETAPUES ssseeceessssseeeesesseseessseeeeesseees 34 EE 13 cof_serAread EEN 35 Srel 14 COF_SCTAWTILC ENEE 36 EE 15 cof serBgete iinjaincovnenealanenestovegnenesenersoeevaiaiante 31 cof SerBpelS goresen e p a TEE 32 B Cof serbpute cccccccccccecsssessnececececeesersaeeesees 33 Eer e ft eege A GE 16 col_setBread WEEN 35 BitRdPortE EES Ts EE EENEG 19 OE SEE BEL beeen nba etic eens cegedaiias 3 BitWrPortE ossis a ee 3 BitW Portl 21 EE TEE 33 REENEN Cof SELCPUTS Aender ed ees Ek Cc cof serCread EE 35 cof_serCwrite ssssssssssesesrsssresseresreesreesrssesess 36 CalculateECC256 ccccsssseeeessseeeeecsseeeeessenes 22 cof _serDgete EE 31 COM NEE 24 cof_serDgets SE Eege 32 CHKCorrectECC256 0 seesseeeeeesseeeecsseeeeeseenes 23 E TE 33 Chk HardReset seccccsssseeesssseeececssseeeesseees 25 En TEE 34 Dynamic C Functions rabbit com v REES eneen eegen tenn sceietdssexs seaccensete ER errlogFormatEntry cccesessessecececeeeeeseeneeaeees 71 cof_serDwrite EEN 36 errlogFormatRegDump s ssccceceeeeeseeneaeees 712 cof ser EE 31 errlogFormatStackDump scccccceeeeeseenereeees 12 COF_SCrE Sets 2 sssc cessedssscac
236. ed to retain 24 bit precision PARAMETERS which Servo 0 or 1 millirpm Input in units of 1 1000 RPM RETURN VALUE Output in units suitable for command velocity setting i e units of 1 65536 encoder counts per ISR execution sample LIBRARY SERVO LIB SEE ALSO servo move Co servo set vel servo Set pos 438 rabbit com Dynamic C Functions servo move to int servo move Col int which long pos long ticks long accel ticks long final v DESCRIPTION Move to new position pos Assumes current position is cmd and current velocity is vemd with the values of these read from the control structure at beginning of routine Each tick represents the time interval between loop updates This routine measures time in tervals in units of ticks accel_ticks lt ticks is the number of ticks allocated to acceleration deceleration phase of movement The remaining part of the movement is performed at constant velocity Acceleration and deceleration are computed to be of the same magnitude at beginning and end of motion but may be opposite signs final_v is the velocity to be achieved at end of movement This routine returns as soon as the necessary command list is installed for execution by the ISR The move ment will not be completed until ticks ISR executions NB if the average velocity vt required to complete the movement is greater than 16k counts per tick then the movement is stretched to a longer
237. effs cccecescesecccescecessccusecceeeces 443 SPIWrite cceccccseccccsscccsscceescecaseccascccessces 493 SCTVO_S t_POS ssscsssesesesesesesesesesesesesenesenens 444 SPI WIRG kasten gesteet Beefert se ien eg A 494 SCTVO_SCt_VEl ccccceececcsssccsscccesceceseccuscceesnces 445 SPLINE su2dsevessseiesoaseusdivieieds edd deed 495 SCTVO Stats OSCE cecccesescesecccesceceseccasecceseees 445 EE 496 SELVO tOMQUE ss sssdesseds Eden 446 STAN eebe 496 SerXdatabits cccccccccceccessssseceesceecceussseeees 448 EE 497 serXdmaOff ccccccccceceesssssecceccceceeusesseeees 449 SICH deeg EENS 498 SerXdMaON cccsceeseeescseseeeseseseeesesesesesesees 450 EE 499 serXflowcontrolOff cscsessccececeeeeeeseseaeees 451 SCD i erse rres e E 500 serXflowcontrolOn sssssessssssessssesesereesssssseeee 452 SCD eea casa te Nea teasteesseetteasees 501 SEIX BUG Geteste 453 BEE 502 serXgetError ccccccecesssessensccececeesesseenenseess 454 aE eege 503 SerX DEENEN 456 SHEET 504 SCTXPCCK ENEE 457 SCD eee errer E E Oee 505 SEIN PUIG Zeene 458 SEITEN 506 E 459 EE 507 SEET Ee sii csrnieaeseieinngunn e 460 GE Goemaere e 508 serXrdFree essssssesreresesessestereresesseseereresese 460 SCDE ee 509 ser XrdU sed NEEN 461 SUS EE 510 ber Kreadoe ae ee E EAEE ERS 462 SSE eraa a E E EE S 511 SCLXWEFIUSH ccccccccceceeeessseccesececeeueeeseeces 463 SIMO ME 512 e EE 463 ALOI EE EPEE E eg 514 SELX WEITE eebe deeg 464 EE 515 SCTX
238. efore sending the data 0 255 This is used to implement protocol specific delays between packets RETURN VALUE 1 The packet is going to be transmitted 0 There is already a packet transmitting and the new packet was refused LIBRARY PACKET LIB Dynamic C Functions rabbit com 337 pktXsending int pktXsending void X is A F DESCRIPTION Tests if a packet is currently being sent on serial port X If pkt Xsending returns true the transmitter is busy and cannot accept another packet The functions pktEsending and pkt Fsending may be used with the Rabbit 3000 and Rabbit 4000 RETURN VALUE 1 A packet is being transmitted 0 Port X is idle ready for a new packet LIBRARY PACKET LIB pktXsetParity void pktXsetParity char mode X is A F DESCRIPTION Configures parity generation and checking Can also configure for 2 stop bits The functions pktEsetParity and pktFsetParity may be used with the Rabbit 3000 and Rabbit 4000 PARAMETERS mode Code for mode of parity bit e PKT_NOPARITY no parity bit 8N1 format default e PKT OPARITY odd parity 801 format e PKT_EPARITY even parity 8E1 format e PKT TWOSTOP an extra stop bit 8N2 format LIBRARY PACKET LIB 338 rabbit com Dynamic C Functions plast void plast Pool t p DESCRIPTION Get the last allocated element in a root pool The pool MUST be set to being a linked pool using pool link p lt non z
239. equency in Hz RETURN VALUE The actual frequency that was set This will be the closest possible match to the requested fre quency LIBRARY PWM LIB was in R3000 LIB prior to DC 10 368 rabbit com Dynamic C Functions pwm set int pwm set int channel int duty cycle int options DESCRIPTION Sets a duty cycle for one of the pulse width modulation PWM channels The duty cycle can be a value from 0 to 1024 where 0 is logic low the whole time and 1024 is logic high the whole time Option flags are used to enable features on an individual PWM channel Bit masks for these are e PWM SPREAD sets pulse spreading The duty cycle is spread over four separate pulses to increase the pulse frequency e PWM _OPENDRAIN sets the PWM output pin to be open drain instead of a normal push pull logic output This function is intended for use with the Rabbit 3000 and Rabbit 4000 PARAMETERS channel channel 0 to 3 duty cycle value from 0 to 1024 options combination of optional flags see above RETURN VALUE 0 Success 1 Error an invalid channel number is used 2 Error requested duty _cycle is invalid LIBRARY PWM LIB was in R3000 LIB prior to DC 10 Dynamic C Functions rabbit com 369 pxalloc long pxalloc Pool t p DESCRIPTION Return next available free element from the given pool Eventually your application should re turn this element to the pool using pfree to avoid memory leaks
240. er e Current element address in DE register See pprev for fuller descrip tion RETURN VALUE C flag set HL 0 There are no more elements C flag clear NC HL points to previous element LIBRARY POOL LIB SEE ALSO pool init pool link palloc pprev 356 rabbit com Dynamic C Functions pputlast void pputlast Pool t p void e DESCRIPTION Atomically remove allocated element e and re insert it at the end of the allocated list Atom ically means that the POOL_ IPSET level is used to lock out other CPU contexts from altering the pool while this operation is in progress This is equivalent to pmovebetween p e plast p NULL but is considerably faster A common use for this function is to insert an element allocated when the POOL LINKED BY APP attribute is set for the pool at the end of the allocated list This is useful when say an ISR allocates and uses a buffer without placing it on the allocated list Only when the buffer is complete does the ISR use this function to place it on the queue for reading by the main application The pool MUST be set to being a linked pool by using pool link p lt non zero gt otherwise the results are undefined PARAMETERS P Pointer to pool handle structure as previously passed to pool_init e Address of element to move If NULL then this function behaves as plast RETURN VALUE Same as the e parameter unless e is NULL in which c
241. er blocks Note Portions of the User block may be used by the BIOS for your board to store values e g calibration constants See the manual for your particular board for more information before overwriting any part of the User block Note When using a board with serial bootflash e g RCM4300 RCM4310 writeUserBlockArray should be called until it returns zero or a negative error code A positive return value indicates that the SPI port needed by the serial flash is in use by another device However if using uC OS II and SPI USE UCOS MUTEX is defined then this function only needs to be called once If the mutex times out waiting for the SPI port to free up the run time error ERR_SPI_ MUTEX ERROR will occur See the description for _rcm43 InitUCOSMutex for more information on using uC OS II and SPI USE UCOS MUTEX Backwards Compatibility If the System ID block on the board doesn t support the User block or no System ID block is present then the 8K bytes starting 16K bytes from the top of the primary flash are designated User block area This only works if the flash type is small sector Rabbit manufactured boards with large sector flash will have valid System ID and User blocks so is not a problem on Rabbit boards If users create boards with large sector flash they must install System ID blocks version 3 or greater to use this function or modify this function Dynamic C Functions rabbit com 537 writeUserBlock
242. er is identical to s but the strings come from extended memory in stead of root memory xdata mystring Now is the time printf ls mystring Now is the time od signed decimal Width specifier 1 short values must not include 1 without 1 long values are treated as short Precision specifier n includes and if necessary treats argument as signed short n n 30000 printf d n 30000 printf 5 Sd n 30000 printf 6d n 30000 printf 4d n Jl ERRE unsigned short n n 40000 printf d n 25536 printf 6d n 25536 printf 7d n 25536 printf 5d n Ee long n n 300000 printf ld n 300000 printf 71d n 300000 Zou unsigned decimal Width specifier 1 long values must include 1 short values must not Precision specifier n includes if necessary treats argument as if it were unsigned short n n 25536 printf u n 40000 unsigned short n n 40000 printf d n 40000 Dynamic C Functions rabbit com 363 f float printf cont d Width specifier is ignored for Dynamic C float and double both 4 bytes Precision specifier n d n is the total width including and if n is zero or is omitted it is ignored and only d is used float f f 88 8888 printf f f printf S10f printf 9f f printf 0f EI printf 3 EI pr
243. er to a user routine RETURN VALUE 0 success EIO error in reading the device or structure EINVAL the partition number is invalid EPERM write access is not allowed EUNFORMAT the device is accessible but is not formatted EBADPART the partition is not a valid FAT partition EACCES the partition is currently mounted EBUSY the device is busy Only if non blocking LIBRARY FAT LIB SEE ALSO fat _AutoMount fat_Init fat _FormatDevice fat _EnumDevice fat PartitionDevice fat _EnumPartition 90 rabbit com Dynamic C Functions fat Free int fat Free fat part part DESCRIPTION This function returns the number of free clusters on the partition PARAMETERS part Handle to the partition RETURN VALUE Number of free clusters on success 0 partition handle is bad or partition is not mounted LIBRARY FAT LIB SEE ALSO fat _EnumPartition fat _MountPartition Dynamic C Functions rabbit com 91 fat GetAttr int fat GetAttr FATfile file DESCRIPTION This function gets the given attributes to the file Use the defined attribute flags to check the value e FATATTR_READ_ ONLY The file can not be modified e FATATTR_ HIDDEN The file is not visible when doing normal operations e FATATTR_SYSTEM This is a system file and should be left alone e FATATTR_VOLUME_ID This is the name of a logical disk e FATATTR DIRECTORY This is a directory and not a file e FATATTR ARC
244. er to the file to read from buf A pointer to the destination buffer len Number of bytes to copy RETURN VALUE Number of bytes read LIBRARY FILESYSTEM LIB 150 rabbit com Dynamic C Functions fread FS2 int fread File void buf int len DESCRIPTION Read data from the current position of the given file When the file is opened the current po sition is 0 meaning the start of the file Subsequent reads or writes advance the position by the number of bytes read or written fseek can also be used to position the read point If the application permits it is much more efficient to read multiple data bytes rather than read ing one by one PARAMETERS f Pointer to file descriptor initialized by fopen_rd fopen_wr or fcreate buf Data buffer located in root data memory or stack This must be dimen sioned with at least len bytes len Length of data to read 0 to 32767 inclusive RETURN VALUE len Success lt len Partial success Returns amount successfully read errno gives further details prob ably 0 meaning that end of file was encountered 0 Failure or Len was zero LIBRARY FS2 LIB ERRNO VALUES EBADFD File descriptor not opened EINVAL len less than zero 0 Success but len was zero or EOF was reached prior to reading len bytes EIO I O error SEE ALSO fseek FS2 fwrite FS2 Dynamic C Functions rabbit com 151 frexp float frexp float x int n D
245. eral or RST The offset into the vector table is also shown The following vectors are valid for all Rabbit processors Peripheral or RST vectNum Vector Table Offset Periodic interrupt 0x00 0x00 RST 10 instruction 0x02 0x20 RST 38 instruction 0x07 0x70 Slave Port 0x08 0x80 Timer A Ox0A OxAO Timer B 0x0B 0xBO Serial Port A 0x0C 0xCO0 Serial Port B 0x0D 0xDO Serial Port C OxOE OxEO Serial Port D OxOF OxFO The following vectors are valid starting with the Rabbit 3000 Peripheral or RST vectNum Vector Table Offset Input Capture Ox1A 0x01A0 Quadrature Encoder 0x19 0x0190 Serial port E 0x1C 0x01C0 Serial port F 0x1D 0x01D0 476 rabbit com Dynamic C Functions SetVectIntern cont d The following vectors are valid starting with the Rabbit 3000 Revision 1 Peripheral or RST vectNum Vector Table Offset Pulse Width Modulator 0x17 0x0170 Secondary Watchdog 0x01 0x10 The following vectors are valid starting with the Rabbit 4000 Peripheral or RST vectNum Vector Table Offset Timer C Ox1F 0x01F0O Network Port A Ox1E 0x01E0 The following three RSTs are included for completeness but should not be set by the user as they are used by Dynamic C Peripheral or RST vectNum Vector Table Offset RST 18 instruction 0x03 0x30 RST 20 instruction 0x04 0x40 RST 28 instruction 0x05 0x50 PARAMETERS
246. ero gt otherwise the results are undefined PARAMETERS p Pool handle structure as previously passed to pool_init RETURN VALUE null There are no allocated elements nul11 Pointer to last i e youngest allocated element LIBRARY POOL LIB SEE ALSO pool init pool link palloc pfree pfirst Dynamic C Functions rabbit com 339 plast fast xmem void plast fast Pool t p DESCRIPTION Get the last allocated element in a root pool The pool MUST be set to being a linked pool using pool link p lt non zero gt otherwise the results are undefined This is an assembler only version of plast Do not call this function from C Registers Parameter in IX Trashes F DE Return value in HL carry flag Example ld ix my_pool lcall plast_ fast jr c no_elems HL points to last element PARAMETERS p Pool handle structure as previously passed to pool_init Pass this in IX register RETURN VALUE C flag set HL 0 there are no allocated elements C flag clear NC HL points to last element LIBRARY POOL LIB SEE ALSO pool init pool link plast pprev_ fast 340 rabbit com Dynamic C Functions pmovebetween void pmovebetween Pool t p void e void d void f DESCRIPTION Atomically remove allocated element e and re insert it between allocated elements d and f Atomically means that the POOL_IPSET level is used to lock out other CPU conte
247. ero re 385 cof_pktFsend E 30 Cof ser Eget eeh 31 Rabbit 4000 5000 Ea E 32 DMA AN 0G onesie ennei iaa 47 S A E 33 DMAcompleted E 48 E E 34 DMA handle 2 lait 2 2gesegrutesereietgesgeie cer 49 cof_serEread o ceeecccceeceecceeeesccseeesseseseees 35 DMAioeimem cceeecccceeeescceeeeesesseeees 50 COF_SETE WIE c c ssecccssssececesssecevsssscecoess 36 DMAI0i2MEM cececcceeseeceseeeeceseeeees 52 COF SOUP CIC eebe 31 DMAloadBufDesc sccrascasecnnaseaercarediecsvande 53 WOE SOLE gets sc cicsadse acosaiecesgedatnmizeesieess 32 DMAmatchSetup ccscssseccccsesssceessocsees 54 OF Eeer 33 RE 55 WOE EE emggegessbteoghegegg g istinita 34 DMAmem ioi EE 56 cof serFread eebe 35 DMAmem2mem ccccccceeeecceeeesseeeeeees 57 cof_serFwrite Ee 36 DMApoll EE 58 HDLCApOrtE E 186 DMAprintBufDesc ce eeeeeseeceeeseeeeee 59 GERT e 186 DMAprintRegs ccccccssceceeessteceessseeees 60 HDLCceloseE E 186 DMAsetBufDesc isccisscissesdecetscceeecsseeesees 61 HEC ClOSGP E 186 RA EE baccpcisstadectuasnarecesreaceacaees 62 ERT e 187 DMAsetParameters cceeesseeceeeseeeees 63 IGIRIE asc cisesevssiceenietncoexiasteversadiivs 187 DMAstart Auto siscsseccivcssancsvesdescevecsansedies 64 PI e 187 DMAstartDirect scscvecacgsscnicevesntetesssetees 65 GIRI e 187 DMASTOD EE 66 HDLCextClockE sisscisscstsccsendvassaiecaessecs 188 DMAstopDirect E 67 III e NEE 188 DMA timer Setup E 67 PE Coens geseet ereagEueg 189 DMA NA OG sicscscaseorcatavsrza
248. ersatenndeaniets 68 TID e 189 EE 412 IGIRIE e E 190 serAdmaOff eeeees geeg gear Deeg 449 HDLCpeekF E 190 SErA d MAON eege Egeter 450 HDLCreceiveE E 191 serBdmaOff WE 449 HDLcCreceiveF cnsacnerncnnaintmmties 191 serBdmaOn eeegeeiebeggtende Eeer 450 IDL Asn Es cacrsiciescesciriaeetandestacsarinateee 192 serCdmaOff ege 449 TUDE e EE 192 SER WMA c siyeasnsncsanveniecsasseteensdonaten 450 HDLCsendingE isadeceaceciptdacreaestaacenasaten IER GE EE 449 HDLCsendingF siccvaiceseveccneonssacdevessatiens 193 serDdmaOn e seeebarsgeeratigegenk Seenen eg 450 Dynamic C Functions rabbit com xxiii serEdmaOfe 00 2 ceeeceeeeeeecccceecccccceeceees 449 COf_SerCread e e ec eeeeeeccsseececcecececeenees 35 SCTEAMAON 450 cof_serCwrite oo eee eeceeeeececeeseececeenees 36 serPdmaOle seiten eege en 449 COP SEP Sete orsin 31 SCrFAMAON 2 0 e cece eeeeeccesccccesceeseceeesees 450 COF_SerDgets ccccccceceeeseesesseeceeeeeenseees 32 serXdmaOff ooo cceeeceeeeececccceecececceeceees 449 EIER eelste 33 SerXdMaOn WEE 450 COF Ser Puts deisseveteisad Astniiadve 34 MES EENS 528 cof serDread ANA 35 cof_serDwrite esssssssseesessssssssesrerressss 36 real time Clock Cof serEgete ege see 31 ENER eege ee 242 RE be 32 EE ebe 243 SOE SE eenegen 33 read TUS erroe 392 BEE E 34 read_rte_32KHZ en 392 cof_serEread esssssssseesessssssssesrerrsssss 35 e Hmerone EE 414 COL_SCTEWTite oe c eee cceeeeeececcccceceenseeeeeees 36 a a al CON SerP rete sectnai
249. erverContext struct E g from http_getContext RETURN VALUE lt 0 General failure code will be negative of one of the codes in ERRNO LIB 0 there is currently no resource of the given name This is not necessarily an error since it will be returned if the registry has not yet been created 1 2 3 An existing presumed non corrupt resource has been opened The numeric return code indicates which of the extensions was located LIBRARY register lib SEE ALSO registry read registry finish read registry prep write registry write registry finish write registry enumerate registry update registry get 402 rabbit com Dynamic C Functions registry prep write int registry prep write RegistryContext r char basename ServerContext context DESCRIPTION Prepare for updating a registry This function helps organize registry resources in order to create a robust registry Most applications will use the sequence of functions registry prep write registry write registry finish write or more simply just registry update See the function description for registry prep read for details concerning the orga nization of registry files Like registry prep read this function opens an existing presumed non corrupt reg istry for reading and also a new empty registry the next registry for writing the updated es ults as required by registry write PARAMETERS r RegistryContext struct This is
250. esceeeceesees 550 fat_FormatPartition cccccceeeeeeees 90 XMeEM2XMemM Zeie 551 fat Fr Geet 91 memcht sessrsrirsririssrsniisssnesiis 552 fat_GetAttr ccccccccccceseseesseesseesssesees 92 RUMCHUCHIN sirsie riiai aaa 553 E e 93 TEE test eebe ee 554 fat_GetPartition ccccceeececececeeeeseeeeeee 94 xsetfloat eeeeeessessrersressresssessse 555 fat Init eege onanan 95 XSCUINE ccessessesrersccscssessssseorensecssesense 555 fat_InitUCOSMutex cccccccccceceeeeeneees 96 REES 556 fat Is losed ee en niaire 97 Xstrlei pnns 556 fat SOc tege 98 fat_LastAccess wiccccccccccssssssecccccceessesseeeees 99 j fat_LastWrite sseessssessesssssssseeeerresse 100 Fast Fourier Transforms fat_MountPartition eee 101 iTO o e 133 fat Open sssscsssssssscsseesssssesossessssnesees 102 RRE sj casadaraanevupvadsaniavadiecviacsmeannees 134 fat OpenDir EEN 104 E 135 fat_PartitionDeVice een 105 fftrealiny egene Eege ates 136 fat_Read neess 106 ee IL sierctssvaaacpatcantetcenaecoatettsw nee 184 fat_ReadDIr ccsseccsssscssssseteseeeesees 107 hannreal gege 185 Tat ech une 109 POWEFSPeCtTUM oo eeeeeeseseeseseeeeseeeeeeeees 354 SEHR 111 Dynamic C Functions rabbit com xvii fat Split sreinge 112 8 OCU KE 161 ER GET 113 EE 162 fat SynePile sisiiesiettesiietai ass Beanies 114 fs pet other 1x E 163 fat_SyncPartition cccceseesssseeeeeeees 115 fs pel ram IX cceececeeseessensneeeeeeeeess 164 fat KC TE 116 E EE 15
251. esults are undefined You can easily iterate through all of the allocated elements of a root pool using the following construct void e Pool t p for e pfirst p e e pnext p e PARAMETERS p Pool handle structure as previously passed to pool_init e Previous element address obtained by e g pfirst This must be an allocated element in the given pool otherwise the results are undefined Be careful when iterating through a list and deleting elements using pfree once the element is deleted it is no longer valid to pass its ad dress to this function If this parameter is null then the result is the same as pfirst This en sures the invariant pnext p pprev p eil e RETURN VALUE null There are no more elements null Pointer to next allocated element LIBRARY POOL LIB SEE ALSO pool init pool link palloc pfree pfirst pprev Dynamic C Functions rabbit com 345 pnext fast xmem void pnext fast Pool t p void e DESCRIPTION Get the next allocated element in a root pool The pool MUST be set to being a linked pool using pool link p lt non zero gt otherwise the results are undefined This is an assembler only version of pnext Do not call this function from C Registers Parameters in IX DE respectively Trashes F DE Return value in HL carry flag Example ld ix my_ pool ld de current element lcall pnext fast jr c no_ more elems HL po
252. f a string For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_ STRING macro is de fined and all pointers are near pointers append np to the function name e g n_ strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS s Character string RETURN VALUE Number of bytes in a string LIBRARY STRING LIB Dynamic C Functions rabbit com 503 strncat NEAR SYNTAX char ro strncat char dst char src unsigned int n FAR SYNTAX char far f strncat char far dst char far src size tn Note By default strncat is definedto n strncat DESCRIPTION Appends one string to another up to and including the null terminator or until n characters are transferred followed by a null terminator For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far
253. f the LX in bytes LIBRARY FS2 1lib 162 rabbit com Dynamic C Functions fs get other 1x FS2 FSLXnum fs get other 1x void DESCRIPTION Returns the logical extent number of the non preferred flash device If it exists this is usually the program flash See the description under Ca get flash _1x for details about setting up the program flash for use by the filesystem The sample program Samples FILESYSTEM FS2INFO C demonstrates use of this func tion This function may be called before calling fs init RETURN VALUE 0 There is no other flash filesystem available 0 Logical extent number of the non preferred flash LIBRARY FS2 LIB SEE ALSO fe get ram lx FS2 fs get flash lx F32 Dynamic C Functions rabbit com 163 fs get ram 1x FS2 FSLXnum fs get ram 1x void DESCRIPTION Return the logical extent number of the RAM file system device This is only available if you have defined FS2_ RAM RESERVE to a non zero number of bytes in the BIOS A RAM filesystem is only really useful if you have battery backed SRAM on the board You can still use a RAM file system on volatile RAM but of course files will not persist over power cycles and you should explicitly format the RAM filesystem at power up The sample program Samples FILESYSTEM FS2INFO C demonstrates use of this func tion This function may be called before calling fs init RETURN VALUE 0 There is no RAM filesystem availabl
254. f_isBusyStatus sesse 252 EE 131 f TOBE AG ed Se iscnnssidsatecsstedecntulssceave 253 fl sh scseeecdsacencdeasessccssteeeedesavadectestecedsse 132 Nf_WYritePage cucsisinsates iersinii 254 fopen td csssevscdesceescccscsteccssseesecseaeeecdans 147 nf XD Detect oasriicsresiiirisiiiiiiiki 255 PCN oon oea 149 read 151 Flash Parallel fs format 154 flash_erasechip eheeeegeeege 137 fais t flash 1x 160 flash_erasesector eege deeg eege 138 ee flash_gettype secs dacupsadsssbagentasdosadaidesescere 139 xviii rabbit com Dynamic C Functions flash mit vecccssseeessaisceveseseccsteaeadcessdeveenes 140 sf_writeDeviceRAM ccccccceeecccce esses 486 flash read BE 141 sf_writePage eeeeeesesssesseseesessssesreesesse 487 flash_readsector cceeccccseeeecceeeeeeceees 142 sf _writeRAM eseessssssssseesssssessescesssssee 488 flash_sector2x window ccsscececeeeees 143 SESPL Init eh geed DEEN 488 flash_writesector srscsecssdcannsssordsasecdsaannes 144 KEE SES Floating Point Math eelste eegenen 533 COS geet de AE 2 ACOL Age EAR g 3 Flash SD EE 3 sdspi_debounce ssa sacciasgeedendaadivecesteaenoieas 415 Eege 10 SASpi_get_Csd o eeecsessessceeceeeeeeeseeees 416 ASU E 10 sdspi BO SET ege ENEE 417 EE 11 sdspi_get_status_reg s sscrscesdncosvinserworonse 418 CET 12 sdspi_getSectorCount 20 eeeeeeeeeeee 418 eege 24 sdspi_init_card seesssiesbtesiunsdaderaecatanaceeas 419 GCOS EE 40 sdspi_initDevice geed EeEeegeE 420 Eeer A0 Ge ENT 421 GLEE
255. ferred by the specified DMA channel Since DMA is asynchronous to the CPU this returns a lower bound on the actually completed transfer IMPORTANT Owing to the way the DMA channels are designed this function will not give a valid result for the first buffer in a linked list or chain or if there is only one buffer defined with no link or array sequencing To get around this lim itation define the first buffer as a dummy transfer of one byte from memory to the same memory and link this initial dummy buffer to the desired list or array of buffer descriptors Take the dummy buffer into account when interpreting the bufCount value returned If you service an interrupt from the dummy buffer completion you will know when it is valid to poll This function is mainly intended for endless DMA loops e g receiving into a cir cular buffer from a serial port thus the above restriction should not be too onerous in practice PARAMETERS dmaChannel DMA channel number to poll 0 7 bufCount Pointer to variable in which the completed buffer count will be written The return value contains the number of bytes remaining not yet transferred in this buffer The buffer count wraps around modulo 256 RETURN VALUE The number of bytes remaining in the buffer indicated by bufCount This ranges from 0 if completed up to the total size of the buffer if not yet started If the size of any single transfer was 65536 bytes then the return value is ambigu
256. float tan float x DESCRIPTION Compute the tangent of the argument Note The Dynamic C functions deg and rad convert radians and degrees PARAMETERS x Angle in radians RETURN VALUE Returns the tangent of x where 8 x PIS x lt 8 x PI If x is out of bounds the function returns 0 and signals a domain error If the value of x is too close to a multiple of 90 PI 2 the function returns INF and signals a range error LIBRARY MATH LIB SEE ALSO atan cos sin tanh 518 rabbit com Dynamic C Functions tanh float tanh float x DESCRIPTION Computes the hyperbolic tangent of argument This functions takes a unitless number as a pa rameter and returns a unitless number PARAMETERS x Float to use in computation RETURN VALUE Returns the hyperbolic tangent of x If x gt 49 9 approx the function returns INF and signals a range error If x lt 49 9 approx the function returns INF and signals a range error LIBRARY MATH LIB SEE ALSO atan cosh sinh tan Dynamic C Functions rabbit com 519 TAT1R SetValue char TAT1R SetValue int requestor int value DESCRIPTION If not already in use or if in a compatible use allocates the TAT1R resource sets a new or keeps the current TATIR value as requested Also enables or disables the requestor s timer Al cas cade bit s in TACR or TBCR as appropriate When the timer B cascade from timer A1 is dis abled in TBCR th
257. fredd EEN 150 HDLCopenF dee 189 fread FS2 seiiet arisi e HDLCpeekE eebe 190 EE HDLCpeekF ccccccccccecececececccececccccececescece 190 fs format EE 153 HDLCreceivel EE fs Tomat F52 enen 154 HDLCreceiveF ccecccssecccsecccsceceeccensecees P get flash 1x FS2 sosssrccasnseaysienseenssnsas caterer 160 ILC EEN 192 fs Bet Ix FS2 senesan 161 HDLCsendF ayicis sasecavczssgacsasienectecisiecieisterniat 192 fs_get_ x_size FS2 EE 162 HDLCsendingE egeeegeetrieteeegei ieee eien 193 iS pet other 1k FS2 cysnsasiestacuanaaterasatecazatezes 163 HDLCsendingF ses fsa ch ss dactnnapeccleacadecdestaxdetts 193 Te geet rom JI FS2 eeeeeeesecececeseeeeeeeeeeeeeees 164 hexstitobyte ue cbetavsnesl iesti r a rra 193 fs_init FS1 eessssssesseessrsssssseeeerrssssesereeersenese e S rte EE 194 fa mt FS2 ann POA EET A EE deed 194 fs_reserve_blocks FS1 cccccccceccessesseeeeeeees 157 fs_set Ix FS2 eieiei 165 I fs set p FS2 EE 166 E EE 168 E sci ees SE ESCK E 157 reas ES i2c_read_char saecicdsavecluddeateacdenvectdedeanseeceeseece 207 fseek d E REN 158 120 SONG ACK ic dor sewseineasceteitieecseneedusestescassorteies 208 fseek FSZ ctevecedseeiedeccdeees ccneduvsesceeveeeneneivess 159 EEN 171 gga ee e ftell FS1 sossnvsnsedevousanbiaile esisuoptotonteneatuasies 169 T E enaa i m TEEN Im AC RATIOS ee Oe 175 Ee SC EE SE o Go Jnterealkle tege eg rnrn nape ianei a rS 195 P pee se IntervalSec e LOS Triterval Tick un sets
258. from this pool or was already free or was outside the pool then your application will crash You can detect most of these programming errors by defining the following symbols before use pool lib POOL_DEBUG POOL VERBOSE PARAMETERS p Pool handle structure as previously passed to pxalloc e Element to free which was returned from pxalloc RETURN VALUE nul1 There are no more elements nul1 Pointer to previous allocated element LIBRARY POOL LIB SEE ALSO pool xinit pxalloc pxcalloc phwm pavail Dynamic C Functions rabbit com 375 pxfree fast xmem void pxfree fast Pool t p long e DESCRIPTION Free an element that was previously obtained via pxalloc This is an assembler only ver sion of pxfree Do not call this function from C pxfree fast does not perform any IPSET protection or parameter validation pxfree fast is an xmem function The parameters must be passed in machine registers Registers Parameters in IX BCDE respectively Trashes AF BC DE HL Example ld ix my_pool ld de element addr ld bc element _addr 2 lcall pxfree fast PARAMETERS p Pool handle structure as previously passed to palloc or palloc_fast This must be in the IX register e Element to free which was returned from palloc This must be in the BCDE register physical address RETURN VALUE null There are no more elements nul1 Pointer to previous allocated element LIBRARY P
259. from xmem PARAMETERS src mem linear address of the integer value to retrieve RETURN VALUE Integer value 2 bytes at src LIBRARY XMEM LIB 548 rabbit com Dynamic C Functions xgetlong long xgetlong long src DESCRIPTION Return the long word pointed to by src This is the most efficient function for obtaining 4 bytes from xmem PARAMETERS sre mem linear address of the long value to retrieve RETURN VALUE Long integer value 4 bytes at src LIBRARY XMEM LIB Dynamic C Functions rabbit com 549 xmem2root int xmem2root void dest unsigned long int src unsigned int len DESCRIPTION Stores len characters from physical address src to logical address dest PARAMETERS dest Logical address sre Physical address len Numbers of bytes RETURN VALUE 0 Success 1 Attempt to write flash memory area nothing written 2 Destination not all in root LIBRARY XMEM LIB SEE ALSO root2xmem xalloc 550 rabbit com Dynamic C Functions xmem2xmem int xmem2xmem unsigned long dest unsigned long src unsigned len DESCRIPTION Stores len characters from physical address src to physical address dest PARAMETERS dest Physical address of destination sre Physical address of source data len Length of source data in bytes RETURN VALUE 0 Success 1 Attempt to write flash memory area nothing written LIBRARY XMEM LIB Dynamic C Functions rabbit com 551 xmemch
260. g with Dynamic C 8 a run time exception will occur if the function fails LIBRARY STACK LIB SEE ALSO root2xmem xmem2root xavail Dynamic C Functions rabbit com 541 _xalloc long xalloc long sz word align word type DESCRIPTION Allocates memory in extended memory If xalloc fails a runtime error will occur PARAMETERS SZ On entry pointer to the number of bytes to allocate On return the pointed to value will be updated with the actual number of bytes allocated This may be larger than requested if an odd number of bytes was requested or if some space was wasted at the end because of alignment restrictions align Storage alignment as the log base 2 of the desired returned memory start ing address For example if this parameter is 8 then the returned address will align on a 256 byte boundary Values between 0 and 16 inclusive are allowed Any other value is treated as zero i e no required alignment type This parameter is only meaningful on boards with more than one type of RAM For example boards with a fast RAM and a slower battery backed RAM like the RCM3200 or RCM3300 Use one of the following values any other value will have undefined results e XALLOC_ ANY 0 any type of SRAM storage allowed e XALLOC_BB 1 must be battery backed program execution SRAM a k a fast RAM e XALLOC_NOTBB 2 return non BB SRAM only e XALLOC_MAYBBB 3 return non BB SRAM in preference to BB
261. gment logical pointer into its physical address This function assumes the pointer points to static excluding bbram data which eliminates some runtime testing as compared with the more general function paddr paddrDS will generate incorrect results if used for e addresses in the root code that is program code or constants e bbram only available in fast RAM compile mode e stack that is auto variables xmem segments PARAMETERS pointer Logical static non bbram data pointer to convert RETURN VALUE The physical address of the pointer LIBRARY XMEM LIB SEE ALSO paddr paddrSs 320 rabbit com Dynamic C Functions paddrss unsigned long paddrSS void pointer DESCRIPTION Convert a logical pointer into its physical address This function assumes the pointer points to data in the stack segment which eliminates some runtime testing compared with the more gen eral function paddr The stack segment is used to store auto data items This function will generate incorrect results if used for addresses in the root code i e program code or con stants data i e statically allocated variables or xmem segments PARAMETERS pointer The pointer to convert pointing to stack auto data RETURN VALUE The physical address of the pointer LIBRARY XMEM LIB SEE ALSO paddr paddrDs Dynamic C Functions rabbit com 321 palloc void palloc Pool t p DESCRIPTION Return next availa
262. gnificant 16 bits replace the imaginary part of the component its less significant 16 bits replace the real part If the complex input spectrum is a positive frequency spectrum computed by fftreal the imaginary part of the X 0 term stored x 1 will contain the real part of the fmax term and will affect the calculation of the dc power If the dc power or the fmax power is important the fmax term should be retrieved from x 1 and x 1 set to zero before calling powerspectrum The power of the kth term can be retrieved via P k long amp x 2k 2 blockexp The value of blockexp is first doubled to reflect the squaring operation applied to all ele ments in array x Then it is further increased by 1 to reflect an inherent division by two that oc curs during the squaring operation PARAMETERS x Pointer to N element array of complex fractions N Number of complex elements in array x blockexp Pointer to integer block exponent LIBRARY FFT LIB SEE ALSO fftceplx fftcplxinv fftreal fftrealinv hanncplx hannreal 354 rabbit com Dynamic C Functions pprev void pprev Pool t p void e DESCRIPTION Get the previously allocated element in a root pool The pool MUST be set to being a linked pool using pool link p lt non zero gt otherwise the results are undefined You can easily iterate through all of the allocated elements of a root pool using the following construct void e Pool t p
263. hange to RETURN VALUE OS MO ERR The call was successful OS PRIO INVALID The priority specified is higher that the maximum allowed i e OS LOWEST PRIO OS PRIO EXIST The new priority already exist OS PRIO ERR There is no task with the specified OLD priority i e the OLD task does not exist LIBRARY UCOS2 LIB Dynamic C Functions rabbit com 299 OSTaskCreate INT8U OSTaskCreate void task void pdata INT16U stk size INT8U prio DESCRIPTION Creates a task to be managed by uC OS II Tasks can either be created prior to the start of mul titasking or by a running task A task cannot be created by an ISR PARAMETERS task Pointer to the task s starting address pdata Pointer to a task s initial parameters stk size Number of bytes of the stack prior The task s unique priority number RETURN VALUE OS NO ERR The call was successful OS PRIO EXIT OS PRIO INVALID LIBRARY UCOS2 LIB SEE ALSO OSTaskCreateExt Task priority already exists each task MUST have a unique priori ty The priority specified is higher than the maximum allowed i e OS LOWEST PRIO 300 rabbit com Dynamic C Functions OSTaskCreateExt INT8U OSTaskCreateExt void task void pdata INT8U prio INT16U id INT16U stk size void pext INT16U opt DESCRIPTION Creates a task to be managed by uC OS II Tasks can either be created prior to the start of mul titasking or by a running task A task cannot b
264. he 3 LSBs of the long i e BCDE result Note that the MSB i e B of the long result is always zero LIBRARY ECC LIB This function was introduced in Dynamic C 9 01 546 rabbit com Dynamic C Functions xChkCorrectECC256 int xChkCorrectECC256 unsigned long data void old ecc void new ecc DESCRIPTION Checks the old versus new ECC values for a 256 byte 2048 bit data buffer and if necessary and possible 1 bit correction 2 bit detection corrects the data in the specified extended mem ory buffer PARAMETERS data Physical address of the 256 byte data buffer old ecc Pointer to the old original 3 byte ECC s buffer new ecc Pointer to the new current 3 byte ECC s buffer RETURN VALUE 0 Data and ECC are good no correction is necessary 1 Data is corrected and ECC is good 2 Data is good and ECC is corrected 3 Data and or ECC are bad and uncorrectable LIBRARY ECC LIB This function was introduced in Dynamic C 9 01 Dynamic C Functions rabbit com 547 xgetfloat float xgetfloat long src DESCRIPTION Returns the f loat pointed to by src This is the most efficient function for obtaining 4 bytes from xmem PARAMETERS src xmem linear address of the float value to retrieve RETURN VALUE float value 4 bytes at src LIBRARY XMEM LIB xgetint int xgetint long src DESCRIPTION Returns the integer pointed to by src This is the most efficient function for obtaining 2 bytes
265. he number of blocks that the file system contains By default the block size is 4096 bytes RETURN VALUE 0 Success 1 Failure LIBRARY FILESYSTEM LIB Dynamic C Functions rabbit com 155 fs init FS2 int fs init long reserveblocks int num blocks DESCRIPTION Initialize the filesystem The static structure _f s contains information that defines the number and parameters associated with each extent or partition This function must be called before any of the other functions in this library except for Ca setup fs_ get _ 1x and fs get _ 1x size Pre main initialization will create up to 3 devices e The second flash device if available on the board e Battery backed SRAM if FS2_ RAM RESERVE defined e The first program flash if both XMEM_ RESERVE SIZE and FS2_ USE PROGRAM FLASH defined The LX numbers of the default devices can be obtained using the Ca get flash 1x fs_get_ram_1x andfs_get_other_1x calls If none of these devices can be set up successfully s init will return ENOSPC when called This function performs complete consistency checks and if necessary fixups for each LX It may take up to several seconds to run It should only be called once at application initialization time Note When using uC OS II fa init must be called before OSInit PARAMETERS reserveblocks Must be zero Retained for backward compatibility num blocks Ignored backward compatibilit
266. he range 1 to 127 inclusive that identifies the file in the flash file system RETURN VALUE 0 Success 1 Failure LIBRARY FILESYSTEM LIB 146 rabbit com Dynamic C Functions fopen rd FS2 int fopen _rd File f FileNumber name DESCRIPTION Open file for reading only See fopen_wr for a more detailed description PARAMETERS f Pointer to file descriptor uninitialized name File number 1 to 255 inclusive RETURN VALUE 0 Success 0 Failure ERRNO VALUES ENOENT File does not exist or metadata extent number does not match an existing file LIBRARY fs2 lib SEE ALSO fclose fopen_ wr FS2 Dynamic C Functions rabbit com 147 fopen wr FS1 int fopen wr File f FileNumber fnum Ir DESCRIPTION Opens a file for writing PARAMETERS f A pointer to the file to write fnum A number in the range 1 to 127 inclusive that identifies the file in the flash file system RETURN VALUE 0 Success 1 Failure LIBRARY FILESYSTEM LIB 148 rabbit com Dynamic C Functions fopen wr FS2 int fopen _wr File f FileNumber name DESCRIPTION Open file for read or write The given file number is composed of two parts the low byte con tains the file number 1 to 255 inclusive and the high byte if not zero contains the metadata extent number If the extent number is zero it defaults to the correct metadata extent this is for the purpose of validating an expected exten
267. heck for completion of the write operation using nf_isBusyRBHW or nf isBusyStatus PARAMETERS dev Pointer to an initialized nf device structure buffer Physical address of the xmem data to be written page Specifies the zero based number of a NAND flash page to be written rel ative to the first good page RETURN VALUE 0 Success or the first error result encountered 1 NAND flash device is busy 2 Block check time out error 3 Page is in a bad block 4 XMEM root memory transfer error 5 Erase block or program page operation error LIBRARY NFLASH LIB This function was introduced in Dynamic C 9 01 SEE ALSO CalculateECC256 ChkCorrectECC256 xCalculateECC256 xChkCorrectECC256 254 rabbit com Dynamic C Functions nf XD Detect long nf XD Detect int debounceMode DESCRIPTION This function attempts to read the xD card ID and searches the internal device table for that ID in detect mode 1 In detect mode 0 it just uses the xD card detect Assumes only one XD card present WARNING This should not be called to determine if it is safe to do write operations if there is a chance a removable device might be pulled between calling it and the write It is best used to determine if a device is present to proceed with an automount after a device has been un mounted in SW and removed PARAMETERS debounceMode 0 no debouncing 1 busy wait for debouncing interval 2 for use if function to be called until d
268. his is not done then their current position is effectively advanced by the num ber of characters shifted out by the fshift The purpose of this function is to make it easy to implement files which worm their way through the filesystem adding at the head and removing at the tail such that the total file size remains approximately constant Surprisingly it is possible for an out of space error to occur since the addition of the journaling meta data entry for the shift operation may cause an error before deleted blocks if any are made available PARAMETERS Pointer to file descriptor initialized by fopen_wr or fcreate len Length of data to remove 0 to 32767 inclusive buf Data buffer located in root data memory or stack This must be dimen sioned with at least 1en bytes This parameter may also be null if the de leted data is not needed Dynamic C Functions rabbit com 171 fshift cont d RETURN VALUE len Success lt len Partial success returns amount successfully deleted errno gives further details prob ably ENOSPC 0 Error or len was zero ERRNO VALUES EBADFD File descriptor not opened or is read only EINVAL len less than zero 0 Success but len was zero EIO I O error ENOSPC extent out of space EBUSY file opened more than once This is only possible if Foi SHIFT DOESNT UPDATE FPOS is not defined which is the default case LIBRARY FS2 LIB SEE ALSO fread FS
269. i pher encoded data This function is specific to AES with 128 bit key See AESexpandKey for a more general function available with Rabbit Embedded Security Pack PARAMETERS expanded key RETURN VALUE None LIBRARY AES CORE LIB A buffer for storing the expanded key The size of the expanded key for a 128 bit key is 176 bytes Other key sizes are not supported by this func tion Note when using an AESstreamState structure e g state then call this function using AESexpandKey4 state gt expanded key key The cipher key 16 bytes rabbit com Dynamic C Functions void AESinitStream4x4 AESstreamState far state AESinitStream4x4 char far key char far init vector DESCRIPTION Sets up a stream state structure to begin encrypting or decrypting a stream using AES with a 128 bit key and block size A particular stream state can only be used for one direction See Samples Crypt AES STREAMTEST C for a sample program and a detailed explanation of the encryption decryption process PARAMETERS state key init vector RETURN VALUE None LIBRARY AES CORE LIB An AESstreamState structure to be initialized This memory must be allocated in the program code before calling AESinitStream4x4 The 16 byte cipher key using a null pointer will prevent an existing key from being recalculated A 16 byte array representing the initial state of the feedback registers Both
270. i cation to call this function however if it is called regularly when the application has nothing else to do then file system performance may be improved RETURN VALUE Currently always 0 LIBRARY FATWTC LIB Dynamic C Functions rabbit com 117 fat Truncate int fat Truncate FATfile file long where DESCRIPTION Truncates the file at where and frees any left over allocated clusters The file must be a FAT FILE type PARAMETERS file Pointer to the open file to truncate where One of the following e 20 absolute byte to truncate the file The file is truncated at EOF if the absolute byte is beyond EOF s FAT BRK_END truncate at EOF s FAT BRK_ POS truncate at current file position RETURN VALUE 0 success EIO device I O error EINVAL file is invalid EPERM file is in use write protected hidden or system ENOENT the file does not exist ETYPE file is not a FAT file type EBUSY the device is busy Only if non blocking EFSTATE if file in inappropriate state Only if non blocking LIBRARY FAT LIB SEE ALSO fat Open fat OpenDir fat Delete fat Split 118 rabbit com Dynamic C Functions fat UnmountDevice int fat _UnmountDevice mbr dev dev DESCRIPTION Unmounts all FAT partitions on the given device and unregisters the device from the cache sys tem This commits all cache entries to the device and prepares the device for power down or removal The device structur
271. ick a E 311 KEE 336 OSTimeDIyHMSM ccececsecsececeeeeeeeeeenees 312 pktf send A E 337 OSTimeDlyResume cecseesececeeeeeeeeeesees 313 RE 338 OSTimeDIySec cccccceeeeeseessnsececeeeenseseesees 314 pktDsetParity cc cccccccceeeeesesectececeesensesees 338 OSTimeGet yerepe R 315 o DT E tiated iic ented 332 OSTimieSet iisssssaessccabestsseeeieatehiceadeacaveseaencas 315 pktEgetErrors s ceicsseciesscbiiesdesiascaviessseaderten sees 332 OSTime Tick szssesiczacenesessasastenssctavedaseasianaccees 316 pktEinitBuffers cc ccececeesssesseeceeeeeeesesees 333 OSTimeTickHook 0 cceceseessrsececeeeeeeeeeenees 316 pktE pen sritno eneinio ieii 334 OEA E 317 pktEreceive ENEE 336 QUIGHES T ETT 317 pktEsend sescnircmsinscsisi teisti enie oise kis 337 GUISE tee 318 DEES soere pi r Ers E EIRE 338 pPkiEsetParity EE 338 P ld 332 EE 319 Dee 332 paddrDS EE 320 De 333 EE 321 Deel 334 H 322 Dee 336 palloc faSt csscssiessias ssasscesscscsesacosscenncsastoescuses 323 pktFsend a EE 337 PRUPSCNGING scesecssceeccccseceresd cover tects ENNEN ERAN 338 EE 324 S GE EE 325 pktFsetParity ENEE 338 EEN 326 SIE 339 a plast fast sessioissa anii inienn 340 EE 327 pfirst fast sec ccses cis cdstnsdca EES EENS 328 PMOVEDELWEED ENEE 341 EEN 329 pmovebetween_ fast Een 343 Dynamic C Functions rabbit com ix POMEL sass A E E 344 readUserBlock ENEE 393 EE 345 readUserBlockArray cccceeeseeserseeeeeeeeeseseees 394 phext E 346 TEG
272. id SPIRead void DestAddr int ByteCount DESCRIPTION Reads a block of bytes from the SPI port The variable SPIxor needs to be set to either 0x00 or OxFF depending on whether or not the received signal needs to be inverted Most applications will not need inversion SPIinit sets the value of SPIxor to 0x00 If SPI_ SLAVE RDY_ PORT is defined for a slave device the driver will turn on the bit imme diately upon activating the receiver It will then wait for a byte to become available then turn off the bit The byte will not be available until the master supplies the 8 clock pulses If SPI_ SLAVE RDY_PORT is defined for a master device the driver will wait for the bit to become true before activating the receiver and then wait for it to become false after receiving the byte Note for Master the receiving device Chip Select must already be active PARAMETERS DestAddr Address to store the data ByteCount Number of bytes to read RETURN VALUE Master none Slave 0 no CS signal no received bytes 1 CS bytes received LIBRARY SPI LIB SEE ALSO SPIinit SPIWrite SPIWrRd 492 rabbit com Dynamic C Functions SPIWrite int SPIWrite void SrcAddr int ByteCount DESCRIPTION Write a block of bytes to the SPI port If SPI SLAVE RDY_ PORT is defined for a slave device the driver will turn on the bit imme diately after loading the transmit register It will then wait for the buffer to become available then tur
273. ified Systems as defined in 1 2 All other Restrictions specified by this license agreement remain in force 1 2 Qualified Systems means a microprocessor based computer system which is either i manufac tured by for or under license from Rabbit or ii based on the Rabbit 2000 microprocessor the Rabbit 3000 microprocessor the Rabbit 4000 microprocessor or any other Rabbit microproces sor Qualified Systems may not be a designed or intended to be re programmable by your cus tomer using the Software or b competitive with Rabbit products except as otherwise stated in a written agreement between Rabbit and the system manufacturer Such written agreement may require an end user to pay run time royalties to Rabbit Dynamic C Functions rabbit com 557 2 License Rabbit grants to You a nonexclusive nontransferable license to i use and reproduce the Soft ware solely for internal purposes and only for the number of users for which You have purchased licenses for the Users and not for redistribution or resale ii use and reproduce the Software solely to develop the Qualified Applications and iii use reproduce and distribute the Qualified Applica tions in object code only to end users solely for use on Qualified Systems provided however any agreement entered into between You and such end users with respect to a Qualified Application is no less protective of Rabbit s intellectual property rights than the terms and condition
274. ing semaphore unless an error is encountered PARAMETER sd Pointer to sd_ device structure of the SD card RETURN VALUE 0 Success EIO O error ENOMEDIUM No SD card in socket ESHAREDBUSY Shared SPI port busy LIBRARY SDFLASH LIB sdspi_ setLED void sdspi_ setLED sd device sd char state DESCRIPTION This function sets the LED for the given SD card based on state If state is 0 the LED is turned off If state is not zero the LED is turned on PARAMETER sd Pointer to sd_ device structure of the SD card state The state to set the LED to 0 Off and Non zero On LIBRARY SDFLASH LIB 426 rabbit com Dynamic C Functions sdspi_ set block length int sdspi_ set block length sd device sd int block length DESCRIPTION This function executes protocol command 16 to set the block length for the SD card The default block length for SD cards is 512 bytes Please note that sdspi_ write sector and sdspi_read_sector work on 512 byte blocks only If you change the block size these functions will need to be modified or you will need to execute commands directly through sdspi_ process command and internal write block and read block functions PARAMETER sd Pointer to device structure of the SD card block length The block size in bytes for the SD card RETURN VALUE 0 Success EIO I O error EINVAL Invalid parameter given ENOMEDIUM No SD card in socket ESHAREDBUSY Shared SPI port
275. inter at a desired location in the file PARAMETERS f A pointer to the file to seek into to The number of bytes to move the read pointer This can be a positive or negative number whence The location in the file to offset from This is one of the following con stants SEEK_ SET Seek from the beginning of the file SEEK_CUR Seek from the current read position in the file SEEK_END Seek from the end of the file EXAMPLE To seek to 10 bytes from the end of the file use fseek f f 10 SEEK END To rewind the file by 5 bytes use fseek f 5 SEEK CUR RETURN VALUE 0 Success 1 Failure LIBRARY FILESYSTEM LIB 158 rabbit com Dynamic C Functions fseek FS2 int fseek File f long where char whence Is DESCRIPTION Set the current read write position of the file Bytes in a file are sequentially numbered starting at zero If the current position is zero then the first byte of the file will be read or written If the position equals the file length then no data can be read but any write will append data to the file fseek allows the position to be set relative to the start or end of the file or relative to its current position In the special case of SEEK RAW an unspecified number of bytes beyond the known end of file may be readable The actual amount depends on the amount of space left in the last internal block of the file This mode only applies to reading and is provided for the
276. intf 0f f printf 0 3f f printf 7 3f f printf 8 3f f printf 6 3f f e exponential 88 888801 88 888801 KKKKKKKKK 89 88 889 88 889 88 889 88 889 88 889 ZE KEKKKK Width specifier is ignored for Dynamic C float and double both 4 bytes Precision specifier n d n is the total width excluding exponent sign if n is zero or is omitted it is ignored and only d is used if n larger than width the result is not padded d is decimal places of n nnn E nn format float f f 88 8888 printf e n f printf 13e n f printf 12e n f printf 0e n f printf 1e n f printf 3e n f printf 0 3e n printf 9 3e n printf 15 3e n printf 8 3e n printf 8 3e n 8 888880E 01 8 888880E 01 8 888880E 01 i 9E 01 8 9E 01 8 889E 01 8 889E 01 8 889E 01 f 8 889E 01 KKKEKKKKK f f 8 889E 01 364 rabbit com Dynamic C Functions printf cont d g floating point Same as f or e depending upon value and precision float f g h f 888 8888 g 888888 0 g 8888880 0 printf g n 9g 888888 0 printf g n h 8 888880E 06 printf g n f 888 888790 printf 13g n f 888 888790 printf 12g n f 888 888790 printf 0g n f 8 9E 02 printf 1g n f 8 9E 02 pri
277. ints to the next allocated element PARAMETERS P Pool handle structure as previously passed to pool_init Pass this in IX register e Current element address in DE register See pnext for a full descrip tion RETURN VALUE C flag set HL 0 There are no more elements C flag clear NC HL points to next element LIBRARY POOL LIB SEE ALSO pool init pool link palloc pfree pfirst pprev 346 rabbit com Dynamic C Functions poly float poly float x int n float c DESCRIPTION Computes polynomial value by Horner s method For example for the fourth order polynomial 10x 3x 4x 6 n would be 4 and the coefficients would be c 4 10 0 c 3 0 0 c 2 3 0 etl 4 0 c 0 6 0 PARAMETERS x Variable of the polynomial n The order of the polynomial c Array containing the coefficients of each power of x RETURN VALUE The polynomial value LIBRARY MATH LIB Dynamic C Functions rabbit com 347 pool append int pool append Pool t p void base word nel DESCRIPTION Add another root memory area to an existing pool It is assumed that the element size is the same as the element size of the existing pool The data area does not have to be contiguous with the existing data area but it must be nel elsize bytes long where e1 size is the element size of the existing pool and ne1 is the parameter to this function The total pool size must obey the constraints documented with poo
278. ion for details If this pointer is NULL the entire section is deleted sctx Server context RETURN VALUE lt 0 general failure code will be negative of one of the codes in ERRNO LIB 0 OK LIBRARY register lib SEE ALSO registry prep write registry write registry finish write registry get 406 rabbit com Dynamic C Functions registry write int registry write RegistryContext r char far section RegistryEntry far entries DESCRIPTION Modify the old registry r gt o1d_spec using the specified registry entries writing the result to r gt new_spec Only entries in the named section may be altered This function also al lows entries and sections to be deleted The new and old files must be different since this function depends on reading from the old file performing the requested modifications and writing the new file this is all done line by line Generally you will need two resource files which will alternate Only when the modifications are successfully complete will the old file be deleted This makes the update process more re sistant to corruption caused by e g the user turning off the power in the middle of the update The helper function registry prep write automates this process The function registry update encapsulates the basic registry update process NOTE since this function requires some temporary malloc memory you should ensure that there is at least_REGBUF_ SIZE bytes of availabl
279. ion sets the given attributes to the file Use defined attribute flags to create the set val ues PARAMETERS file Handle to the open file attr Attributes to set in file For attribute description see fat GetAttr May be one or more of the following e FATATTR_READ ONLY e FATATTR HIDDEN e FATATTR_SYSTEM e FATATTR_VOLUME_ ID e FATATTR_DIRECTORY e FATATTR_ARCHIVE e FATATTR_LONG NAME RETURN VALUE 0 Success ETIO on device IO error EINVAL invalid open file handle EPERM if the file is locked or write not permitted EBUSY if the device is busy Only if non blocking LIBRARY FAT LIB SEE ALSO fat Open fat Status Dynamic C Functions rabbit com 111 fat Split int fat Split FATfile file long where char newfile DESCRIPTION Splits the original file at where and assigns any left over allocated clusters to newfile As the name implies newfile is a newly created file that must not already exist Upon comple tion the original file is closed and the file handle is returned pointing to the created and opened new file The file handle given must point to a file of type FAT_ FILE There are internal static variables used in this function so only one file split operation can be active Additional requests will be held off with EBUSY returns until the active split completes PARAMETERS file Pointer to the open file to split where May be one of the following e 20 absolute byte to split the file If the abs
280. iptions for Dynamic C API functions Not all API functions are included For example board specific functions are described in the board s user manual New releases of Dynamic C often contain new API functions You can check if your version of Dynamic C contains a particular function by checking the Function Lookup feature in the Help menu If you see func tions described in this manual that you want but do not have please consider updating your version of Dynamic C To update Dynamic C go to www rabbit com products dc or call 1 530 757 8400 Dynamic C Functions rabbit com 1 abs int abs int x DESCRIPTION Computes the absolute value of an integer argument PARAMETERS x Integer argument RETURN VALUE Absolute value of the argument LIBRARY MATH LIB SEE ALSO fabs acos float acos float x DESCRIPTION Computes the arccosine of real float value x Note The Dynamic C functions deg and rad convert radians and degrees PARAMETERS x Assumed to be between 1 and 1 RETURN VALUE Arccosine of the argument in radians If x is out of bounds the function returns 0 and signals a domain error LIBRARY MATH LIB SEE ALSO cos cosh asin atan 2 rabbit com Dynamic C Functions acot float acot float x DESCRIPTION Computes the arcotangent of real float value x Note The Dynamic C functions deg and rad convert radians and degrees PARAMETERS x Assumed to be between
281. is error call the function again without changing any parameters LIBRARY FAT LIB SEE ALSO fat ReadDir Dynamic C Functions rabbit com 113 fat SyncFile int fat SyncFile FATfile file DESCRIPTION Updates the directory entry for the given file committing cached size dates and attribute fields to the actual directory This function has the same effect as closing and re opening the file PARAMETERS file Pointer to the open file RETURN VALUE 0 success EINVAL file is invalid EPERM this operation is not permitted on the root directory EBUSY the device is busy Only if non blocking Call function again to complete the update EFSTATE file not open or in an invalid state Any other negative value I O error when updating the directory entry LIBRARY FAT LIB SEE ALSO fat Close fat Open fat _OpenDir 114 rabbit com Dynamic C Functions fat SyncPartition int fat SyncPartition fat part part DESCRIPTION Flushes all cached writes to the specified partition to the actual device PARAMETER part Pointer to the partition to be synchronized RETURN VALUE 0 success EINVAL part is invalid EBUSY the device is busy Only if non blocking Call function again to complete the sync Any other negative value I O error when updating the device LIBRARY FAT LIB SEE ALSO fat Close fat SyncFile fat UnmountPartition Dynamic C Functions rabbit com 115 fat Tell
282. is was the el size parameter passed to pool init If the pool is linked you can write p gt elsize 4 bytes to it LIBRARY POOL LIB SEE ALSO pool init pfree fast pavail fast palloc Dynamic C Functions rabbit com 323 pavail word pavail Pool t p DESCRIPTION Return the number of elements that are currently available for allocation PARAMETERS p Pool handle structure as previously passed to pool_init or pool xinit RETURN VALUE Number of elements available for allocation LIBRARY POOL LIB SEE ALSO pool init pool xinit phwm pnel 324 rabbit com Dynamic C Functions pavail fast xmem word pavail fast Pool t p DESCRIPTION Return the number of elements that are currently available for allocation This is an assembler only version of pavail Do not call this function from C REGISTERS Parameter in IX Trashes F DE Return value in HL Z flag EXAMPLE ld ix my_pool lcall pavail fast HL contains number of available elements PARAMETERS p Pool handle structure as previously passed to pool_init or pool_xinit This must be provided in the IX register RETURN VALUE Number of elements available for allocation The return value is placed in HL In addition the Z flag is set if there are no free elements LIBRARY POOL LIB SEE ALSO pool init pool xinit phwm pnel Dynamic C Functions rabbit com 325 pcalloc void pcalloc Pool t p
283. istry_CNUMETALE cceceeeeeesersececeeeeeeeseees 395 POLY scscsessdanacedtessastavasneveanastevases Eed Se 347 registry_fimish_read ceeseesessececeeeeeeeseees 398 pDool oppend ENEE EN 348 registry_fimish_WTite ccccessessececeeeeeeeseens 399 POOL ANNE sie seek ces seuiesitnndsdectssueisaes EENS 349 registry get ee ENEE EEN 397 e 350 registry_prep_read esesesesererererererererere 400 pool_xappend ssssssesssessessssesreersesssseserereess 351 registry Dren write eeeeesessessceeeeeeeeeeeees 403 POOKIE eege 352 f gistry E 405 E 353 registry_update ccccccceceeeseeseeseeeeeeeeseeseees 406 BEE 353 RES ee 411 POWETSPECHIUM csecsecececeeeseesentececeeeesenseees 354 TOS is isaieaesereanedsusustees ee Ae d 411 DEEN geeiert 355 ResetErrorLog EE 412 pprey fast ssccdicesseasiscereessechasuesaiencdececaasecaraans 356 OPADE i EEE 412 PPU ASE oere G 357 rootiamem ENEE 413 pputlast_fast ccsccsccececeeeseesenseeeeeeeeeeeseees 358 rte_timezone REENEN 414 PLETAL gee eege r teense 358 EE 415 preorder d e Ass gdek d ZA SEA a Ee 359 PDE e 361 S pite harmer E 367 sdei debono EE 415 puts EE 367 BUSI T WE 416 BEE 368 E EE 417 DWImL SEI E T 369 sdspi_get_status_reg cccccsscsscssssssscsssseesseseees 418 PX AL OC eet d ses geesde gedet stds 370 E EE 418 pxalloc fast eoria a areas 371 EENEG 419 pxcalloc ebe ebessen 372 EEN 420 pxfirst Ee 373 EE 421 EE E EE 374 E A tonnes 421 EE
284. it void DESCRIPTION Initialize SPI driver for use with serial flash This must be called before any calls to sf initDevice RETURN VALUE 0 for success 1 for error LIBRARY SFLASH LIB 488 rabbit com Dynamic C Functions sin float sin float x DESCRIPTION Computes the sine of x Note The Dynamic C functions deg and rad convert radians and degrees PARAMETERS x Angle in radians RETURN VALUE Sine of x LIBRARY MATH LIB SEE ALSO Sinh asin cos tan sinh float sinh float x DESCRIPTION Computes the hyperbolic sine of x This functions takes a unitless number as a parameter and returns a unitless number PARAMETERS x Value to compute RETURN VALUE The hyperbolic sine of x If x gt 89 8 approx the function returns INF and signals a range error If x lt 89 8 approx the function returns INF and signals a range error LIBRARY MATH LIB SEE ALSO Sin asin cosh tanh Dynamic C Functions rabbit com 489 snprintf int snprintf char buffer int len char format DESCRIPTION This function takes a string pointed to by format arguments of the format and outputs the formatted string to the buffer pointed to by buffer snprintf will only output up to len characters The user should make sure that e there are enough arguments after format to fill in the format parameters in the format string e the types of arguments after
285. it com 21 CalculateECC256 long CalculateECC256 void data DESCRIPTION Calculates a 3 byte Error Correcting Checksum ECC 1 bit correction and 2 bit detection capa bility value for a 256 byte 2048 bit data buffer located in root memory PARAMETERS data Pointer to the 256 byte data buffer RETURN VALUE The calculated ECC in the 3 LSBs of the long i e BCDE result Note that the MSB i e B of the long result is always zero LIBRARY ECC LIB This function was introduced in Dynamic C 9 01 22 rabbit com Dynamic C Functions ChkCorrectECC256 void ChkCorrectECC256 void data void old _ ecc void new ecc DESCRIPTION Checks the old versus new ECC values for a 256 byte 2048 bit data buffer and if necessary and possible 1 bit correction 2 bit detection corrects the data in the specified root memory buffer PARAMETERS data Pointer to the 256 byte data buffer old ecc Pointer to the old original 3 byte ECC s buffer new ecc Pointer to the new current 3 byte ECC s buffer RETURN VALUE 0 Data and ECC are good no correction is necessary 1 Data is corrected and ECC is good 2 Data is good and ECC is corrected 3 Data and or ECC are bad and uncorrectable LIBRARY ECC LIB This function was introduced in Dynamic C 9 01 Dynamic C Functions rabbit com 23 ceil float ceil float x DESCRIPTION Computes the smallest integer greater than or equal to the given number PAR
286. it pattern indicating which bit s i e flags you wish to wait for E g if your application wants to wait for bits 0 and 1 then f 1ags should be 0x03 wait type Specifies whether you want ALL bits to be set or ANY of the bits to be set You can specify the following argument OS FLAG WAIT CLR ALL You will wait for ALL bits in mask to be clear 0 OS FLAG WAIT SET ALL You will wait for ALL bits in mask to be set 1 OS FLAG WAIT CLR ANY You will wait for ANY bit in mask to be clear 0 OS FLAG WAIT SET ANY You will wait for ANY bit in mask to be set 1 Note Add OS_ FLAG CONSUME if you want the event flag to be consumed by the call E g to wait for any flag in a group AND then clear the flags that are present set the wait type parameter to OS FLAG WAIT SET ANY OS FLAG CONSUME timeout An optional timeout in clock ticks that your task will wait for the desired bit combination If you specify 0 however your task will wait forever at the specified event flag group or until a message arrives Dynamic C Functions rabbit com 263 OSFlagPend cont d err Pointer to an error code Possible values are OS NO ERR The desired bits have been set within the specified time out OS _ERR_PEND_ISR If you tried to PEND from an ISR OS FLAG INVALID PGRP If pgrp is a null pointer OS ERR EVENT TYPE You are not pointing to an event flag group OS TIMEOUT The bit s have not been set in the s
287. it_type argument not specified e OS_FLAG_INVALID_PGRP null pointer passed instead of the event flag group handle e OS_FLAG_ERR_NOT_RDY Flags not available RETURN VALUE The state of the flags in the event flag group LIBRARY OS_FLAG C Prior to DC 8 UCOS2 LIB 260 rabbit com Dynamic C Functions OSFlagCreate OS FLAG GRP OSFlagCreate OS FLAGS flags INT8U err DESCRIPTION This function is called to create an event flag group PARAMETERS flags Contains the initial value to store in the event flag group err Pointer to an error code that will be returned to your application e OS _NO_ERR The call was successful e OS ERR CREATE ISR Attempt made to create an Event Flag from an ISR e OS FLAG GRP DEPLETED There are no more event flag groups RETURN VALUE A pointer to an event flag group or a null pointer if no more groups are available LIBRARY OS FLAG C Prior to DC 8 UCOS2 LIB Dynamic C Functions rabbit com 261 OSFlagDel OS FLAG GRP OSFlagDel OS FLAG GRP pgrp INT8U opt INT8U err DESCRIPTION This function deletes an event flag group and readies all tasks pending on the event flag group Note that e This function must be used with care Tasks that would normally expect the presence of the event flag group must check the return code of OSFlagAccept and OSFlagPend e This call can potentially disable interrupts for a long time The interrupt disable time is direc
288. ith the Rabbit 3000 or Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is cof_serXread int port where port is one of the macros SER_PORT_A through SER_PORT E PARAMETERS data Data structure into which characters are read length The number of characters to read into data tmout Millisecond wait period to allow between characters before timing out RETURN VALUE Number of characters read into data LIBRARY RS232 LIB EXAMPLE echoes a block of characters main ALINE ial g char s 16 serAopen 19200 LOCSPHALMANE a while 1 loophead costate Widen CO SerAnead Ss 15 210 wid cof serAwrite s n j serAclose Dynamic C Functions rabbit com 35 cof serXwrite void cof serXwrite void data int length where X is A F DESCRIPTION This single user cofunction writes Length bytes to port X It yields to other tasks for as long as the input buffer is locked or whenever the buffer becomes full as characters are written This function is non reentrant The functions cof_serEwrite andcof serFwrite may be used with the Rabbit 3000 or Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X
289. ived packet was too long for the buffers e HDLC ABORTED a received packet was aborted by the sender during tranmission e HDLC _BADCRC a packet with an incorrect CRC was received This function is intended for use with the Rabbit 3000 and Rabbit 4000 RETURN VALUE Error flags see above LIBRARY HDLC PACKET LIB Dynamic C Functions rabbit com 187 HDLCextClockx void HDLCextClockE int ext clock Where X is E or F DESCRIPTION Configures HDLC to be either internally default or externally clocked This should be called after HDLCopenxX This function is intended for use with the Rabbit 3000 and Rabbit 4000 PARAMETER ext clock 1 for externally clocked 0 for internally clocked LIBRARY HDLC PACKET LIB 188 rabbit com Dynamic C Functions HDLCopenx int HDLCopenx long baud char encoding unsigned long buffers int buffer count int buffer size Where X is E or F DESCRIPTION Opens serial port E or F in HDLC mode Sets up buffers to hold received packets This function is intended for use with the Rabbit 3000 and Rabbit 4000 Please see the chip manuals for more details on HDLC and the bit encoding modes to use PARAMETERS baud The baud rate for the serial port Due to imitations in the baud generator non standard baud rates will be approximated within 5 of the value re quested encoding The bit encoding mode to use Macro labels for the available options are e HDLC _NRZ e HDLC N
290. l NEAR SYNTAX long o atol char sptr FAR SYNTAX long f atol char far sptr By default atol is defined to pn atol DESCRIPTION ANSI string to long conversion UNIX compatible For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_ STRING macro is de fined and all pointers are near pointers append np tothe function name e g np strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS sptr String to convert RETURN VALUE The converted long integer value LIBRARY STRING LIB SEE ALSO atoi ato t strtod Dynamic C Functions rabbit com 15 bit unsigned int bit void address unsigned int bit DESCRIPTION Dynamic C may expand this call inline Reads specified bit at memory address bit may be from 0 to 31 This is equivalent to the fol lowing expression but more efficient long address gt gt bit amp 1 PARAMETERS address Address of byte containing
291. l init PARAMETERS p Pool handle structure as previously passed to pool init base Base address of the root data memory area to append to this pool This must be nel elsize bytes long Typically this would be a static global ar ray nel Number of elements in the memory area The sum of nel and the current number of elements must not exceed 32767 RETURN VALUE Currently always zero If you define the macro POOL_ DEBUG then parameters are checked If the parameters look bad then an exception is raised You can define POOL_ VERBOSE to get printf messages LIBRARY POOL LIB SEE ALSO pool init 348 rabbit com Dynamic C Functions pool init int pool init Pool t p void base word nel word elsize DESCRIPTION Initialize a root memory pool A pool is a linked list of fixed size blocks taken from a contigu ous area You can use pools instead of malloc when fixed size blocks are all that is needed You can have several pools with different size blocks Using memory pools is very efficient compared with more general functions like malloc There is currently no malloc im plementation with Dynamic C This function should only be called once at program startup time for each pool to be used Note the product of nel and elsize must be less than 65535 however this will usually be limited further by the actual amount of root memory available After calling this function your application must not cha
292. l watchdog ndog within 15 9375 seconds PARAMETERS ndog Id of virtual watchdog returned by VdGet FreeWd LIBRARY VDRIVER LIB Vdinit void VdInit void DESCRIPTION Initializes the Virtual Driver for all Rabbit boards Supports De layMs DelaySec DelayTick VdInit is called by the BIOS unless it has been disabled LIBRARY VDRIVER LIB 530 rabbit com Dynamic C Functions VdReleasewd int VdReleaseWd int ndog DESCRIPTION Deactivates a virtual watchdog and makes it available for VaGet FreeWd PARAMETERS ndog Handle returned by VdGet FreeWd RETURN VALUE 0 ndog out of range 1 Success LIBRARY VDRIVER LIB EXAMPLE NVdReleaseWd virtual watchdog example main int wd handle for a virtual watchdog unsigned long tm tm SEC TIMER wd VdGetFreeWd 255 wd activated 9 virtual watchdogs now available wd must be hit atleast every 15 875 seconds while SEC_TIMER tm lt 60 letitrun fora minute VdHitWd wd reset counter back to 255 VdReleaseWd wd now 10 virtual watchdogs available Dynamic C Functions rabbit com 531 WriteFlash2 int WriteFlash2 unsigned long flashDst void rootSrc unsigned len DESCRIPTION Write Len bytes from root Src to physical address flashDst on the 2nd flash device The source must be in root The flashDst address plus the sum of numbytes area must be within memory quadrant s already mapped t
293. le prealloc Handle for the partition being used Pointer to the full path name of the file to be opened created FAT FILE or FAT_DIR depending on what is to be opened created File flags must be one of FAT OPEN Object must already exist If it does not exist ENOENT will be returned FAT CREATE Object is created only if it does not already exist FAT _MUST_CREATE Object is created and it must not already exist FAT READONLY No write operations this flag is mutually exclusive with any of the CREATE flags FAT SEQUENTIAL Optimize for sequential reads and or writes This setting can be changed while the file is open by using the fat _fcnt1 function Pointer to an empty FAT file structure that will act as a handle for the newly opened file Note that you must memset this structure to zero when you are using the non blocking mode before calling this function the first time Keep calling until something other than EBUSY is returned but do not change anything in any of the parameters while doing so An initial byte count if the object needs to be created This number is rounded up to the nearest whole number of clusters greater than or equal to 1 This parameter is only used if one of the _ CREATE flag is set and the object does not already exist On return prealloc is updated to the ac tual number of bytes allocated May be NULL in which case one cluster is allocated if the call is successful 102 rabbit
294. lements are available BCDE is undefined in this case NC flag BCDE points to an element If the pool is not linked your application must not write more than p gt elsize bytes to it this was the el size parameter passed to pool xinit Ifthe pool is linked you can write p gt e1size 8 bytes to it An ele ment has 8 bytes of overhead when the pool is linked LIBRARY POOL LIB SEE ALSO pool init pfree fast pavail fast pxalloc Dynamic C Functions rabbit com 371 pxcalloc long pxcalloc Pool t p DESCRIPTION Return next available free element from the given pool Eventually your application should re turn this element to the pool using pxfree to avoid memory leaks The element is set to all zero bytes before returning PARAMETERS p Pool handle structure as previously passed to pool_xinit RETURN VALUE 0 No free elements are available 0 Physical xmem address of an element If the pool is not linked your application must not write more than p gt elsize bytes to it this was the elsize parameter passed to pool_xinit The application can write up to p gt e1size 8 bytes to the element if the pool is linked An element has 8 bytes of overhead when the pool is linked LIBRARY POOL LIB SEE ALSO pool xinit pxalloc pxfree phwm pavail 372 rabbit com Dynamic C Functions pxfirst long pxfirst Pool t p DESCRIPTION Get the first allocated element in an xmem
295. ll be read or written If the position equals the file length then no data can be read but any write will append data to the file Note that no checking is done to see if the file descriptor s valid If the File is not actually open the return value will be random PARAMETERS f Pointer to file descriptor initialized by fopen_rd fopen_wr or fcreate RETURN VALUE Current read write position 0 to length of file ERRNO VALUES None LIBRARY fs2 lib SEE ALSO fseek FS2 170 rabbit com Dynamic C Functions fshift int fshift File int len void buf DESCRIPTION Delete data from the start of a file opened for writing Optionally the data that was removed can be read into a buffer The current position of the file descriptor is adjusted to take account of the changed file offsets If the current position is pointing into the data that is removed then it is set to zero i e the start of data immediately after the deleted section The specified file must not be opened with other file descriptors otherwise an EBUSY error is returned The exception to this is if FS2_ SHIFT _DOESNT_UPDATE_FPOS is defined before use s2 1ib If defined multiple file descriptors can be opened but their current position will not be updated if fshift is used In this case the application should explicitly use fseek on all file descriptors open on this file including the one used to perform the fshift If t
296. lly formatted n Dynamic C Functions rabbit com 153 fs format FS2 int fs format long reserveblocks int num blocks unsigned wearlevel i DESCRIPTION Format all extents of the file system This must be called after calling fs init Only ex tents that are not defined as reserved are formatted All files are deleted PARAMETERS reserveblocks Must be zero Retained for backward compatibility num blocks Ignored backward compatibility wearlevel Initial wearlevel value This should be 1 if you have a new flash and some larger number if the flash is used If you are reformatting a flash you can use 0 to use the old flash wear levels RETURN VALUE 0 Success 0 Failure ERRNO VALUES EINVAL the reserveblocks parameter was non zero EBUSY one or more files were open EIO I O error during format If this occurs retry the format operation If it fails again there is probably a hardware error SEE ALSO fs init FS2 1x format 154 rabbit com Dynamic C Functions fs init FS1 int fs init long reserveblocks int num blocks DESCRIPTION Initialize the internal data structures for an existing file system Blocks that are used by a file are preserved and checked for data integrity PARAMETERS reserveblocks Starting address of the flash file system When FS_FLASH is defined this value should be 0 or a multiple of the block size When FS_RAM is de fined this parameter is ignored num blocks T
297. lowcontrolOn void serXflowcontrolOn void where X is A F DESCRIPTION Turns on hardware flow control for channel X This enables two digital lines that handle flow control CTS clear to send and RTS ready to send CTS is an input that will be pulled active low by the other system when it is ready to receive data The RTS signal is an output that the system uses to indicate that it is ready to receive data it is driven low when data can be received A call to serXopen must be made before calling this function This function is non reentrant The functions serEf lowcontrol0On andserFflowcontrolOn may be used with the Rabbit 3000 and Rabbit 4000 If pins for the flow control lines are not explicitly defined defaults will be used and compiler warnings will be issued The locations of the flow control lines are specified using a set of 5 macros SERX RTS PORT Data register for the parallel port that the RTS line is on e g PCDR SERA RTS SHADOW Shadow register for the RTS line s parallel port e g PCDRShad ow SERA_RTS BIT The bit number for the RTS line SERA CTS PORT Data register for the parallel port that the CTS line is on SERA CTS BIT The bit number for the CTS line LIBRARY RS232 LIB 452 rabbit com Dynamic C Functions serxXgetc int serXgetc void where X is A F DESCRIPTION Get next available character from serial port X read buffer This function is non reentrant The functions serEgetc
298. m 55 DMAmem2i0i int DMAmem2ioi dma_chan t handle unsigned int dest dma_addr_t src unsigned int len unsigned int flags DESCRIPTION This function performs an immediate DMA operation from memory to internal I O PARAMETERS handle Handle for channel to use in transfer dest Internal I O destination address sre Memory location source len Length to send cannot equal zero flags Various flag options See DMAioe2mem fora full list of flags and their descriptions RETURN VALUE 0 Success EINVAL Invalid handle EBUSY Resources are busy LIBRARY DMA LIB SEE ALSO DMAmem2mem DMAcompleted DMAstop 56 rabbit com Dynamic C Functions DMAmem2mem int DMAmem2mem dma chan t handle dma addr t dest dma _addr t src unsigned int len unsigned int flags DESCRIPTION This function performs an immediate DMA operation from memory to memory PARAMETERS handle Handle for channel to use in transfer dest Memory destination address sre Memory location source address len Length to send cannot equal zero flags Various flag options See DMAioe2mem fora full list of flags and their descriptions RETURN VALUE 0 Success EINVAL Invalid handle EBUSY Resources are busy LIBRARY DMA LIB SEE ALSO DMAcompleted DMAstop Dynamic C Functions rabbit com 57 DMApoll word DMApoll int dmaChannel word bufCount DESCRIPTION This is a low level DMA function for determining how much data has been trans
299. means that the POOL_IPSET level is used to lock out other CPU contexts from altering the pool while this operation is in progress The pool MUST be set to being a linked pool by using pool link p lt non zero gt Otherwise the results are undefined PARAMETERS P e where options Pool handle structure as previously passed to pool_init Address of element to move obtained by e g plast This must be an allocated element in the given pool otherwise the results are undefined If null then the last element is implied Ge whatever plast would re turn If there are no elements at all or this parameter does not point to a valid allocated element then the results are undefined and probably cata strophic The reference element The element e will be inserted before or after this element depending on the options parameter If e where then there is no action If this parameter is null then the reference element is assumed to be the first element Oe whatever pfirst would return If there are no elements at all or this parameter does not point to a valid allocated element then the results are undefined and probably catastrophic Option flags Currently the only options are POOL INSERT BEFORE POOL INSERT AFTER which specifies whether e is to be inserted before or after where Dynamic C Functions rabbit com 359 preorder cont d RETURN VALUE Returns the parame
300. ment wait for constructs The initial call to this function starts the timing The function returns zero and continues to return zero until the num ber of milliseconds specified has passed PARAMETERS delayms The number of milliseconds to wait RETURN VALUE 1 The specified number of milliseconds have elapsed 0 The specified number of milliseconds have not elapsed LIBRARY COSTATE LIB 44 rabbit com Dynamic C Functions DelaySec int DelaySec long delaysec DESCRIPTION Second time mechanism for the costatement wait for constructs The initial call to this func tion starts the timing The function returns zero and continues to return zero until the number of seconds specified has passed PARAMETERS delaysec The number of seconds to wait RETURN VALUE 1 The specified number of seconds have elapsed 0 The specified number of seconds have not elapsed LIBRARY COSTATE LIB DelayTicks int DelayTicks unsigned ticks DESCRIPTION Tick time mechanism for the costatement wait for constructs The initial call to this function starts the timing The function returns zero and continues to return zero until the number of ticks specified has passed 1 tick 1 1024 second PARAMETERS ticks The number of ticks to wait RETURN VALUE 1 The specified tick delay has elapsed 0 The specified tick delay has not elapsed LIBRARY COSTATE LIB Dynamic C Functions rabbit com 45 Disable HW WDT v
301. more detail on the alternate serial port pins For Rabbit 4000 Users To use DMA for transfers call serXdmaOn after this function PARAMETERS baud Bits per second bps of data transfer Note that the baud rate must be greater than or equal to the peripheral clock frequency divided by 8192 RETURN VALUE 1 The Rabbit s bps setting is within 5 of the input baud 0 The Rabbit s bps setting differs by more than 5 of the input baud LIBRARY RS232 LIB SEE ALSO serXgetc serXpeek serXputs serXwrite cof serxgetc cof serXgets cof _serXread cof _serXputc cof serXputs cof serXwrite serXclose Dynamic C Functions rabbit com 455 serXparity void serXparity int parity mode where X is A F DESCRIPTION Sets parity mode for channel X A call to serXopen must be made before calling this func tion Parity generation for 8 bit data can be unusually slow due to the current method for generating high 9th bits Whenever a 9th high bit is needed the UART is disabled for approximately 10 baud times to create a long stop bit that should be recognized by the receiver as a high 9th bit The long delay is imposed because we are using the serial port itself to handle timing for the delay Creating a shorter delay would the require use of some other timer resource This function is non reentrant The functions serEparity andserFparity may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can
302. n ENOPART the partition does not exist on the device EPERM the partition has not been enumerated EBUSY the device is busy only if non blocking LIBRARY FAT LIB SEE ALSO fat _EnumPartition fat _MountPartition fat _UnmountDevice 120 rabbit com Dynamic C Functions fat Write int fat Write FATfile file char buf int len DESCRIPTION Writes characters into the file specified by the file pointer beginning at the current position in the file Characters will be copied from the string pointed to by buf The len variable controls how many characters will be written This can be more than one sector in length and the write function will allocate additional sectors if needed Data is written into the file starting at the cur rent file position regardless of existing data Overwriting at specific points in the file can be ac complished by calling the fat _Seek function before calling fat _Write PARAMETERS file Handle for the open file being written buf Pointer to the buffer containing data to write len Length of data to be written RETURN VALUE Number of bytes written success may be less than len or zero if non blocking mode EIO device I O error EINVAL file buf or len contain invalid values ENOENT file does not exist ENOSPC no space left on the device to complete the write EFAULT problem in file broken cluster chain etc EPERM the file is locked or is write protected EB
303. n the lowest serial rate first Note that this function provides no TATXR resource sharing protection for an application that uses any of the individual TATxR resources either directly or indirectly For example this func tion affords no protection to an application that sets a direct usage TAT7R timer interrupt and also opens serial port D such that TAT7R is used to set the serial data rate A run time error occurs if parameter s are invalid Also this function is not reentrant PARAMETERS bps The requested serial bits per second BPS baud rate divisor An optional pointer to the caller s serial timer divisor variable If the caller is not interested in the actual serial timer TATxR divisor value that is set by this function then NULL may be passed tatXr The TATXR for the serial timer whose value s are to be set Use exactly one of the following macros e TATAR for serial port A e TATSR for serial port B e TATOR for serial port C e TATTR for serial port D e TAT2R for serial port E e TAT3R for serial port F RETURN VALUE The actual serial rate BPS baud setting that was achieved LIBRARY sys lib SEE ALSO TAT1R SetValue 472 rabbit com Dynamic C Functions SetVectExtern2000 unsigned SetVectExtern2000 int priority void isr DESCRIPTION Sets up the external interrupt table vectors for external interrupts 0 and 1 This function should be used for Rabbit 2000 processors revision IQ2 due to a bug in the chi
304. n most cases use long variable SEC_TIMER which contains the same result unless the RTC has been changed since the start of the program If you are running the processor off the 32 kHz crystal and using a Dynamic C version prior to 7 30 use read_rtc_32kHz instead of read_rtc Starting with DC 7 30 read to 32kHz is deprecated because it is no longer necessary Programmers should only use read_rtc RETURN VALUE Time in seconds since January 1 1980 if RTC set correctly LIBRARY RTCLOCK LIB SEE ALSO write rtc read rtc 32kHz unsigned long read rtc_ 32kHz void DESCRIPTION Reads the real time clock directly when the Rabbit processor is running off the 32 kHz oscilla tor See read_rtc for more details RETURN VALUE Time in seconds since January 1 1980 if RTC set correctly LIBRARY RTCLOCK LIB 392 rabbit com Dynamic C Functions readUserBlock int readUserBlock void dest unsigned addr unsigned numbytes DESCRIPTION Reads a number of bytes from the User block on the primary flash to a buffer in root memory Please note that portions of the User block may be used by the BIOS for your board to store values For example any board with an A to D converter will require the BIOS to write calibration constants to the User block For some versions of the BL2000 and the BL2100 this memory area is 0x1C00 to Ox1 FFF See the user s manual for your particular board for more information before ove
305. n off the bit The buffer will not become available until the master supplies the first clock If SPI_ SLAVE RDY_ PORT is defined for a master device the driver will wait for the bit to become true before transmitting the byte and then wait for it to become false after transmitting the byte Note for Master the receiving device Chip Select must already be active PARAMETERS SrcAddr Address of data to write ByteCount Number of bytes to write RETURN VALUE Master none Slave 0 no CS signal no transmitted bytes 1 CS bytes transmitted LIBRARY SPI LIB SEE ALSO SPIinit SPIRead SPIWrRd Dynamic C Functions rabbit com 493 SPIWrRd void SPIWrRd void SrcAddr void DstAddr int ByteCount DESCRIPTION Read and Write a block of bytes from to the SPI port Note for Master the receiving device Chip Select must already be active PARAMETERS SrcAddr Address of data to write DstAddr Address to put received data ByteCount Number of bytes to read write The maximum value is 255 bytes This limit is not checked The receive buffer MUST be at least as large as the number of bytes RETURN VALUE Master none Slave 0 no CS signal no received transmitted bytes 1 CS bytes received transmitted LIBRARY SPI LIB SEE ALSO SPIinit SPIRead SPIWrite 494 rabbit com Dynamic C Functions sprintf int sprintf char buffer char format DESCRIPTION This function takes a stri
306. nables the periodic interrupt in case it was disabled by a call to use32kHzOsc This function is not task reentrant LIBRARY SYS LIB SEE ALSO useMainOsc use32kHzOsc Dynamic C Functions rabbit com 525 useClockDivider3000 void useClockDivider3000 int setting DESCRIPTION Sets the expanded clock divider options for the Rabbit 3000 processor Target communications will be lost after changing this setting because of the baud rate change This function also en ables the periodic interrupt in case it was disabled by a call to user32kHzOsc The peripheral clock is also affected by this function If you want to divide the main processor clock and not the peripheral clock you may use the function useClockDivider to di vide the main processor clock by 8 To divide the main processor clock by any of the other al lowable values 2 4 or 6 means using useClockDivider3000 and thus dividing the peripheral clock as well This function is not task reentrant PARAMETER setting Divider setting The following are valid e CLKDIV_2 divide main processor clock by two e CLKDIV_4 divide main processor clock by four e CLKDIV_6 divide main processor clock by six e CLKDIV_8 divide main processor clock by eight RETURN VALUE None LIBRARY SYS LIB SEE ALSO useClockDivider useMainOsc use32kHzOsc set32kHzDivider 526 rabbit com Dynamic C Functions useMainOsc void useMainOsc void DESCRIPTION Sets
307. namic C Functions fat Seek int fat Seek FATfile file long pos int whence DESCRIPTION Positions the internal file position pointer fat Seek will allocate clusters to the file if nec essary but will not move the position pointer beyond the original end of file EOF unless doing a SEEK_ RAW In all other cases extending the pointer past the original EOF will preallocate the space that would be needed to position the pointer as requested but the pointer will be left at the original EOF and the file length will not be changed If this occurs an EOF error will be returned to indicate the space was allocated but the pointer was left at the EOF PARAMETERS file pos whence Pointer to the file structure of the open file Position value in number of bytes may be negative This value is inter preted according to the third parameter whence Must be one of the following SEEK_SET pos is the byte position to seek where 0 is the first byte of the file If pos is less than 0 the position pointer is set to 0 and no error code is returned If pos is greater than the length of the file the po sition pointer is set to EOF and error code EEOF is returned SEEK_CUR seek pos bytes from the current position If pos is less than 0 the seek is towards the start of the file If this goes past the start of the file the position pointer is set to 0 and no error code is returned If pos is greater than 0 the seek is towards EOF
308. namic C Functions log prev int log prev LogDest ldst LogEntry le DESCRIPTION Retrieve previous log entry You must call log_seek before calling this function the first time Retrieval of stored log messages proceeds for example as follows log_seek ldst 1 seek to end log prev ldst amp L get last entry log prev ldst amp L get 2nd last entry log next ldst amp L get 2nd last entry again log next ldst amp L get last entry log next ldst amp L returns 1 Note Please see the comments at the top of log 1ib for a description of the message logging subsystem PARAMETERS ldst Destination class and stream Use one of the constants LOG_DEST_FS2 or LOG _DEST_XMEM then OR in the stream number 0 63 le Storage for result RETURN VALUE non negative length of log entry data 1 Start of log or not open 2 Not a readable log destination class LIBRARY log lib SEE ALSO Log seek log next Dynamic C Functions rabbit com 221 log put int log put LogFacPri ifp uint8 fmt const char data int length DESCRIPTION Add a log entry The specified facility priority is mapped to the appropriate destination s as configured by the macros If the destination exists then the log entry is added otherwise the entry is quietly ignored If a destination is unable to fit the log entry and the destination is con figured as circular then the first few entries may
309. namic C Functions rabbit com 167 fs sync FS2 int fs_sync void DESCRIPTION Flush any buffers retained in RAM to the underlying hardware device The file system does not currently perform any buffering however future revisions of this library may introduce buffer ing to improve performance This function is similar to ff lush except that the entire file system is synchronized instead of the data for just one file Use fs sync in preference to fflush if there is only one extent in the filesystem RETURN VALUE 0 Success 0 Failure ERRNO VALUES EIO I O error LIBRARY FS2 LIB SEE ALSO fflush FS2 168 rabbit com Dynamic C Functions ftell FS1 long ftell File Ei DESCRIPTION Gets the offset from the beginning of a file that the read pointer is currently at TIP fte11 can be used with fseek to find the length of a file fseek f 0 SEEK END seek to the end of the file FileLength ftell f find the length of the file PARAMETERS f A pointer to the file to query RETURN VALUE The offset in bytes of the read pointer from the beginning of the file Success 1 Failure LIBRARY FILESYSTEM LIB Dynamic C Functions rabbit com 169 ftell FS2 long ftell File Ei DESCRIPTION Return the current read write position of the file Bytes in a file are sequentially numbered start ing at zero If the current position is zero then the first byte of the file wi
310. nction Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_STRING macro is de fined and all pointers are near pointers append np to the function name e g n strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS str1 Pointer to string 1 str2 Pointer to string 2 n Maximum number of bytes to compare If zero both strings are considered equal RETURN VALUE lt 0 str1 is less than str2 because char in st r1 is less than corresponding char in st r2 0 str1 is identical to str2 gt 0 Str1 is greater than str2 because char in st r1 is greater than corresponding char in st r2 LIBRARY STRING LIB SEE ALSO strcmp strcempi strncmpi Dynamic C Functions rabbit com 505 strncmpi NEAR SYNTAX int _n strncmpi char strl char str2 unsigned n FAR SYNTAX int f strncempi char far strl char far str2 unsigned n Note By default strncmpi is definedto np strncmpi DESCRIPTION Performs case insensitive unsigned character by character comparison of two strings of length n For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also
311. nction that has been generalized for all serial ports Instead of substituting for X in the function name the function prototype is serXdmaOff int port where port is one of the macros SER_ PORT_A through SER_PORT E RETURN VALUE 0 Success DMA Error codes Error LIBRARY RS232 LIB SEE ALSO serxXdmaOn Dynamic C Functions rabbit com 449 serXdmaOn int serXdmaOn int tcmask int remask where X is A F DESCRIPTION Enables DMA for serial send and receive This function should be called directly after serXopen Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the function prototype is serXdmaOn int port where port is one of the macros SER_ PORT_A through SER_PORT E Important Flow Control Note Because the DMA flowcontrol uses the external request feature only two serial ports can use DMA flowcontrol at a time For the CTS pin one serial port can use PD2 PE2 or PE6 and the other can use PD3 PE3 or PE7 How DMA Serial Works DMA Transmit When a serial function is called to transmit data a DMA transfer begins The length of that transfer is either the length requested or the rest of the transmit buffer size from the current po sition An interrupt is fired at the end of the transmit at which time another transmit is set up if more data is ready to go DMA R
312. nction was introduced in Dynamic C 9 01 250 rabbit com Dynamic C Functions nf isBusyRBHW int nf isBusyRBHW nf device dev DESCRIPTION Returns 1 if the specified NAND flash device is busy Uses the hardware Ready Busy check method and can be used to determine the device s busy status even at the start of a read page command Note that this function briefly enforces the Ready Busy input port bit reads the pin status and then restores the port bit to its previous input output state There should be little or no visible disturbance of the LED output which shares the NAND flash s Ready Busy status line PARAMETERS dev Pointer to an initialized nf_device structure for the particular NAND flash chip RETURN VALUE 1 Busy 0 Ready not currently transferring a page to be read or erasing or writing a page 1 Error unsupported Ready Busy input port LIBRARY NFLASH LIB This function was introduced in Dynamic C 9 01 SEE ALSO nf _isBusyStatus Dynamic C Functions rabbit com 251 nf isBusyStatus int nf isBusyStatus nf device dev DESCRIPTION Returns 1 if the specified NAND flash device is busy erasing or writing to a page Uses the software status check method which can not must not be used to determine the device s busy status at the start of a read page command PARAMETERS dev Pointer to an initialized nf device structure for the particular NAND flash chip RETURN VALUE 1 Busy 0 Ready
313. nctions VdGetFreewd int VdGetFreeWd char count DESCRIPTION Returns a free virtual watchdog and initializes that watchdog so that the virtual driver begins counting it down from count The number of available virtual watchdogs is determined by the macro N_ WATCHDOG which is 10 by default The default can be overridden by the user e g define N WATCHDOG 11 The virtual driver is called every 0 00048828125 second On every 128th call to it i e every 62 5 ms the virtual watchdogs are counted down and then tested If any virtual watchdog reaches zero this is a fatal error Once a virtual watchdog is active it should reset periodically with a call to VAHitWd to prevent the count from readching zero PARAMETERS count 1 lt count lt 255 RETURN VALUE Integer id number of an unused virtual watchdog timer LIBRARY VDRIVER LIB Dynamic C Functions rabbit com 529 VdHitwd int VdHitWd int ndog DESCRIPTION Resets virtual watchdog counter to N counts where N is the argument to the call to VdGet FreeWd that obtained the virtual watchdog ndog The virtual driver counts down watchdogs every 62 5 ms If a virtual watchdog reaches 0 this is a fatal error Once a virtual watchdog is active it should reset periodically with a call to VdHitWd to prevent this IfN 2 VdHitWd will need to be called again for virtual watchdog ndog within 62 5 ms If N 255 VdHitWd will need to be called again for virtua
314. next der amp L get Ist entry log next ldst amp L get 2nd entry log prev ldst amp L get 2nd entry again log prev ldst amp L get Ist entry log prev ldst amp L returns 1 Note Please see the comments at the top of log Lib for a description of the message logging subsystem PARAMETERS ldst Destination class and stream Use one of the constants LOG_DEST_FS2 or LOG _DEST_XMEM then OR in the stream number 0 63 le Storage for result RETURN VALUE non negative length of log entry data 1 End of log or not open 2 Not a readable log destination class LIBRARY log lib SEE ALSO log_seek log_prev Dynamic C Functions rabbit com 219 Log open int log open LogDestClass ldc int clean DESCRIPTION Open the specified logging destination class If necessary this enumerates all possible streams within the class opening them all necessary only for FS2 class since each file needs to be opened Class LOG DEST ALL opens all configured classes If clean is true then the dest is set to empty log if that makes sense for the class Note Please see the comments at the top of log Lib for a description of the message logging subsystem PARAMETERS ldc Destination class LOG_DEST_FS2 LOG_DEST_UDP LOG DEST XMEM or LOG_DEST_ ALL clean Boolean should the destination be erased before using RETURN VALUE 0 success 1 unknown LogDestClass value LIBRARY log lib 220 rabbit com Dy
315. ng pointed to by format arguments of the format and outputs the formatted string to buffer pointed to by buffer The user should make sure that e there are enough arguments after format to fill in the format parameters in the format string e the types of arguments after format match the format fields in format e the buffer is large enough to hold the longest possible formatted string The following is a short list of valid conversion specifiers in the format string For a complete list of conversion specifiers refer to the function description for printf d decimal integer expects type int u decimal unsigned integer expects type unsigned int x hexadecimal integer expects type signed int or unsigned int s a string not interpreted expects type char f a float expects type float For example sprintf buffer s Sain variable x 256 puts the string variable x 100 into buffer The macroSTDIO DISABLE FLOATS can be defined if it is not necessary to format floating point numbers If this macro is defined e f and g will not be recognized This can save thousands of bytes of code space This function can be called by processes of different priorities PARAMETERS buffer Result string of the formatted string format String to be formatted es Format arguments RETURN VALUE Number of characters written LIBRARY STDIO LIB SEE ALSO prints Dynamic C Functions rabbit com 4
316. nge any of the fields in the Pool _t structure PARAMETERS p Pool handle structure This is allocated by the caller but this function will initialize it Normally this would be allocated in static memory by declar ing a global variable of type Pool_t base Base address of the root data memory area to be managed in this pool This must be nel elsize bytes long Typically this would be a static glo bal array nel Number of elements in the memory area 1 32767 elsize Size of each element in the memory area 2 32767 RETURN VALUE Currently always zero If you define the macro POOL_ DEBUG then parameters are checked If the parameters look bad then an exception is raised You can define POOL VERBOSE to get printf messages LIBRARY POOL LIB SEE ALSO pool xinit palloc pcalloc pfree phwm pavail Dynamic C Functions rabbit com 349 pool link int pool link Pool t p int link DESCRIPTION Tell the specified pool to maintain a doubly linked list of allocated elements This function should only be called when the pool is completely free i e pavail pnel PARAMETERS P Pool handle structure as previously passed to pool_init or pool xinit link Must be one of the following e POOL NOT LINKED 0 the pool is not to be linked e POOL LINKED AUTO 1 the pool is linked and newly allocated el ements are always added at the end of the list e POOL LINKED DN APP 2 the pool is linked but newly
317. ns rabbit com 63 DMAsetParameters cont d min cpu pct A number between 0 and 100 describing the minimum worst case relative amount of time that the CPU will control the bus versus the DMA time Internally this function uses this figure to determine the minimum clocks between bursts hardware setting The figure will be rounded in favor of the CPU up to the maximum possible hardware setting RETURN VALUE 0 Success EINVAL for an error LIBRARY DMA LIB DMAstartAuto void DMAstartAuto int channel DESCRIPTION This function is defined to the following WrPortI DMALR NULL 1 lt lt channel Start using auto load the corresponding DMA channel using the buffer descriptor in memory addressed by the Initial Address Register This command should only be used after the Initial Address has been loaded PARAMETER channel DMA channel obtainable through DMAhandle2chan LIBRARY DMA LIB SEE ALSO DMAstartDirect DMAstopDirect 64 rabbit com Dynamic C Functions DMAstartDirect void DMAstartDirect int channel DESCRIPTION This function is defined to the following WrPortI DMCSR NULL 1 lt lt channel Start or restart the corresponding DMA channel using the contents of the DMA channel reg isters This command should only be used after all the DMA channel registers have been loaded PARAMETER channel DMA channel obtainable through DMAhandle2chan LIBRARY DMA LIB SEE
318. ntf 2g n f 8 89E 02 printf 3g n f 888 889 printf 7 3g n f RRR RK printf 0 3g n 888 889 printf 9 3g n EI 888 889 printf 15 3g n f 888 889 print 8 3g n f 888 889 printf 8 3g n 888 889 op pointer Specifies a 16 bit logical pointer int i iptr ptr amp i printf p n ptr prints value of ptr in hex logical memory location of i lp pointer Specifies a 32 bit physical pointer long i iptr i 0 ptr amp i printf lp n ptr prints value of ptr in hex physical memory location of i Dynamic C Functions rabbit com 365 printf cont d x hexadecimal Result in lowercase Width specifier 1 short values must not include 1 without 1 long values are treated as short Precision specifier n must be at least as large as total width treats argument as if it were un signed short n n 30000 printf Sx nl 7530 printf 5x n 7530 printf 6x n 7530 printf 3x n E ES unsigned short n n 40000 printf x n 9c40 long m n m 25536 n 0x10000 Oxabc printf x n m 9c40 printf x n zZz abe X hexadecimal Same as x except the result is in uppercase oc single character Precision specifier n is ignored for c treats argument as if it were char long n n 0x10000 0x100 A printf 0c n A short n
319. ntion for escaping such characters or you can use the REGOPTION_ BIN option which will store the string expanded into ASCII hexadec imal which is completely safe Individual key value entries may be deleted by specifying the REGOPTION DELETE flag with the appropriate entries PARAMETERS r RegistryContext structure with at least the old_spec and new_spec fields initialized For example use registry_prep_write to setup this structure correctly r gt old_spec Open resource handle of a readable resource containing the old registry set tings This is read from the current seek position thus in most cases you will want to call this function with a freshly opened resource handle This may also be 1 which indicates there is no old registry to update and a new registry will be written to new_spec r gt new_spec Open resource handle of a writable resource to which the old registry modified with the given settings will be written Normally this should initially be an empty resource file The new settings will be written starting at the current seek position in this resource Note that the resource handles remain open when this function returns section Section name If NULL or empty string then the first anonymous section of the registry is implied 408 rabbit com Dynamic C Functions registry write cont d entries List of replacement registry entries The list MUST be terminated with an entry with the RE
320. nto a paritition and filename Examples with FAT_USE_FORWARDSLASH defined a filename txt gt partition A filename txt b filename txt gt partition B filename txt C filename txt gt partition C filename txt Examples without FAT_USE_ FORWARDSLASH defined a filename txt gt partition A filename txt b filename txt gt partition B filename txt C filename txt gt partition C filename txt PARAMETERS part Memory location to store a pointer to the fat partition drive letter file Memory location to store a pointer into fullpath parameter 3 where the filename begins fullpath Pathname to parse RETURN VALUE 0 Success EINVAL unable to parse lt fullpath gt LIBRARY FAT LIB 94 rabbit com Dynamic C Functions fat Init int fat Init int pnum mbr _drvr driver mbr_ dev dev fat part part int norecovery DESCRIPTION Initializes the default driver in MBR_DRIVER_INIT enumerates device 0 then enumerates and mounts the specified partition This function was replaced with the more powerful fat AutoMount fat Init will only work with device 0 of the default driver This driver becomes the pri mary driver in the system The application can start calling any directory or file functions after this routine returns success fully The desired partition must already be formatted If the partition mount fails you may call the function again using a different partition number pnum The devic
321. o USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_ STRING macro is de fined and all pointers are near pointers append np tothe function name e g np strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS dst Pointer to location to receive string sre Pointer to location to supply string n Maximum number of bytes to copy If equal to zero this function has no effect RETURN VALUE Pointer to destination string LIBRARY STRING LIB SEE ALSO strcpy Dynamic C Functions rabbit com 507 strpbrk NEAR SYNTAX char n strpbrk char sl char s2 FAR SYNTAX char far f strpbrk char far sl char far s2 Note By default strpbrk is definedto np strpbrk DESCRIPTION Scans a string for the first occurrence of any character from another string For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version wi
322. o a User ID block a place intended for storing calibra tion constants passwords and other non volatile data The User block is recommended for storing all non file data The User block is where calibra tion constants are stored for boards with analog I O Space in the User block is limited to as smallas 8K sizeof SysIDBlock bytes or less if there are calibration constants writeUserBlock writes a number of bytes from root memory to the User block This block is protected from normal writes to the flash device and can only be accessed through this function or the function writeUserBlockArray Using this function can cause all interrupts to be disabled for as long as 20 ms while a flash sec tor erases depending on the flash type A single call can produce as many as four of these erase delays This will cause periodic interrupts to be missed and can cause other interrupts to be missed as well Therefore it is best to buffer up data to be written rather than to do many writes While debugging several consecutive calls to this function can cause a loss of target serial com munications This effect can be reduced by introducing delays between the calls lowering the baud rate or increasing the serial time out value in the project file Note See the manual for your particular board for more information before overwriting any part of the User block Note When using a board with serial bootflash e g RCM4300 RCM4310 wri
323. o conserve power Interrupts are enabled during this call LIBRARY UCOS2 LIB OSTaskQuery INT8U OSTaskQuery INT8U prio OS TCB pdata DESCRIPTION Obtains a copy of the requested task s task control block TCB PARAMETERS prio Priority number of the task pdata Pointer to task s TCB RETURN VALUE OS MO ERR The requested task is suspended OS PRIO INVALID The priority you specify is higher than the maximum allowed i e 2 OS LOWEST PRIO or OS PRIO_ SELF is not specified OS PRIO ERR The desired task has not been created LIBRARY UCOS2 LIB 306 rabbit com Dynamic C Functions OSTaskResume INT8U OSTaskResume INT8U prio DESCRIPTION Resumes a suspended task This is the only call that will remove an explicit task suspension PARAMETERS prio The priority of the task to resume RETURN VALUE OS NO ERR The requested task is resumed OS PRIO INVALID The priority specified is higher than the maximum allowed i e OS LOWEST PRIO OS TASK Mot SUSPENDED The task to resume has not been suspended LIBRARY UCOS2 LIB SEE ALSO OSTaskSuspend OSTaskStatHook void OSTaskStatHook void DESCRIPTION Called every second by uC OS II s statistics task This function resides in UCOS2 LIB and al lows an application to add functionality to the statistics task LIBRARY UCOS2 LIB Dynamic C Functions rabbit com 307 OSTaskStkChk INT8U OSTaskStkChk INT8U prio OS STK DATA pdata DESCRIPTION
324. o define your own error handler see the defineErrorHandler function When the error handler is called the following information will be on the stack Location on Stack Description SP 0 Return address for error handler call SP 2 Runtime error code SP 4 can be used for additional information SP 6 XPC when exception was called upper byte SP 8 Address where exception was called from RETURN VALUE Runtime error code passed to it LIBRARY ERRORS LIB SEE ALSO defineErrorHandler Dynamic C Functions rabbit com 75 exit void exit int exitcode DESCRIPTION Stops the program and returns exit code to Dynamic C Dynamic C uses values above 128 for run time errors When not debugging exit will run an infinite loop causing a watchdog timeout if the watchdog is enabled PARAMETERS exitcode Error code passed by Dynamic C LIBRARY SYS LIB exp float exp float x DESCRIPTION Computes the exponential of real float value x PARAMETERS x Value to compute RETURN VALUE Returns the value of e If x gt 89 8 approx the function returns INF and signals a range error If x lt 89 8 approx the function returns 0 and signals a range error LIBRARY MATH LIB SEE ALSO log log1l0 frexp ldexp pow powl0 sqrt 76 rabbit com Dynamic C Functions fabs float fabs float x DESCRIPTION Computes the float absolute value of float x PARAMETERS
325. o learn about the devices present on the driver passed in The device will be added to the linked list of enumerated devices Partition pointers will be set to NULL indi cating they have not been enumerated yet Partition entries must be enumerated separately The signature string is an identifier given to the write back cache and must remain consistent between resets so that the device can be associated properly with any battery backed cache en tries remaining in memory This function is called by fat _AutoMount and fat Init PARAMETERS driver Pointer to an initialized driver structure set up during the initialization of the storage device driver dev Pointer to the device structure to be filled in devnum Physical device number of the device sig Pointer to a unique signature string Note that this value must remain the same between resets norecovery Boolean flag set to True to ignore power recovery data True is any value except zero RETURN VALUE 0 success EIO error trying to read the device or structure EINVAL devnum invalid or does not exist ENOMEM memory for page buffer RJ is not available EUNFORMAT the device is accessible but not formatted You may use it provided it is format ted partitioned by either this library or by another system EBADPART the partition table on the device is invalid ENOPART the device does not have any FAT partitions This code is superseded by any other error detected
326. o the second flash This function is not reentrant Note This function should NOT be used if you are using the second flash device for a flash file system e g if you are writing a TCP IP based application Note This function is extremely dangerous when used with large sector flash Don t do it PARAMETERS flashDst Physical address of the flash destination rootSre Pointer to the root source len Number of bytes to write RETURN VALUE 0 Success 1 Attempt to write non 2nd flash area nothing written 2 rootsrc not in root 3 Time out while writing flash 4 Attempt to write to ID block 5 Sector erase needed write aborted LIBRARY XMEM LIB 532 rabbit com Dynamic C Functions WriteFlash2Array int WriteFlash2Array unsigned long flashDst void rootSrc unsigned numbytes int numsources j DESCRIPTION Write a set of scattered information to the 2nd flash in a contiguous block The sources are given in the root Src array and the corresponding number of bytes in each source is given in the numbytes array All sources must be in root numsources specifies the number of en tries in the root Src and numbytes arrays The flashDst address plus the sum of numbytes area must be within memory quadrant s already mapped to the second flash This function is not reentrant It was introduced in Dynamic C version 7 30 Note This function should NOT be used if you are using the second flash device for a flash file
327. of registry file as a Zserver resource name This file must not have an extension since the extensions 1 2 and so on are appended to the name section Section name to read may be NULL to read the anonymous section at the start of the registry file re Array of fields to read See registry read function description for details sctx Server context EI Callback function See registry enumerate for details keyvalues Boolean indicating whether callback receives key value pairs as well as section headers If false it only receives section headers ptr Arbitrary application data which will be dutifully passed through to the callback without alteration RETURN VALUE lt 0 general failure code will be negative of one of the codes in ERRNO LIB 0 OK LIBRARY register lib SEE ALSO registry prep read registry read registry finish read registry enumerate registry update Dynamic C Functions rabbit com 397 registry finish read int registry finish read RegistryContext r DESCRIPTION Finish reading a registry and clean up resources Most applications will use the sequence of functions registry prep read registry read and or registry enumerate registry finish read PARAMETER r RegistryContext struct as set by registry prep read RETURN VALUE lt 0 general failure code will be negative of one of the codes in ERRNO LIB 0 OK LIBRARY registry lib SEE ALSO registry read registry
328. oid Disable HW WDT void DESCRIPTION Disables the hardware watchdog timer on the Rabbit processor Note that the watchdog will be enabled again just by hitting it The watchdog is hit by the periodic interrupt which is on by default This function is useful for special situations such as low power sleepy mode LIBRARY SYS LIB disablelIObus void disableIObus void DESCRIPTION This function disables external I O bus and normal data bus operations resume on the Rabbit 3000 or Rabbit 4000 The external I O bus must be disabled during normal bus operations with other devices and must be enabled during any external I O bus operation This function is non reentrant Port A and B data shadow register values are NOT saved or restored in this function call Parallel port A is set to a byte wide input and parallel port B data direction register PBDDR is set to an unknown state which must be set by the user LIBRARY ExternIO LIB was in R3000 LIB prior to DC 10 SEE ALSO enablelIObus 46 rabbit com Dynamic C Functions DMAalloc dma chan t DMAalloc char channel mask int highest DESCRIPTION This function returns a handle to an available channel The handle contains the channel number and a validation byte to prevent use of an old handle after deallocation PARAMETERS channel mask Mask of all the acceptable channels to choose from highest Bool indicating whether to search for an available channel from
329. oid WrPortI int port char portshadow int data value DESCRIPTION Writes an internal I O register with 8 bits and updates shadow for that register PARAMETERS port Address of data register portshadow Reference pointer to a variable shadowing the register data Substitute with null pointer or 0 if shadowing is not required data_value Value to be written to the data register LIBRARY SYSIO LIB SEE ALSO RdPortI BitRdPortI BitRdPortE BitWrPortI RdPortE WrPortE BitWrPortE 540 rabbit com Dynamic C Functions xalloc long xalloc long sz DESCRIPTION Allocates the specified number of bytes in extended memory Starting with Dynamic C version 7 04P3 the returned address is always even word aligned Starting with Dynamic C 8 if xalloc fails a run time error will occur This is a wrapper functionfor xalloc for backwards compatibility Itisthesameas xalloc amp sz 1 XALLOC MAYBBB except that the actual allocated amount is not returned since the parameter is not a pointer Starting with Dynamic C 9 30 xalloc and related functions were modified so that they are now driven by the compiler origin directives Note xalloc is not thread safe since it accesses a global static structure with no lock ing PARAMETERS SZ Number of bytes to allocate This is rounded up to the next higher even number RETURN VALUE The 20 bit physical address of the allocated data Success 0 Failure Note Startin
330. oldered on device or 1 for the socketed NAND flash device RETURN VALUE 0 Success 1 Unknown index or bad internal I O port information 2 Error communicating with flash chip 3 Unknown flash chip type LIBRARY NFLASH LIB This function was introduced in Dynamic C 9 01 SEE ALSO CalculateECC256 ChkCorrectECC256 xCalculateECC256 xChkCorrectECC256 Dynamic C Functions rabbit com 249 nf InitDriver int nf InitDriver mbr_drvr driver void device list DESCRIPTION Initializes the NAND flash controller PARAMETERS driver Empty mbr_drvr structure It must be initialized with this function before it can be used with the FAT file system More information on this structure can be found in the Dynamic C Module document titled FAT File System User s Manual available on the Rabbit Semiconductor website device list fnot null this is a pointer to the head of a linked list of of device structures for NAND flash devices that have each already been initialized by calling nf initDevice If device_list is null then this function attempts to initialize all NAND flash devices and provide a default linked list of of device structures in order from device number 0 on up If the initialization of a NAND flash device is unsuccessful then its nf_device structure is not entered into the linked list RETURN VALUE 0 Success lt 0 Negative value of a FAT file system error code LIBRARY NFLASH FAT LIB This fu
331. olute byte is beyond the EOF file is split at EOF e FAT BRK END split at EOF e FAT BRK_ POS split at current file position newfile Pointer to the absolute path and name of the new file created for the split RETURN VALUE 0 success EIO device I O error EINVAL file has invalid references EPATHSTR newfile is not a valid path name string EEOF no unused clusters are available for newfile file will be unchanged and open newf ile is not created EPERM file is in use write protected hidden or system ENOENT file does not exist ETYPE file is not a FAT file type EBUSY the device is busy Only non blocking mode EFSTATE if file in inappropriate state Only non blocking mode LIBRARY FAT LIB SEE ALSO fat Open fat _OpenDir fat Delete fat Truncate fat Close 112 rabbit com Dynamic C Functions fat Status int fat Status fat part part char name fat dirent entry DESCRIPTION Scans for the specified entry and fills in the entry structure if found without opening the direc tory or entry PARAMETERS part Pointer to the partition structure being used name Pointer to the full path name of the entry to be found entry Pointer to the directory entry structure to fill in RETURN VALUE 0 success EIO device I O error EINVAL part filepath or entry are invalid ENOENT the file directory label does not exist EBUSY the device is busy Only non blocking mode If you get th
332. ond constant is set in your code before Huse fs2 lib Foi USE PROGRAM _ FLASH must be defined to the number of KB 1024 bytes that will ac tually be used by the file system If this is set to a larger value than the actual amount of reserved space then only the actual amount will be used The sample program SAMPLES FILESYSTEM FS2INFO C demonstrates use of this func tion This function may be called before calling fs init RETURN VALUE 0 There is no flash file system available 0 Logical extent number of the preferred flash LIBRARY FS2 1lib SEE ALSO fs get ram ix FS2 fs get other lx FBZ 160 rabbit com Dynamic C Functions fs get 1x FS2 FSLXnum fs get 1x int meta DESCRIPTION Return the current extent LX number for file creation Each file has two parts the main bulk of data and the metadata which is a relatively small fixed amount of data used to journal changes to the file Both data and metadata can reside on the same extent or they may be sep arated PARAMETERS meta 1 return logical extent number for metadata 0 return logical extent number for data RETURN VALUE Logical extent number LIBRARY FS2 1lib SEE ALSO foreate FS2 fs_set_ 1x FS2 Dynamic C Functions rabbit com 161 fs get 1x size FS2 long Ce get 1x size FSLXnum lxn int all word ls shift DESCRIPTION Returns the size of the specified logical extent in bytes This information is useful when
333. one sector to be allocated for the metadata Before calling this function a variable of type File must be defined in the application pro gram The sizeof function will return the number of bytes used for the File data struc ture File file fcreate amp file 1 PARAMETERS f Pointer to the file descriptor to fill in name File number including optional metadata extent number RETURN VALUE 0 Success 0 Failure ERRNO VALUES EINVAL Zero file number requested or invalid extent number EEXIST File with given number already exists ENFILE No space is available in the existing file table If this error occurs increase the def inition of FS_MAX FILES a define constant that should be declared before Huse fs2 1lib LIBRARY fs2 LIB SEE ALSO fcreate_unused FS2 fs_set_l1x FS2 fdelete FS2 Dynamic C Functions rabbit com 127 fcreate unused FS1 FileNumber fcreate unused File DESCRIPTION Searches for the first unused file number in the range through 127 and creates a file with that number PARAMETERS f The pointer to the created file RETURN VALUE The FileNumber 1 127 of the new file if success LIBRARY FILESYSTEM LIB SEE ALSO fcreate FS1 128 rabbit com Dynamic C Functions fcreate unused FS2 FileNumber fcreate unused File f DESCRIPTION Create a new file and return the file name which is a number between 1 and 255 The new file will b
334. ontain information about the mutex RETURN VALUE OS NO ERR The call was successful and the message was sent OS ERR QUERY ISR Function was called from an ISR OS ERR PEVENT NULL pevent is a null pointer OS ERR EVENT TYPE Attempting to obtain data from a non mutex LIBRARY OS _MUTEX C Dynamic C Functions rabbit com 283 OSQAccept void OSQAccept OS EVENT pevent DESCRIPTION Checks the queue to see if a message is available Unlike OSQPend with OSQAccept the calling task is not suspended if a message is unavailable PARAMETERS pevent Pointer to the message queue s event control block RETURN VALUE Pointer to message in the queue if one is available null pointer otherwise LIBRARY OS OC Prior to DC 8 UCOS2 LIB SEE ALSO OSQCreate OSQFlush OSQPend OSQPost OSQPostFront OSQQuery 284 rabbit com Dynamic C Functions OSQCreate OS EVENT OSQCreate void start INT16U qsize DESCRIPTION Creates a message queue if event control blocks are available PARAMETERS start Pointer to the base address of the message queue storage area The storage area MUST be declared an array of pointers to void void MessageStorage qsize qsize Number of elements in the storage area RETURN VALUE Pointer to message queue s event control block or null pointer if no event control blocks were available LIBRARY OS OC Prior to DC 8 UCOS2 LIB SEE ALSO OSQAccept OSQFlush OSQPend OSQPost
335. ory referenced by fd Note fd must have already been initialized with flash_init before calling this func tion See flash nit description for further restrictions PARAMETERS fd The FlashDescriptor of the flash memory to write to sector The destination sector buffer The physical address of the source TIP A logical address can be changed to a physical address with the function paddr RETURN VALUE 0 Success LIBRARY FLASH LIB SEE ALSO flash erasechip flash _erasesector flash gettype flash init flash read flash readsector flash sector2xwindow 144 rabbit com Dynamic C Functions floor float floor float x DESCRIPTION Computes the largest integer less than or equal to the given number PARAMETERS x Value to round down RETURN VALUE Rounded down value LIBRARY MATH LIB SEE ALSO ceil fmod fmod float fmod float x float y DESCRIPTION Calculates modulo math PARAMETERS x Dividend y Divisor RETURN VALUE Returns the remainder of x y The remaining part of x after all multiples of y have been re moved For example if x is 22 7 and y is 10 3 the integral division result is 2 Then the remain der is 22 7 2 x 10 3 2 1 LIBRARY MATH LIB SEE ALSO ceil floor Dynamic C Functions rabbit com 145 fopen rd FS1 int fopen rd File f FileNumber fnum DESCRIPTION Opens a file for reading PARAMETERS f A pointer to the file to read fnum A number in t
336. osition pointer is used for both read and write If interspersing read and write then fseek should be used to ensure the correct position for each operation Alterna tively the same file can be opened twice with one descriptor used for read and the other for write This precludes use of fshift since it does not tolerate shared files PARAMETERS Pointer to file descriptor initialized by fopen_wr or fcreate buf Data buffer located in root data memory or stack len Length of data 0 to 32767 inclusive RETURN VALUE len Success lt len Partial success Returns amount successfully written errno gives details 0 Failure or len was zero ERRNO VALUES EBADFD File descriptor not opened or is read only EINVAL len less than zero 0 Success but len was zero EIO I O error ENOSPC extent out of space LIBRARY fs2 LIB SEE ALSO fread FS2 174 rabbit com Dynamic C Functions ftoa int ftoa float f char buf DESCRIPTION Converts a float number to a character string The character string only displays the mantissa up to 9 digits no decimal points and a minus sign if is negative The function returns the exponent of 10 that should be used to compen sate for the string ftoa 1 0 buf yields buf 100000000 and returns 8 PARAMETERS f Float number to convert buf Converted string The string is no longer than 10 characters long RETURN VALUE The exponent of the number LIB
337. ot available or the event did not occur This function cannot be called from an ISR because mutual exclusion semaphores are intended to be used by tasks only PARAMETERS pevent Pointer to the event control block err Pointer to an error code that will be returned to your application e OS NO ERR if the call was successful e OS ERR EVENT TYPE if pevent is not a pointer to a mutex e OS ERR _PEVENT NULL pevent is a null pointer e OS ERR PEND ISR if you called this function from an ISR RETURN VALUE 1 Success the resource is available and the mutual exclusion semaphore is acquired 0 Error either the resource is not available or you didn t pass a pointer to a mutual exclusion semaphore or you called this function from an ISR LIBRARY OS _MUTEX C 278 rabbit com Dynamic C Functions OSMutexCreate OS EVENT OSMutexCreate INT8U prio INT8U err DESCRIPTION This function creates a mutual exclusion semaphore Note that e The LEAST significant 8 bits of the OSEventCnt field of the mutex s event control block are used to hold the priority number of the task owning the mutex or OxFF if no task owns the mutex e The MOST significant 8 bits of the OSEventCnt field of the mutex s event control block are used to hold the priority number to use to reduce priority inversion PARAMETERS prio err RETURN VALUE void 0 void 0 LIBRARY OS _MUTEX C The priority to use when accessing the mutual
338. ous as to whether it means 0 or 65536 LIBRARY DMA LIB SEE ALSO DMAloadBufDesc DMAsetDirect 58 rabbit com Dynamic C Functions DMAprintBufDesc void DMAprintBufDesc void dr long dp DESCRIPTION This is a debugging function only It formats and prints the contents of the buffer descriptor at dr or dp using bit 6 of the chanCont rol field to determine whether to assume a short or long format If dr is not NULL then the buffer descriptor is in root memory and dr is used Otherwise dp is assumed to be the physical address of the buffer descriptor in xmem PARAMETERS dr Pointer to buffer descriptor in root memory dp Address of buffer descriptor in physical memory LIBRARY DMA LIB SEE ALSO DMAprintRegs Dynamic C Functions rabbit com 59 DMAprintRegs void DMAprintRegs int chan int masters DESCRIPTION This is a debugging function only This prints the values of the hardware registers for the spec ified channel If masters is true then it also prints the values of the master DMA control regis ters Note that the Source and Destination Address registers are write only and read as zero PARAMETERS chan Channel number to print masters A bool to determine whether or not to print out the master registers shared between all channels LIBRARY DMA LIB SEE ALSO DMAprintBufDesc 60 rabbit com Dynamic C Functions DMAsetBufDesc int DMAsetBufDesc char chanControl unsigned int
339. p c scssseseeseeeeees 72 pmovebetween_fast enn 343 errlogGetHeaderInfo ccceeceeteeeeees 70 xvi rabbit com Dynamic C Functions errlogGetMessage giesgeesgieurgkediegesteiegeg 73 File Compression errlogGetNthEntry cccccsssseceesseeeees 71 CloseInputCompressedFile 006 28 errlogReadHeader gisss escsssesseeasssdencatsneess 73 CloseOutputCompressedFile 0 0 0 0 28 CLTOL_IMESSAGE secccsencceesecesesnsesescceees 74 CompressFile evening Eege 37 LE 75 DecompressFile ssassn 41 ResetError og sersa 412 OpenInputCompressedFile 256 OpenOutputCompressedFile 257 Extended Memory ReadCompressedFile scceeseeeeee 391 lege 542 AA EE 545 File System FAT eege AER 319 fat_AutoMount 5 cssisscdsecssssstsavsdacvnsnevens 78 GE E 320 fat el 81 paddi SS ebe dee 321 fat_CreateDir eec cece ceeecessccceesseeeeeeeees 82 TOOt2XMEM eseseseserererererererererererererereses 413 fat_CreateFile eeereeeressressses 83 KOT EE 541 fat_CreateTime ccccccecceeeceeeeeeeees 84 xa lloc stats oeeeeeececcccccccecsceeecseeeesecseseees 543 fat_Delete cccccccccccccceseseesseesseesesesees 85 UE 544 fat_EnumDevice cccccceessssseseeseeeeeees 86 ban COT E EET 548 fat_EnumPartition cceeeeeeeeseeeeeceeees 87 APEU eoa E 548 fat FileSize Ae 88 EAO I E E T 549 fat Porinat Device savicesssssincasevsseaniveurease 89 mem root o eeeeeecececcccccecseeesce
340. p caccecdasseaceccaaiverenieararens 440 servo od Zero D 441 Servo od zen 1 441 Servo read Table 442 servo_set_coeffs ccccccceecccccsessecseeeeeees 443 SELVO SE DOS spesies ror serinin reus 444 servo Se vel AA 445 servo_stats_reset cccccccecccccsssseceeseeeeees 445 SOE VO DOE serores iaren iniinda 446 SPI ee 491 SPIR ad WE 492 SPIW cite secies sieren 493 SPIWTR A euer ar e edetEe 494 OCU ca E T 175 E 177 LL 212 QUICKIES stat See 317 OTi E EEN 318 PDE eege 361 ule hiatus tensa aac ees 367 DUS seaside a eee 367 GL E 490 SPriDtE Tee iseen gege 495 String Manipulation servo_alloc_table En 430 MEMGHE srir eiris sneiru Eo Esn iiniu eds 237 EE a ete een ne 430 E 238 SELVO_disable_O en 431 TCT EE 239 Servg dieble leen 432 MEMMOVE REENEN ees 240 servo_enable_0 men 433 EISE ett Seed 241 seryo_enable_ l enen 434 dE 497 SE Ee 435 SCHE 25523 ssisssbsdesdssdsieassdesnedsdesea ers 498 Dynamic C Functions rabbit com xxvii SCID Aesgentietegbtr eedeggdee ng e E ERa 499 GetVectExtern3000 ceceesesseceeeeeees 181 STCP ee 500 GetVectIntern zueneen 182 SSI Eeer 501 EE Eeer 196 EE eebe 502 TSE ee 197 dE 503 PEMAIN attert 358 S NN Ed 504 set_cpu_power_Mode ccc 469 ne 505 set32kHzDivider EE 467 REENEN 506 setClockModulation eesseeeeeeeeeees 468 Ce EE 507 SetSeriaITATxXRValues eseeeeeeeeeeee 472 SE Geesen 508 sysResetChain j snengacsvssencacapaneeaspnenaies 517 el GE 509 TATIR SetValue wo
341. p s interrupt handling See Technical Note 301 Rabbit 2000 Microprocessor Interrupt Issue on the Rabbit Semi conductor website for more information Once this function is called both external interrupts 0 and 1 should be enabled with priority lev els set higher than any currently running interrupts All system interrupts in the BIOS run at interrupt priority 1 The interrupt priority is set via the control register IOCR for external inter rupt 0 and I1CR for external interrupt 1 The actual priority used by the interrupt service routine ISR is passed to this function PARAMETERS priority Priority the ISR should run at Valid values are 1 2 or 3 isr ISR handler address Must be a root address RETURN VALUE Address of vector table entry or zero if priority is not valid LIBRARY SYS LIB SEE ALSO GetVectExtern2000 SetVectIntern GetVectIntern Dynamic C Functions rabbit com 473 SetVectExtern3000 unsigned SetVectExtern3000 int interruptNum void isr DESCRIPTION Function to set one of the external interrupt jump table entries for the Rabbit 3000 and some versions of the Rabbit 2000 All Rabbit interrupts use jump vectors See Set Vect Intern for more information PARAMETERS interruptNum External interrupt number 0 and 1 are the only valid values isr ISR handler address Must be a root address RETURN VALUE Jump address in vector table LIBRARY SYS LIB SEE ALSO GetVectExtern3000
342. pecified time out OS FLAG ERR WAIT TYPE You didn t specify a proper wait type argument RETURN VALUE The new state of the flags in the event flag group when the task is resumed or 0 if a timeout or an error occurred LIBRARY OS _FLAG C Prior to DC 8 UCOS2 LIB 264 rabbit com Dynamic C Functions OSFlagPost OS FLAGS OSFlagPost OS FLAG GRP pgrp OS FLAGS flags INT8U opt INT8U err DESCRIPTION This function is called to set or clear some bits in an event flag group The bits to set or clear are specified by a bitmask Warnings e The execution time of this function depends on the number of tasks waiting on the event flag group e The amount of time interrupts are DISABLED depends on the number of tasks waiting on the event flag group PARAMETERS pgrp Pointer to the desired event flag group flags If opt see below is OS FLAG SET each bit that is setin flags will set the corresponding bit in the event flag group E g to set bits 0 4 and 5 you would set flags to 0x31 note bit 0 is least significant bit If opt see below is OS_ FLAG CLR each bit that is set in flags will CLEAR the corresponding bit in the event flag group E g to clear bits 0 4 and 5 you would specify flags as 0x31 note bit 0 is least significant bit opt Indicates whether the flags will be set OS FLAG SET or cleared OS FLAG CLR err Pointer to an error code Valid values are e OS NO ERR The call was successful e OS FLA
343. pmovebetween fast void pmovebetween fast Pool t p void e void d void f DESCRIPTION See description under pnovebetween This is an assembler callable version do not call from C It does not issue IPSET protection or check parameters REGISTERS Parameters in IX DE BC HL respectively Trashes AF BC DE BC DEI HU Return value in HL carry flag PARAMETERS p Pool handle structure as previously passed to pool init Pass in IX register e Address of element to move Pass in DE register d The first reference element Pass in BC register f The second reference element Pass in HL register RETURN VALUE In HL Either set to e parameter or 0 The carry flag is set if HL 0 otherwise it is clear LIBRARY POOL LIB SEE ALSO pmovebetween Dynamic C Functions rabbit com 343 pnel word pnel Pool t p DESCRIPTION Return the number of elements that are in the pool both free and used This includes elements appended using pool append etc PARAMETERS p Pool handle structure as previously passed to pool_init or pool xinit RETURN VALUE Number of elements total LIBRARY POOL LIB SEE ALSO pool init pool xinit pavail 344 rabbit com Dynamic C Functions pnext void pnext Pool t p void e DESCRIPTION Get the next allocated element in a root pool The pool MUST be set to being a linked pool using pool link p lt non zero gt otherwise the r
344. pointers are near pointers append _n to the function name ep mn strtod For more information about FAR pointers see th Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR Warning The far version of strtod is not backwards compatible with near pointers due to the use of a double pointer The problem is that char tailptr is a 16 bit pointer pointing to another 16 bit pointer The far version char far far tailptr is a 32 bit pointer pointing to a 32 bit pointer If you pass a double near pointer as the argument to the double far pointer function the double dereference tailptr of the double pointer will attempt to access a 32 bit address pointed to by the passed near pointer The compiler does not know the contents of a pointer and will assume the inner pointer is a 32 bit pointer For more information about FAR pointers please see the Dynamic C User s Man ual In the following examples 1 byte x x indicates a NEAR address 16 bit upcast to FAR Passing a char far far ptr as tailptr ADDRESS DATA 1 _ x x y y y y tailptr y y y y z z z z tailptr z z z z Correct contents tailptr Dynamic C Functions rabbit com 515 strtol cont d Passing a char ptr as tailptr Note the first pointer can be upcast to FAR but the compiler doesn t know to upcast the internal pointer ADDRESS DATA _ x x 1 y
345. prep read registry prep write registry write registry finish write registry enumerate registry update registry get 398 rabbit com Dynamic C Functions registry finish write int registry finish write RegistryContext r DESCRIPTION Finish updating a registry and clean up resources Most applications will use the sequence of functions registry prep write registry write registry finish write PARAMETER r RegistryContext structure as set by registry prep read RETURN VALUE lt 0 general failure code will be negative of one of the codes in ERRNO LIB 0 OK LIBRARY registry lib SEE ALSO registry read registry _ prep read registry prep write registry write registry finish read registry enumerate registry update registry get Dynamic C Functions rabbit com 399 registry prep read int registry prep read RegistryContext r char basename ServerContext context DESCRIPTION Prepare for reading a registry This function helps organize registry resources in order to create a robust registry Most applications will use the sequence of functions registry prep read registry _read and or registry enumerate registry finish read or simply registry get Registry updates require reading from an old registry editing it then writing the modified result to a new registry resource This requires two resources to be open Normally the old registry will be deleted on
346. r long xmemchr long src char ch unsigned short n DESCRIPTION Search for the first occurrence of character ch in the xmem area pointed to by src PARAMETERS src xmem linear address of the first character to search ch Character to search for n Maximum number of characters to search RETURN VALUE 0 Character was not found within n bytes from the start gt 0 Physical address of the first character that matched ch LIBRARY XMEM LIB 552 rabbit com Dynamic C Functions xmemcmp int xmemcmp long xstr char str unsigned short n DESCRIPTION Test whether xmem string at xstr matches the root memory string at str n bytes are com pared PARAMETERS xstr xmem linear address of the first character of the first string to compare str root address of the first character of the second string to compare n Length of each string If n is zero returns zero n must be less than or equal 4097 RETURN VALUE 0 Exact match gt 0 xstr gt str lt 0 xstr lt str LIBRARY XMEM LIB Dynamic C Functions rabbit com 553 xrelease void xrelease long addr long sz DESCRIPTION Release a block of memory previously obtained by xalloc or by xavail witha non null parameter xrelease may only be called to free the most recent block obtained It is NOT a general purpose malloc free type of dynamic memory allocation Calls to xalloc xrelease must be nested in first allocated last released order
347. r error detected EXIST if the device has already been enumerated EBUSY if the device is busy LIBRARY PART LIB 230 rabbit com Dynamic C Functions mbr FormatDevice int mbr FormatDevice mbr dev dev DESCRIPTION Creates or rewrites the Master Boot Record on the device given The routine will only rewrite the Boot Loader code if an MBR already exists on the device The existing partition table will be preserved To modify an existing partition table use mbr_CreatePartion Note This routine is NOT PROTECTED from power loss and can make existing parti tions inaccessible if interrupted Note This function is BLOCKING PARAMETERS dev Pointer to MBR device structure RETURN VALUE 0 for success EEXIST if the MBR exists writing Boot Loader only EIO for Error trying to read the device or structure EINVAL if the Device structure is not valid ENOMEM if memory for page buffer is not available EPERM if drive has mounted or FS enumerated partition s LIBRARY PART LIB Dynamic C Functions rabbit com 231 mbr MountPartition int mbr MountPartition mbr drive drive int pnum DESCRIPTION Marks the partition as mounted It is the higher level codes responsibility to verify that the fs_ part pointer for a partition is not in use null as this would indicate that another system is in the process of mounting this device PARAMETERS drive Pointer to a drive structure pnum Partition number to be mo
348. r s memory for each NAND flash device a run time error will occur if the available xmem RAM is insufficient There are two modes of operation for NAND flash devices FAT and direct If you are using the FAT file system in the default configuration i e the NAND flash has one FAT partition that takes up the entire device you do not need to call nf__initDevice You only need to call nf InitDriver which is the default device driver for the FAT file system on a NAND flash device Configurations other than the default one require more work For example having two parti tions on the device one a FAT partition and the other a non FAT partition require you to know how to fit more than one partition on a device A good example of how to do this is in the remote application upload utility The function dlm_initserialflash in LIB RCM3300 downloadmanager 11ib is where to look for code details The upload utility is specifically for the RCM3300 however even without the RCM3300 the utility is still useful in detailing what is necessary to manage multiple partitions The second mode of operation for NAND flash devices is direct access An application that di rectly accesses the NAND flash using calls such as not readPage and nf writePage may define NFLASH USEERASEBLOCKSIZE to be either 0 zero or 1 one before NFLASH LIB is used in order to set the NAND flash driver s main data pro gram unit size to either the devices program
349. r to a memory block or a null pointer if an error condition is detected LIBRARY UCOS2 LIB SEE ALSO OSMemCreate OSMemPut OSMemQuery Dynamic C Functions rabbit com 275 OSMemPut INT8U OSMemPut OS MEM pmem void pblk DESCRIPTION Returns a memory block to a partition PARAMETERS pmem Pointer to the partition s memory control block pblk Pointer to the memory block being released RETURN VALUE OS MO ERR The memory block was inserted into the partition OS MEM FULL If returning a memory block to an already FULL memory partition More blocks were freed than allocated LIBRARY UCOS2 LIB SEE ALSO OSMemCreate OSMemGet OSMemQuery 276 rabbit com Dynamic C Functions OSMemQuery INT8U OSMemQuery OS MEM pmem OS MEM DATA pdata DESCRIPTION Determines the number of both free and used memory blocks in a memory partition PARAMETERS pmem Pointer to partition s memory control block pdata Pointer to structure for holding information about the partition RETURN VALUE OS NO ERR This function always returns no error LIBRARY UCOS2 LIB SEE ALSO OSMemCreate OSMemGet OSMemPut Dynamic C Functions rabbit com 277 OSMutexAccept INT8U OSMutexAccept OS EVENT pevent INT8U err DESCRIPTION This function checks the mutual exclusion semaphore to see if a resource is available Unlike OSMutexPend OSMutexAccept does not suspend the calling task if the resource is n
350. rFdatabits EE 448 SEPCPULG e T 458 SEPPUMAOEE sscsvesercsssaesssvadeas ir reenn E era 449 E LEE 459 serFdmaOn EE 450 SCrCrdFlUsh cccccecscecscecececseececeeeeeeseeeseeses 460 serFflowcontrolOff cccecccecececececececececeeeneees 451 SEET eis ccc ssieisesias deed dee iiis noii 460 serFflowcontrolOn cccccecececeeecececececeeeeesenes 452 SCrCrdUsed ccccccecececeesceeeceeecceseeeseceseseseesss 461 EE 453 Ser Cre ad 2assieeseeacaze teas ee der EEE 462 serFgetError NEEN ENEE 454 serCwrFlush ccccccccecececececececcceceeeceeeeeeeeeees 463 SCLFOPCN cccscecececececscccsceecccesceeeceeseceseeesseess 455 serCwrFree ccecsccccceceessssssececececeesessnseaeeeees 463 STF Parity ccccccccccccccsesessssscecececeessssssaeecees 456 SERIES gedd Ed Ed 464 SELF Pek deed edd Ed assess 457 serCwrUsed 505s05ssecesssedsvessdsasvessiesesdsedssedoree 465 BEER sss sadessesbevensssssdesniotecdsetsseusessstargese 458 Serfieloegosgegdddeeie tege deed eege Ed 448 SCLFPUts cccccecccececeeeceeeceeeceeseceeceescceseeeeseess 459 SerDdatabits cccccccccccecececececececeeececeeeeeeeees 448 serFrdFlush cccccecccecececececececececeeeceeeeeeeeeees 460 SEMDAMAOM sorses esasi arises esis 449 D EE 460 SerDdMAON E 450 SQrPtdU sed ssscecsssesdeesssdsieassiesiasdsseeueasssaess 461 serDflowcontrolOff ccccecccecececececeeeeeeeeeees 451 SELPICA EE 462 serDflowcontrolOn cccccececesecececececeseceeeeeees 452 SELF WIFIUSH cccc
351. rabbit com Dynamic C Functions hannreal void hannreal int x int N int blockexp DESCRIPTION Convolves an N point positive frequency complex spectrum with the three point Hann kernel The function produces the same results as would be obtained by multiplying the corresponding time sequence by the Hann raised cosine window The zero crossing width of the main lobe produced by the Hann window is 4 DFT bins The adjacent sidelobes are 32 db below the main lobe Sidelobes decay at an asymptotic rate of 18 db per octave The imaginary part of the dc term stored in x 1 is considered to be the real part of the fmax term The dc and fmax spectral components take part in the convolution along with the other spectral components The real part of fmax component affects the real part of the X N 1 com ponent and vice versa and should not arbitrarily be set to zero unless these components are unimportant PARAMETERS x Pointer to N element array of complex fractions N Number of complex elements in array x blockexp Pointer to integer block exponent RETURN VALUE None The filtered spectrum replaces the original spectrum LIBRARY FFT LIB SEE ALSO fftcplx fftcplxinv fftreal fftrealinv hanncplx powerspectrum Dynamic C Functions rabbit com 185 HDLCabortxX void HDLCabortX void Where X is E or F DESCRIPTION Immediately stops any transmission An HDLC abort code will be sent if the driver was in the
352. ration callsdspi_ WriteContinue to com plete only when SD_NON_BLOCK is defined LIBRARY SDFLASH LIB Dynamic C Functions rabbit com 429 servo alloc table void servo alloc table int which int entries DESCRIPTION Allocate an xmem data area for servo statistics collection This function should be called once only for each servo at application startup time PARAMETERS which Servo 0 or 1 entries Number of entries to allocate Each entry is 8 bytes and stores 4 integer values The maximum value for this parameter is 8190 LIBRARY SERVO LIB SEE ALSO servo graph servo read table servo stats reset servo closedloop void servo closedloop int which int reset DESCRIPTION Run specified servo in closed loop PID mode PARAMETERS which Servo 0 or 1 reset Whether to reset the current command list The command list executes even while in open loop mode although it will have no visible effect in that mode If reset is non zero then the command list will be reset to empty and the motor will halt at the current position LIBRARY SERVO LIB SEE ALSO servo openloop servo torque 430 rabbit com Dynamic C Functions servo disable 0 void servo disable 0 void DESCRIPTION Disable drive to the first servo motor This function only works if an auxiliary control signal is connected to the motor driver The I O pin used for this function is specified by the macros define SERVO ENABLE PORT_0
353. re information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS sre String to be scanned brk Set of characters RETURN VALUE Returns the length of the segment LIBRARY STRING LIB 510 rabbit com Dynamic C Functions strstr NEAR SYNTAX char n_strstr char sl char s2 FAR SYNTAX char far f strstr char far sl char far s2 Note By default strstr is defined to pn strstr DESCRIPTION Finds a substring specified by s2 in string s1 For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR STRING macro is de fined and all pointers are near pointers append _n tothe functionname e g n_ strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS s1 String to be scanned s2 Substring to search for RETURN VALUE Pointer to the first occurrence of substring s2 in s1 Returns null if s2 is not found in s1 LIBRARY STRING LIB SEE
354. return values below are new with Dynamic C 10 21 2 No valid user block found block version 3 or later 3 flash writing error The return values below are applicable only if SPI USE UCOS MUTEX is not defined ETIME Serial flash only time out waiting for SPI postive N Serial flash only SPI in use by device N LIBRARY IDBLOCK LIB SEE ALSO readUserBlock writeUserBlockArray 536 rabbit com Dynamic C Functions writeUserBlockArray int writeUserBlockArray unsigned addr void sources unsigned numbytes int numsources DESCRIPTION Rabbit Semiconductor boards are released with System ID blocks located on the primary flash Version 2 and later of this ID block has a pointer to a User block that can be used for storing calibration constants passwords and other non volatile data The User block is protected from normal write to the flash device and can only be accessed through this function or writeUserBlock This function writes a set of scattered data from root memory to the User block If the data to be written are in contiguous bytes using the function writeUserBlock is sufficient Use of writeUserBlockArray is recommended when the data to be written is in noncon tiguous bytes as may be the case for something like network configuration data See the designer s handbook for your Rabbit processor e g the Rabbit 4000 Designer s Hand book for more information about the System ID and Us
355. rfu DESCRIPTION To modify or add to the default extents this function must be called before calling fs_init Ifcalled after fs init the filesystem will be corrupted fs _setup runs in one of two basic modes determined by the partition _it parame ter Ifpartition_it is non zero then the specified extent 1xn which must exist is split into two extents according to the given proportions If partition_it is zero then the spec ified extent must not exist it is created This use is beyond the scope of this note since it in volves filesystem internals The paritioning usage is described here partition_it may be FS_MODIFY_ EXTENT in which case the base extent 1xn is mod ified to use the specified 1s shift and reserve _ it parameters the other parameters are ignored partition_it may be setto FS _PARTITION_FRACTION other values reserved This causes extent number 1xn to be split The first half is still referred to as extent 1xn and the other half is assigned a new extent number which is returned The base extent number may itself have been previously partitioned or it should be 1 for the 2nd flash device or possibly 2 for the NVRAM device PARAMETERS Lan Base extent number to partition or modify Le shift New logical sector size to assign to base partition or zero to not alter it This is expressed as the log base 2 of the desired size and must be a num ber between 6 and 13 inclusive reserve it TRUE if base par
356. riable that returns the status RETURN VALUE 0 Success Card status placed in status EIO I O error ENOMEDIUM No SD card in socket ESHAREDBUSY Shared SPI port busy LIBRARY SDFLASH LIB 418 rabbit com Dynamic C Functions sdspi init card int sdspi_ init card ed device sd DESCRIPTION Initializes the SD card pointed to by sd Function executes protocol command 1 which clears HCS bit and activates the card s initialization sequence PARAMETERS sd Pointer to sd_device structure for the SD card RETURN VALUE 0 Success EIO I O error EINVAL Invalid parameter given ENOMEDIUM No SD card in socket ESHAREDBUSY Shared SPI port busy LIBRARY SDFLASH LIB Dynamic C Functions rabbit com 419 Sdepi initDevice int sdepi initDevice int indx sd dev_interface sd dev DESCRIPTION Initializes the SD card pointed to by sd_ dev and adds information about the cards interface to the SD device array in the position pointed to by indx Sets up the default block size of 512 bytes used by sector read write functions This function should be called before any calls to other sdspi functions PARAMETERS indx Index into the SD device array to add the card sd dev Pointer to sd_dev_interface for the SD card RETURN VALUE 0 Success EIO I O error EINVAL Invalid parameter given ENOMEDIUM No SD card in socket ESHAREDBUSY SPI port busy LIBRARY SDFLASH LIB 420 rabbit com
357. rm of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXwrFlush int port where port is one of the macros SER_PORT A through SER_PORT E LIBRARY RS232 L1IB serXwrFree int serXwrFree void where X is A F DESCRIPTION Calculates the free space in the serial port transmit buffer This function is non reentrant The functions serEwrFree and serFwrFree may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXwrFree port where port is one of the macros SER_PORT A through SER_PORT E RETURN VALUE The number of characters the serial port transmit buffer can accept before becoming full LIBRARY RS232 LIB Dynamic C Functions rabbit com 463 serXwrite int serXwrite void data int length X is A F DESCRIPTION Transmits length bytes to serial port X This function is non reentrant The functions serEwrite and serFwrite may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generali
358. rwriting any part of the User block Also see the Rabbit Microprocessor Designer s Handbook for more information on the User block Note When using a board with serial bootflash e g RCM4300 RCM4310 readUserBlockArray should be called until it returns zero or a negative error code A positive return value indicates that the SPI port needed by the serial flash is in use by another device However if using uC OS II and SPI USE UCOS MUTEX is defined then this function only needs to be called once If the mutex times out waiting for the SPI port to free up the run time error ERR_SPI_ MUTEX ERROR will occur See the description for _rcm43 InitUCOSMutex for more information on using uC OS II and SPI USE UCOS MUTEX PARAMETERS dest Pointer to destination to copy data to addr Address offset in User block to read from numbytes Number of bytes to copy RETURN VALUE 0 Success 1 Invalid address or range 2 No valid ID block found block version 3 or later The return values below are applicable only if SPI USE UCOS MUTEX is not defined ETIME Serial flash only time out waiting for SPI postive N Serial flash only SPI in use by device N LIBRARY IDBLOCK LIB SEE ALSO writeUserBlock readUserBlockArray Dynamic C Functions rabbit com 393 readUserBlockArray int readUserBlockArray void dests unsigned numbytes int numdests unsigned addr DESCRIPTION Reads a number of bytes from the
359. s 176 fcreate_wnused FS2 s sesesscsscsssessssesessesessess 129 Betdivider 19200 ececccccccececececececeeeceeeceeeeeees 177 TEE Aen 130 BETS ENEE 177 fdelete FS2 EE 131 GetVectExtern2000 EENS 180 fflush ES c cccccesecscssesccscssesecscssssesseeseees 132 GetVectExtern3000 ENEE TEL EE 133 GetVectintern EE 7 a Te UE E 134 SPS_SEt_POSIUON ENEE as canes ances EE E 183 GIE 136 gps_ground_distance ENEE 183 flash_eraseChip ccccccececececesececeseseseseeeseeeecs 137 H flash erasesector ccccececccescececcecececenseceees 138 O E 139 eege asara iassa iait 184 UE 140 hannreal 5 d s idee dees Ee eege EE 185 flash TCA ssdssccecesccecesisstececedsoat eesdeacevasseesenss 141 HDL CabortE ccccccccccccecccccescccceccesceccessens 186 leger 142 IK 186 flash_sector2xwindow saacccnessacccesasseecensseneadas 143 HDLCcloseE eege 186 eeh rte aideetaieagsapieceen 144 HDLCceloseF gebeten eedetgeebieegeiege 186 HOOT ech cere eae este reas E totes 145 EIERE 187 nette 145 HDLCdropF EE 187 fopen td CET 146 HDLCerrorE seciarp tet eied ena acacesccnctiaahenwiaade 187 fopen rd FSZ eir 147 HDLCerrorF gestiegen 187 open WE deeg EE ees see 148 HDLCextClockE cssseseeececcceccecsesececeecees 188 fopen Wi FS2 cdcaxtcsieastssesnscsexeccacturstencsieete 149 UID CaxiC la Gels csiccucessaccsayioxecceeisdetexnesacecan 188 forceSoftReset cccescccsesceeneeceeseecaesceaaecees 150 HDLCopenE pe ctcadavesccaseeedisserriecestinaiaerne 189
360. s 460 serEflowcontrolOff ccecccecececececececeeeceeeeeees 451 serBrdFree cccccecececeeeceeeceeeccesceesceeseeeseesss 460 serEflowcontrolOn cccccececeeeceeeceeeceeeceeeeeees 452 serBrdUsed cc ccccccceceesessssscecececeesesssscaeeeees 461 SEP E 453 E 462 STE GEO edd ge 454 serBwrFlush cccccccecceeceeecceeceeeceeseeeseeeseesss 463 SEMEOPEM eut Eege DEE irinin 455 serBwrFree cccccecececeeeceeeceescceeceeseeeseeeseeses 463 SCLEPArity cccccccccecececececeesceesecesceescceseeesscess 456 SELB WIite cccccccececeeeceeeceeeceeseceeceeseeeseeeseeses 464 SCLEPCeKk csser itronn neni ienaa ir eneas 457 se BwiUsed serpen eaa E A 465 SETEPULC deed SS 458 SCTCClOSE EE 448 SP EPUts gedet ge te deer ee ierge egene Eed 459 SerCdatabits cccccccccccceccceceeecececeeeceeeeeeeeeees 448 serErdFlush ccccccccecececececececeeecececeeeeeeesenes 460 SerCdmaOSel cccccccecccecececeescceeceesceeseeeseeses 449 serErdFree ccccececeescececeeeceeseeeeceesceeseceeseees 460 SCLCAMAON ssrin aas 450 S rErdU sed aisssais 25ssecasisivoedieiaioes serii 461 serCflowcontrolOff ccccccecccecececeeeceeeceeeeeees 451 Serben srasesriaisi k nei ii 462 serCflowcontrolOn ccccccecececeeecececeeeceeeeeees 452 serEwrFlush ccccccccecececececececceeceeeceeeeeeeeees 463 SEN EUS tee 453 serEwrFree geegent 463 SerC etEMor orrira r EN AS 454 E E 464 SCTCOPEN REENEN 455 serEwrUsed REENEN 465 SERA 456 SEO eege eege 448 e ET 457 Se
361. s License will constitute a waiver unless expressly waived in writing signed by a duly authorized representative of Rabbit and no single waiver will constitute a continuing or subsequent waiver This License may not be assigned sublicensed or otherwise transferred by You by operation of law or otherwise without Rabbit s prior written consent This License shall be governed by and construed in accordance with the laws of the United States and the State of California exclusive of the conflicts of laws principles The United Nations Convention on Contracts for the International Sale of Goods shall not apply to this License If for any reason a court of competent jurisdiction finds any provision of this License or portion thereof to be unenforceable that provision of the License shall be enforced to the maximum extent permissible so as to affect the intent of the parties and the remainder of this License shall continue in full force and effect This License constitutes the entire agreement between the parties with respect to the use of the Software and its doc umentation and supersedes all prior or contemporaneous understandings or agreements written or oral regarding such subject matter There shall be no contract for purchase or sale of the Software except upon the terms and conditions specified herein Any additional or different terms or conditions pro posed by You or contained in any purchase order are hereby rejected and shall be of no force and
362. s bps setting differs by more than 5 of the input baud LIBRARY PACKET LIB Dynamic C Functions rabbit com 335 pktXreceive int pktXreceive void buffer int buffer size X is A F DESCRIPTION Gets a received packet if there is one from serial port X The functions pktEreceive and pktFreceive may be used with the Rabbit 3000 and Rabbit 4000 PARAMETERS buffer A buffer for the packet to be written into buffer size Length of the data buffer RETURN VALUE gt 0 Number of bytes in the successfully received packet 0 No new packet has been received 1 The packet is too large for the given buffer 2 Aneeded test_packet function is not defined LIBRARY PACKET LIB 336 rabbit com Dynamic C Functions pktXsend int pktXsend void send buffer int buffer length char delay X is A F DESCRIPTION Initiates the sending of a packet of data using serial port X This function will always return im mediately If there is already a packet being transmitted this call will return 0 and the packet will not be transmitted otherwise it will return 1 pktXsending checks if the packet is done transmitting The system will be using the buff er until then The functions pktEsend and pktFsend may be used with the Rabbit 3000 and Rabbit 4000 PARAMETERS send buffer The data to be sent buffer length Length of the data buffer to transmit delay The number of byte times to delay b
363. s of this License iv use and distribute with Qualified Applications and Qualified Systems the program files distributed with Dynamic C named RFU EXE PILOT BIN and COLDLOAD BIN in their unaltered forms 3 Restrictions Except as otherwise stated You may not nor permit anyone else to decompile reverse engineer disassemble or otherwise attempt to reconstruct or discover the source code of the Software alter merge modify translate adapt in any way prepare any derivative work based upon the Software rent lease network loan distribute or otherwise transfer the Software or any copy thereof You shall not make copies of the copyrighted Software and or documentation without the prior written permis sion of Rabbit provided that You may make one 1 hard copy of such documentation for each User and a reasonable number of back up copies for Your own archival purposes You may not use copies of the Software as part of a benchmark or comparison test against other similar products in order to pro duce results strictly for purposes of comparison The Software contains copyrighted material trade secrets and other proprietary material of Rabbit and or its licensors and You must reproduce on each copy of the Software all copyright notices and any other proprietary legends that appear on or in the original copy of the Software Except for the limited license granted above Rabbit retains all right title and interest in and to all intellectual propert
364. s operation is not applicable 0 is returned with no further action Note Please see the comments at the top of log 1ib for a description of the message logging subsystem PARAMETER ld Destination class and stream Use one of the constants LOG_DEST_FS2 or LOG _DEST_XMEM then OR in the stream number 0 63 RETURN VALUE 0 success 2 The stream is out of range for the class LIBRARY log 1lib 214 rabbit com Dynamic C Functions log close int log close LogDestClass ldc DESCRIPTION Close the specified class enumerating all streams If the destination class is already closed re turns success Note Please see the comments at the top of log 1ib for a description of the message logging subsystem PARAMETER ldc Destination class Use one of the constants LOG_DEST_FS2 LOG DEST XMEM LOG DEST UDP or LOG DEST ALL The latter case closes all open destinations RETURN VALUE 0 success LIBRARY log lib Dynamic C Functions rabbit com 215 Log condition int log condition LogDest ldst DESCRIPTION Return the state of the specified log destination Destination classes or streams that are not con figured cause a 2 return code Note Please see the comments at the top of log 1ib for a description of the message logging subsystem PARAMETER ldst Destination class and stream Use one of the constants LOG_DEST_FS2 or LOG _DEST_XMEM then OR in the stream number 0 63 RETURN VALUE 0 Des
365. s successful case 1 to get here TO called longjmpQ do exception handling break case 2 similar to above but different exception code g g longjmp e 2 exception code 2 jump to setjmp statement setjmpQ returns 2 so execute case 2 in the switch statement PARAMETERS env Information about the current state RETURN VALUE Returns zero if it is executed After longjmp is executed the program counter stack point er and etc are restored to the state when set jmp was executed the first time However this time set jmp returns whatever value is specified by the Llongjmp statement LIBRARY SYS LIB SEE ALSO longjmp Dynamic C Functions rabbit com 471 SetSerialTATxRValues long SetSerialTATxRValues long bps char divisor int tatxXr DESCRIPTION Sets up the possibly shared serial timer TATxR resources required to achieve as closely as possible the requested serial bps rate The algorithm attempts to find when necessary and if possible the lowest value for the TATIR that will precisely produce the requested serial bps rate For this reason an application that requires the TATIR to be shared should generally first set up its usage with 1 the most critical timer A1 cascade rate or 2 the lowest timer A1 cas cade rate That is consider setting up the most critical stage PWM servo triac ultra precise serial rate etc first else set up the slowest usage ofte
366. s the Rabbit clock doubler If the doubler is already enabled there will be no effect Also attempts to adjust the communication rate between Dynamic C and the board to compensate for the frequency change User serial port rates need to be adjusted accordingly Also note that sin gle stepping through this routine will cause Dynamic C to lose communication with the target LIBRARY SYS LIB SEE ALSO clockDoubleroOff clockDoubleroOf t void clockDoublerOff void DESCRIPTION Disables the Rabbit clock doubler If the doubler is already disabled there will be no effect Also attempts to adjust the communication rate between Dynamic C and the board to compen sate for the frequency change User serial port rates need to be adjusted accordingly Also note that single stepping through this routine will cause Dynamic C to lose communication with the target LIBRARY SYS LIB SEE ALSO clockDoublerOn Dynamic C Functions rabbit com 27 CloseInputCompressedFile void CloseInputCompressedFile ZFILE ifp DESCRIPTION Close an input compression file opened by O penInputCompressionFile This file may be a compressed file that is being decompressed or an uncompressed file that is being com pressed In either case this function should be called for each open import ZFILE once it is done being used to free up the associated input buffer PARAMETERS ifp File descriptor of an input compression ZFILE RETURN VALUE None
367. s the data is read back out with this same flag Ignored on R4000 based cores but reserved for legacy code support e SF_RAMBANK1 default Writes to the first RAM bank on the flash de vice e SF_RAMBANK2 Writes to the alternate RAM bank on the flash device RETURN VALUE 0 Success 1 Error LIBRARY SFLASH LIB 486 rabbit com Dynamic C Functions sf writePage int sf writePage sf device dev int bank long page DESCRIPTION Replaces sf RAMToPage Command the serial flash to write its RAM buffer contents to one of its flash memory pages Check for completion of the write operation using sf isWriting PARAMETERS dev bank page RETURN VALUE 0 Success 1 Error LIBRARY SFLASH LIB Pointer to sf device struct for initialized flash device Which RAM bank to write the data from For Atmel 45DBxxx devices this can be 1 or 2 The page to write the RAM buffer to Dynamic C Functions rabbit com 487 sf writeRAM int sf writeRAM char buffer int offset int len DESCRIPTION Write data to the RAM buffer on the serial flash chip Note This function blocks and only works on boards with one serial flash device PARAMETER buffer offset len RETURN VALUE 0 for success 1 for error LIBRARY SFLASH LIB Pointer to data that will be written the flash chip RAM Address in the serial flash RAM to start writing at Number of bytes to write sfspi init int sfspi_ in
368. se 60 hat Seek Torrine 109 DMASetBufDesc ccceeeeeesersececeeeeeeeseensnaeees 61 E dE 111 DMASetDirect ccccccececececececececececeeeeeseceeeees 62 PAL SPL rscscves ceessseseaesssasesessdestheeeseaseessseeasess 112 DMAsetParameters sessesscceceeeeeeeseenseaeees 63 fat Status cs ciiiivechclecoatesdeisscesdaagendecaseaseidiczas 113 DMAStartAUto cccccccceceeesessensececeeeeeenesessnaeees 64 fat_SyncFile EEN 114 DMAStartDirect ccccccceseesessecececeeesessenseaeees 65 fat_SyncPartition cccceceesecsececeeeeeseesenneees 115 IDMAStOD viccecsusatsasteneetastze teanederedeateriesdeteatece 66 PAGS KEE 116 DMAStopDirect cccccceseesersceceeeeeensseseeaeees 67 Pat TICK EE 117 DMAtimerSetup ccceeceseensecececeeeeeseesseaeees 67 fat_Truncate E 118 DMAunalloc cccccccceceeeseesenseeeceeeesenssensnaeees 68 fat_UnmountDevice cesecseccceeeeeseeseeaeees 119 fat_UnmountPartition ccccececscesseeeceees 120 E fat Write ereti mence snddieceuedaceweueciacien 121 eNAableIODUS c cece ee ecececescecececcececcsnceceecs 69 Fat_XRead ENEE 122 123 vi rabbit com Dynamic C Functions fat_XWYite c cccscccssecccesccccsscccsceccesceceeees 124 G ee TEE 125 EEN 126 Get_CPU_fTEQUENCY ENEE 176 foreate FS2 ccccccccescccecccccecececececececececeeeeece 127 pethal eege tie geed ee de Ee e 175 fereate UNUSEA EE 128 BEER sisevecdsedivcedudedec cdvvsvocssavsvausdevsvadeiaderven
369. sesesessseseseees 44 ru OT 384 kee dee 45 gd re d RE 385 Delay Ticks o on 45 BIER 385 IntervalMs ccccccccccccceeesessssaeeeeeceees 195 R interval Sec serorei ian 195 Interval Tick cccccccccccccceesessssseeeeeeceees 196 Rabbit 3000 4000 ISCOD OME ess EES 199 disablelODUs ccssieiecsevecdecvennedcctevserenseene 46 TOCORUMMING ee redeeneg deeg 199 enableIObus eiert 69 loophead WEE 225 EE ANOS table isseire 430 aert egener keete 225 servo_closedloop EE 430 servo d sable 0 431 S servo d sable 1 432 Number to String Conversion Servo enable 0 433 TGS EE 175 servo_enable_ leen 434 e EE 194 REEVES erennere 435 TOG geet 205 SETVO_STAPN oessesssesseeseeseereeeeeteeetesnes 437 tee 226 Pro It En 438 DEE 227 servo_millirpm2vcmd en 438 LLG tee 527 SETVO_MOVE_ O ssrsrsrsssersesssrsesenrscssesrseses 439 servo_openloop Jss 2icessiceicrecsnceneraadvsanees 440 P Servog od zem D 441 Partitions servo od zem 1 441 mbr_CreatePartition ccccccccccccseeeeeeee 229 EE eegenen SE EE 230 servo_set_coeffs ccccceeescccsseesesssseeeeees 443 EE 231 SCTVO_SCt_POS o e eccececeeessessnseceeeeeeseeseees 444 ob MountPartition AAA 232 servo_set_ vele 445 servo_stats_reset ccccccccccccccssesscesseseees 445 xxii rabbit com Dynamic C Functions BEE TMOG eieiei 446 PVA Eegeregie 368 PWM Set eebe 369 Rabbit 3000 4000 5000 J ENEE 383 BEE ee sg SIE STII eege 384 ROT PINES NE a a0 gd r ad ME 385 an i toanionsiaestostiiece 23 gd Z
370. similar to the execution stack The addr parameter must be the return value from xalloc If not then a run time exception will occur The sz parameter must also be equal to the actual allocated size however this is not checked The actual allocated size may be larger than the requested size be cause of alignment overhead The actual size may be obtained by calling xalloc rather than xalloc For this reason it is recommended that your application consistently uses _xalloc rather than xalloc if you intend to use this function PARAMETERS addr Address of storage previously obtained by _xalloc SZ Size of storage previously returned by xalloc LIBRARY XMEM LIB SEE ALSO xalloc _xalloc xavail _xavail xalloc_ stats 554 rabbit com Dynamic C Functions xsetint void xsetint long dst int val DESCRIPTION Set the integer pointed to by dst This is the most efficient function for writing two bytes to xmem PARAMETERS dst xmem linear address of the int value to set val value to store into the above location RETURN VALUE None LIBRARY XMEM LIB xsetfloat void xsetfloat long dst float val DESCRIPTION Set the float pointed to by dst This is the most efficient function for writing 4 bytes to xmem PARAMETERS dst xmem linear address of the float value to set val value to store into the above location RETURN VALUE None LIBRARY XMEM LIB Dynamic C Functions rabbit com 555
371. sssseseeereessssesreeeesee 333 OS Start EE 298 PKB Ope vc2icdadesccssaceccceveasiesieaeccdacdaveadesveneeas 334 OSS EEN 299 PKtBreceive ENEE 336 OSTaskChangePrio ccesseseesececeeeeeeeseesees 299 PKtBsend een 337 OS Task EE 300 PKtB sending ssir ra is as raa eee 338 OSTaskCreateEXt cccccccessesersceceeeeseeesesees 301 pktBsetParity cccscscccccceeessessceeceeeeeeessaees 338 OSTaskCreateHook cesecsecsececeeeeeeeseesees 302 PKUICCIOSE Asteroide 332 OSTaskDel EE 303 pktCgetErrors ssssssessseesessssesereesessssesrresese 332 OSTaskDelHook ssseneessssseeseseesessssoseeeesesessoe 304 pktCimitBuffers EEN 333 OSTaskDelReq ssssseneesssssesseeeesessesoseeeesessssoe 305 PKtC Open e S isses errien rrr ar arisia E 334 OSTaskIdleHook ceceeeseesentececeeeeeeeseesees 306 pktCreceive ege ege oea ed ue 336 OSTaskQuery cccscccccceceeessesentececeesesseesenees 306 DEE 337 OSTaskResume osssseneessssssoseseesessesoseesesesessoe 307 PKtCsending ssr rra 338 OSTaskStatHook cceceeeseesectececeeeeeeeeeesees 307 pktCsetParity ssesseeseeeessssessseesesessessseeerssse 338 ERC ON 308 TK eirinen r re E 332 OSTaskSuspend ccccccceeeseeseetecececeeeeeseeaees 309 pktDgetErrors ccsecccceceeeseeseseeeeeceeeeesseaees 332 OSTaskSwHook ossis niesieni sarr 310 pktDinitBuffers ccc ceceeeesessccececeeeeeesaees 333 OSTCBInitHook 0 cccccceeseesensececeeeeseeseeaees 310 IR 334 OSTIMED LY cds s
372. sssseseseeeerssrssreereesesse 279 mbr FormatDeViCE aoao 231 OSMutex Dell 2uguggeeEk gaer deeg 280 mbr MountPartition EENEG 232 OSMutex Pend EE 281 mbr UnmountPartition EEN 233 OSMu tex POSE os sis veegeekee essor snerist 282 mbr_ValidatePartitions NNN 234 OSMUtEXQUEIY eeng 283 ENEE 235 EE 284 Gnd FGI EEN 236 OSQCreate ENEE 285 MAS Int ee DEE 286 OROI ELER n 22022 escaeccdccntendsasevedoadssgecsisseaecesecsesc 287 viii rabbit com Dynamic C Functions E WE 288 pires fast wrcecstessesnastedsersesazasnwvaeaseeateaeasnga cece 330 OSQPOSt E T 289 PWM sasesana i iii aei Eiai 331 OSQPostFront ssssssssesssssssesesereesssseseeeesessseee 290 PKEACIOSE E E is feressnadcaatetieesiacdaleets 332 ONLO OOI T 291 PKtAgetErrors cc scccceceeeeessensceeeeeeseesenaees 332 OS QQUERY E 292 pktAinitBuffers 0 0 eceeecessesseececeeeeeseaees 333 OSSchedLock c cccccccecessssssetsccececeeseeseenees 293 PKtAOPeN ENEE 334 OSSchedUnlock c ccccceceeeseessntececeeeeeeeeeenees 293 pktAreceive ENEE 336 OSSeMACCEPt ececcccececesesseseetececeeeeeeeseeaees 294 pktAsend scsccsss scestasnceccetisdeestashazeessdduestes ads 337 OSSemCreate NEEN 295 PKtAsending EEN 338 OSSemPend uk 295 pktAsetParity EE 338 OSSemMPO8t ess cscssacnteceessacdddiderdacascusccsvatiaccen 296 ET 332 OSSemQuery sessssesessesessssssesrssesseseseeresessseoe 297 pktBgetErrors sssssssesssessessssesreresessssesreeeeses 332 OSSetTickPerSec AER 298 pktBinitBuffers sssesssesse
373. st anonymous section of the registry is implied entries List of registry entries to read See the registry_write description for details The value field will be set to point to the location where the read value is stored If the key does not exist in the specified section then the contents at this location will be untouched Thus you can set default values at each location before calling registry_read As forregistry write the list MUST be terminated with an entry with the REGOPTION_ EOL option RETURN VALUE lt 0 failure to write or read the resource 0 success LIBRARY register lib SEE ALSO sspec_open registry write registry update registry get registry prep read registry finish read Dynamic C Functions rabbit com 405 registry update int registry update char basename char far section RegistryEntry re ServerContext sctx DESCRIPTION Convenience function for updating a registry with a minimum of fuss Basically combines the function calls registry prep write registry write registry finish write PARAMETERS basename Base name of registry file as a Zserver resource name This file must not have an extension since the extensions 1 2 and so on are appended to the name section Section name to update may be NULL to update the anonymous section at the start of the registry file re Array of update commands See the registry write function de script
374. t long address 1L lt lt bit PARAMETERS address Address of byte containing bits 7 0 bit Bit location where 0 represents the least significant bit LIBRARY UTIL LIB SEE ALSO SET SET void SET void address unsigned int bit DESCRIPTION Dynamic C may expand this call inline Sets specified bit at memory address to 1 bit may be from 0 to 31 This is equivalent to the following expression but more efficient long address 1L lt lt bit PARAMETERS address Address of byte containing bits 7 0 bit Bit location where 0 represents the least significant bit LIBRARY UTIL LIB SEE ALSO set 466 rabbit com Dynamic C Functions set32kHzDivider void set32kHzDivider int setting DESCRIPTION Sets the expanded 32kHz oscillator divider for the Rabbit 3000 processor This function does not enable running the 32kHz oscillator instead of the main clock This function will affect the actual rate used by the processor when the 32kHz oscillator has been enabled to run by a call to use32kHzOsc This function is not task reentrant PARAMETER setting 32kHz divider setting The following are valid e OSC32DIV_1 don t divide 32kHz oscillator e OSC32DIV_2 divide 32kHz oscillator by two e OSC32DIV_ 4 divide 32kHz oscillator by four e OSC32DIV_8 divide 32kHz oscillator by eight e OSC32DIV_16 divide 32kHz oscillator by sixteen LIBRARY SYS LIB SEE ALSO useClockDivider useClockDivider3000 useMainOs
375. t c DESCRIPTION Tests for printing character including space 32 lt c lt 126 PARAMETERS c Character to test RETURN VALUE 0 if not a printing character 0 otherwise LIBRARY STRING LIB SEE ALSO isdigit isxdigit isalpha ispunct isspace isalnum isgraph 202 rabbit com Dynamic C Functions ispunct int ispunct int c DESCRIPTION Tests for a punctuation character Character Decimal Code space 32 I amp 4 33 lt c lt 47 lt gt 58 lt c lt 64 Dia 91 lt c lt 96 I 123 lt c lt 126 PARAMETERS c Character to test RETURN VALUE 0 Not a character 0 Is a character LIBRARY STRING LIB SEE ALSO isspace Dynamic C Functions rabbit com 203 isupper int isupper int c DESCRIPTION Tests for upper case character PARAMETERS c Character to test RETURN VALUE 0 Is not an uppercase character 0 Is an uppercase character LIBRARY STRING LIB SEE ALSO tolower toupper islower isxdigit int isxdigit int c DESCRIPTION Tests for a hexadecimal digit 0 9 A F a f PARAMETERS c Character to test RETURN VALUE 0 Not a hexadecimal digit 0 Is a hexadecimal digit LIBRARY STRING LIB SEE ALSO isdigit isalpha isalpha 204 rabbit com Dynamic C Functions itoa char itoa int value char buf DESCRIPTION Places up to a 5 digit
376. t n_stremp char strl char str2 FAR SYNTAX int f strcemp char far strl char far str2 Note By default strcmp is defined to pn strcemp DESCRIPTION Performs unsigned character by character comparison of two null terminated strings For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_ STRING macro is de fined and all pointers are near pointers append np to the function name e g n_ strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS str1 Pointer to string 1 str2 Pointer to string 2 RETURN VALUE lt 0 str1 is less than str2 because character in str1 is less than corresponding character in str2 or str1 is shorter than but otherwise identical to str2 0 str1 is identical to str2 gt 0 Str1 is greater than st r2 because character in st r1 is greater than corresponding character in st r2 or str2 is shorter than but otherwise identical to st r1 LIBRARY STRING LIB SEE AL
377. t number Most applications should just pass the file number with zero high byte A file may be opened multiple times with a different file descriptor pointer for each call which allows the file to be read or written at more than one position at a time A reference count for the actual file is maintained so that the file can only be deleted when all file descriptors refer ring to this file are closed fopen_wr or fopen_rd must be called before any other function from this library is called that requires a File pointer The current position is set to zero i e the start of the file When a file is created it is automatically opened for writing thus a subsequent call to fopen_ wr is redundant PARAMETERS f Pointer to file descriptor uninitialized name File number 1 to 255 inclusive RETURN VALUE 0 Success 0 Failure ERRNO VALUES ENOENT File does not exist or metadata extent number does not match an existing file LIBRARY fs2 lib SEE ALSO fclose fopen_rd FS2 Dynamic C Functions rabbit com 149 forceSoftReset void forceSoftReset void DESCRIPTION Forces the board into a software reset by jumping to the start of the BIOS LIBRARY SYS LIB fread FS1 int fread File char buf int len DESCRIPTION Reads len bytes from a file pointed to by f starting at the current offset into the file into buff er Data is read into buffer pointed to by buf PARAMETERS f A point
378. tXsend void send buffer int buffer length char delay X is A F DESCRIPTION Initiates the sending of a packet of data The function will exit when the packet is finished trans mitting The functions cof_pktEsend and cof _pktFsend are available when using the Rabbit 3000 or Rabbit 4000 PARAMETERS send buffer The data to be sent buffer length Length of the data buffer to transmit delay The number of byte times 0 255 to delay before sending data This is used to implement protocol specific delays between packets LIBRARY PACKET LIB 30 rabbit com Dynamic C Functions int cof serXgetc void cof serxXgetc DESCRIPTION This single user cofunction yields to other tasks until a character is read from port X This func tion only returns when a character is successfully written It is non reentrant The functions cof _serEgetc and cof_serFgetc may be used with the Rabbit 3000 or Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is cof_serXgetc int port where port is one of the macros SER_PORT A through SER_PORT E RETURN VALUE where X is A F An integer with the character read into the low byte LIBRARY RS232 LIB EXAMPLE echoes characters main Tae Ep serXopen 19200 logpitimait mr
379. teUserBlock should be called until it returns zero or a negative error code A positive return value indicates that the SPI port needed by the serial flash is in use by another device However if using uC OS II and SPI USE UCOS MUTEX is defined then this function only needs to be called once If the mutex times out waiting for the SPI port to free up the run time error ERR_SPI_ MUTEX ERROR will occur See the descrip tion for rcm43_ InitUCOSMutex for more information on using uC OS II and SPI USE UCOS MUTEX Backwards Compatibility If the version of the System ID block doesn t support the User ID block or no System ID block is present then 8K bytes starting 16K bytes from the top of the primary flash are designated the User ID block area However to prevent errors arising from incompatible large sector configu rations this will only work if the flash type is small sector Rabbit Semiconductor manufactured boards with large sector flash will have valid System and User ID blocks so this should not be problem on Rabbit boards If users create boards with large sector flash they must install System ID blocks version 2 or greater to use or modify this function Dynamic C Functions rabbit com 535 writeUserBlock cont d PARAMETERS addr Address offset in User block to write to source Pointer to source to copy data from numbytes Number of bytes to copy RETURN VALUE 0 Successful 1 Invalid address or range The
380. tem tick This function is called from the BIOS timer interrupt ISR but can also be called from a high priority task The user definable OSTimeTickHook is called from this function and allows for extra application specific processing to be performed at each tick Since OSTimeTickHook is called during an interrupt it should perform minimal processing as it will directly affect interrupt latency LIBRARY UCOS2 LIB SEE ALSO OSTimeTickHook OSTimeTickHook void OSTimeTickHook void DESCRIPTION This function as included with Dynamic C is a stub that does nothing except return It is called every clock tick Code in this function should be kept to a minimum as it will directly affect interrupt latency This function must preserve any registers it uses other than the ones that are preserved at the beginning of the periodic interrupt periodic _isrin VDRIVER LIB and therefore should be written in assembly At the time of this writing the registers saved by periodic _isr are AKIP HL DE and IX LIBRARY UCOS2 LIB SEE ALSO OSTimeTick 316 rabbit com Dynamic C Functions OSVersion INT16U OSVersion void DESCRIPTION Returns the version number of uC OS II The returned value corresponds to uC OS II s version number multiplied by 100 i e version 2 00 would be returned as 200 RETURN VALUE Version number multiplied by 100 LIBRARY UCOS2 LIB outchrs char outchrs char c int n int putc DE
381. ter value e unless e was null in which case the value of plast when called at function entry would be returned IMPORTANT If null is returned that means that some other task context or ISR modified the linked list while this operation was in progress In this case the application should call this function again with the same parameters since this operation will NOT have completed This would be a rare occurrence however multitasking applications should handle this case correctly EXAMPLES void r void s s pnext p pfirst p sis second element r plast p ris last element preorder p s r POOL INSERT AFTER Ifs r then s will become the new last element You can use null parameters to perform the common case of moving the last element to the head of the list preorder p NULL NULL POOL INSERT BEFORE i which is identical to preorder p plast p pfirst p POOL INSERT BEFORE LIBRARY POOL LIB SEE ALSO pool init pool link plast pfirst pnext pprev pmovebetween 360 rabbit com Dynamic C Functions printf int printf char fmt DESCRIPTION This function is similar to sprintf but outputs the formatted string to the Stdio window Prior to Dynamic C 7 25 printf would work only with the controller in program mode connected to a PC running Dynamic C As of Dynamic C 7 25 it is possible to redirect printf output to a serial port during r
382. texPriority isa uC OS II task priority that must be higher than the priorities of all tasks that call FAT API func tions 3 You must not call low level non API FAT or write back cache functions Only call FAT func tions appended with fat_ and with public function descriptions 4 Run the FAT in blocking mode define FAT BLOCK Mutex timeouts or other errors will cause a run time error ERR_FAT MUTEX ERROR uC OS II may raise the priority of tasks using mutexes to prevent priority inversion The default mutex time out in seconds is given by FAT_MUTEX_TIMEOUT_SEC which de faults to 5 seconds if not defined in the application before the statement Huse FAT LIB PARAMETERS mutexPriority A uC OS II task priority that MUST be higher than the priorities of all tasks that call FAT API functions RETURN VALUE None success ERR_FAT MUTEX _ERROR A run time error causes an exception and the application will exit with this error code LIBRARY FAT LIB SEE ALSO fat _AutoMount fat Init 96 rabbit com Dynamic C Functions fat IsClosed int fat IsClosed FATfile far file DESCRIPTION Returns non zero if the FATfile passed is not open and zero if open Currently implemented as a macro but may be modified to be an actual function in a future release PARAMETER file Pointer to a FATfile structure to check RETURN VALUE 1 file is closed O file is open LIBRARY fat lib SEE ALSO fat_ReadDir f
383. th f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_STRING macro is de fined and all pointers are near pointers append n_ to the function name e g n strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS s1 String to be scanned s2 Character occurrence string RETURN VALUE Pointer pointing to the first occurrence of a character contained in s2 in s1 Returns null if not found LIBRARY STRING LIB SEE ALSO Strehr Strrehr lt streok 508 rabbit com Dynamic C Functions strrchr NEAR SYNTAX char n strrchr char s int c FAR SYNTAX char far f strrchr char far s int c Note By default strrchr is definedto n strrchr DESCRIPTION Similar to strchr except this function searches backward from the end of s to the beginning For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_ STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower
384. the VBAT RAM 0 31 length The length of data to write to VBAT RAM The length should be greater than 0 The parameters Length start should not exceed 32 LIBRARY VBAT LIB SEE ALSO vram2root 412 rabbit com Dynamic C Functions root2xmem int root2xmem unsigned long dest void src unsigned len DESCRIPTION Stores len characters from logical address src to physical address dest PARAMETERS dest Physical address sre Logical address len Numbers of bytes RETURN VALUE 0 Success 1 Attempt to write flash memory area nothing written 2 Source not all in root LIBRARY XMEM LIB SEE ALSO xalloc xmem2root Dynamic C Functions rabbit com 413 rtc timezone int rtc_timezone long seconds char tzname DESCRIPTION This function returns the timezone offset as known by the library The timezone is obtained from the following sources in order of preference 1 The DHCP server This can only be used if the TCP IP stack is in use and USE_DHCP is defined 2 The TIMEZONE macro This should be defined by the program to an _hour_ offset may be floating point PARAMETERS seconds Pointer to result longword This will be set to the number of seconds offset from Coordinated Universal Time UTC The value will be negative for west positive for east of Greenwich tzname If null no timezone name is returned Otherwise this must point to a buffer of at least 7 bytes The buffer is set to a null
385. their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_STRING macro is de fined and all pointers are near pointers append n_ to the function name e g n strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS s1 Pointer to block 1 s2 Pointer to block 2 n Maximum number of bytes to compare RETURN VALUE lt 0 A character in str1 is less than the corresponding character in str2 0 str1 is identical to str2 gt 0 A character in str1 is greater than the corresponding character in str2 LIBRARY STRING LIB SEE ALSO strncmp 238 rabbit com Dynamic C Functions memcpy NEAR SYNTAX void n memcpy void dst void src unsigned int n FAR SYNTAX void far memcpy void far dst void far src size t n Note By default memcpy is defined to pn memcpy DESCRIPTION Copies a block of bytes from one destination to another Overlap is handled correctly For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also e
386. tination not open 1 destination OK 2 destination reached limit of its space quota 1 error in destination 2 destination not configured LIBRARY log lib 216 rabbit com Dynamic C Functions log format char log format LogEntry le char buffer int length int pfx DESCRIPTION Given the log entry returned by log_next or log_prev format the entry as an ASCII string The string is constructed in Unix syslog format lt d gt 15s 8s d Gs where the substitutions are od facility priority as decimal number 0 255 15s date time as Mon dd hh mm ss s process name taken from LOG_UDP_PNAME 0 if defined else empty od process ID but the entry serial number is used instead s the log entry data A null terminator is always added at buffer length 1 or at the end of the string if it fits in the buffer If pfx is zero then the above syslog prefix is not generated Note Please see the comments at the top of log 1ib for a description of the message logging subsystem PARAMETERS le Log entry result from log_next log_prev buffer Storage for result Must be dimensioned at least length length Length of buffer For the maximum sized log entry the buffer should be 158 bytes The minimum length must be greater than or equal to 43 if pfx true else 1 If a bad length is passed the function returns without writing to buffer pfx 0 message text only do not generate syslog prefix
387. tion GetVectExtern2000 instead Get VectExtern3000 returns the value at address external vector table base interruptNum 8 1 PARAMETER interruptNum Interrupt number Should be 0 or 1 RETURN VALUE Jump address in vector table LIBRARY SYS LIB SEE ALSO SetVectExtern3000 SetVectIntern GetVectIntern GetVectExtern2000 Dynamic C Functions rabbit com 181 GetVectiIntern unsigned GetVectIntern int vectNum DESCRIPTION Reads the address of the internal interrupt table entry and returns whatever value is at the address internal vector table base vectNum 16 1 PARAMETER vectNum Interrupt number should be 0 15 RETURN VALUE Jump address in vector table LIBRARY SYS LIB SEE ALSO GetVectExtern2000 SetVectExtern2000 SetVectIntern gps_ get position int gps get position GPSPositon newpos char sentence Ir DESCRIPTION Parses a sentence to extract position data This function is able to parse any of the following GPS sentence formats GGA GLL or RMC PARAMETERS newpos A GPSPosition structure to fill sentence A string containing a line of GPS data in NMEA 0183 format RETURN VALUE 0 Success 1 Parsing error 2 Sentence marked invalid LIBRARY gps lib 182 rabbit com Dynamic C Functions gps get _ utc int gps get _utc struct tm newtime char sentence lr DESCRIPTION Parses an RMC sentence to extract time data PARAMETERS newtime tm stru
388. tion that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXpeek int port where port is one of the macros SER_PORT A through SER_PORT E RETURN VALUE An integer with first character in buffer in the low byte 1 if the buffer is empty LIBRARY RS232 LIB Dynamic C Functions rabbit com 457 serXputc int serXputc char c where X is A F DESCRIPTION Writes a character to serial port X write buffer This function is non reentrant The functions serEputc and serFputc may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXputc int port where port is one of the macros SER_PORT A through SER_PORT E PARAMETERS c Character to write to serial port X write buffer RETURN VALUE O0 if buffer locked or full 1 if character sent LIBRARY RS232 LIB EXAMPLE main echoes characters ime ei serAopen 19200 while 1 iz le SemAgeEC I i 4 serAputc c serAclose j 458 rabbit com Dynamic C Functions serXputs int serXputs char s where X is A F DESCRIPTION Calls serXwrite s strlen s does not write null terminator This function is non
389. tions rabbit com fat AutoMount cont d RETURN VALUE 0 success EBADPART partition is not a valid FAT partition EIO Device I O error EINVAL invalid prtTable EUNFORMAT device is not formatted ENOPART no partitions exist on the device EBUSY For non blocking mode only the device is busy Call this function again to complete the close Any other negative value means that an I O error occurred when updating the directory entry In this case the file is forced to close but its recorded length might not be valid LIBRARY FAT LIB SEE ALSO fat EnumDevice fat EnumPartition fat MountPartition 80 rabbit com Dynamic C Functions fat Close int fat Close FATfile file DESCRIPTION Closes a currently open file You should check the return code since an I O needs to be per formed when closing a file to update the file s EOF offset length last access date attributes and last write date if modified in the directory entry This is particularly critical when using non blocking mode PARAMETERS file Pointer to the open file to close RETURN VALUE 0 success EINVAL invalid file handle EBUSY For non blocking mode only the device is busy Call this function again to complete the close Any other negative value means that an I O error occurred when updating the directory entry In this case the file is forced to close but its recorded length might not be valid LIBRARY FAT LIB
390. tition is to be marked reserved rfu A pointer reserved for future use Pass as null partition it Must be set to FS_ PARTITION FRACTION or FS MODIFY EXTENT The following parameters are ignored if this parameter is not FS_ PARTITION FRACTION 166 rabbit com Dynamic C Functions fs setup FS2 cont d part The fraction of the existing base extent to assign to the new extent This number is expressed as a fixed point binary number with the binary point to the left of the MSB e g 0x3000 assigns 3 16 of the base extent to the new partition updating the base extent to 13 16 of its original size The nearest whole number of physical sectors is used for each ex tent part_1ls_shift Logical sector size to assign to the new extent or zero to use the same LS size as the base extent Expressed in same units as parameter 2 part reserve TRUE if the new extent is to be reserved part _rfu A pointer reserved for future use Pass as null RETURN VALUE 0 Failure extent could not be partitioned 0 Success number of the new extent or same as 1xd for existing extent modification ERRNO VALUES ENOSPC one or other half would contain an unusably small number of logical sectors or the extent table is full In the latter case define FS MAX LX toa larger value EINVAL partition_it set to an invalid value or other parameter invalid ENODEV specified base extent number not defined LIBRARY FS2 LIB SEE ALSO fs init Saz Dy
391. tly proportional to the number of tasks waiting on the event flag group PARAMETERS pgrp Pointer to the desired event flag group opt May be one of the following delete options e OS DEL NO PEND Deletes the event flag group only if no task pend ing e OS DEL ALWAYS Deletes the event flag group even if tasks are wait ing In this case all the tasks pending will be readied err Pointer to an error code May be one of the following values e OS NO ERR Success the event flag group was deleted e OS ERR DEL ISR If you attempted to delete the event flag group from an ISR OS FLAG INVALID PGRP If pgrp isa null pointer e OS ERR EVENT TYPE You are not pointing to an event flag group e OS ERR EVENT TYPE If you didn t pass a pointer to an event flag group e OS _ERR_INVALID_ OPT Invalid option was specified e OS ERR TASK WAITING One or more tasks were waiting on the event flag group RETURN VALUE pevent Error OS_ EVENT 0 Semaphore was successfully deleted LIBRARY OS FLAG C Prior to DC 8 UCOS2 LIB 262 rabbit com Dynamic C Functions OSFlagPend OS FLAGS OSFlagPend OS FLAG GRP pgrp OS FLAGS flags INT8U wait type INT16U timeout INT8U err DESCRIPTION This function is called to wait for a combination of bits to be set in an event flag group Your application can wait for ANY bit to be set or ALL bits to be set PARAMETERS pgrp Pointer to the desired event flag group flags B
392. tly slower than the near version To explicitly call the near version when the USE_FAR_ STRING macro is de fined and all pointers are near pointers append n_ to the function name e g n strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS dst Pointer to memory destination src Pointer to memory source n Number of characters to copy RETURN VALUE Pointer to destination LIBRARY STRING LIB SEE ALSO memcpy memset 240 rabbit com Dynamic C Functions memset NEAR SYNTAX void o memset void dst int chr unsigned int n FAR SYNTAX void far f memset void far dst int chr size tn Note By default memset is defined to pn memset DESCRIPTION Sets the first n bytes of a block of memory pointed to by dst to the character chr For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR STRING macro is de fined and all pointers are near pointers append _n tothe functionname e g D strfunc
393. tput This function sets up the LZ compression algorithm window and tree associated with the ZFILE file The second parameter is the file handle FS2 of the output file to be written to Note that this MUST be an FS2 file handle or the open will fail The OUTPUT_COMPRESSION_ BUFFERS macro must be defined as a positive non zero number if compression is being used PARAMETERS ofp ZFILE file descriptor fn FS2 handle of output file RETURN VALUE 0 Failure 1 Success LIBRARY LZSS LIB SEE ALSO CloseOutputCompressedFile Dynamic C Functions rabbit com 257 OS ENTER CRITICAL void OS ENTER CRITICAL void DESCRIPTION Enter a critical section Interrupts will be disabled until OS_ EXIT CRITICAL is called Task switching is disabled This function must be used with great care since misuse can greatly increase the latency of your application Note that nesting OS ENTER CRITICAL calls will work correctly LIBRARY UCOS2 LIB OS EXIT CRITICAL void OS EXIT CRITICAL void DESCRIPTION Exit a critical section If the corresponding previous OS ENTER CRITICAL call disabled interrupts that is interrupts were not already disabled then interrupts will be enabled Other wise interrupts will remain disabled Hence nesting calls toOS ENTER CRITICAL will work correctly LIBRARY UCOS2 LIB 258 rabbit com Dynamic C Functions OSFlagAccept OS FLAGS OSFlagAccept OS FLAG GRP pgrp OS FLAGS flags I
394. trespn char sl char s2 FAR SYNTAX size t f strcespn char far sl char far s2 Note By default strcspn is definedto pn strcepsn DESCRIPTION Scans a string for the occurrence of any of the characters in another string For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_ STRING macro is de fined and all pointers are near pointers append n_ to the function name e g n strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS s1 String to be scanned s2 Character occurrence string RETURN VALUE Returns the position less one of the first occurrence of a character in s1 that matches any char acter in s2 LIBRARY STRING LIB SEE ALSO Strehr Strrehr lt streok 502 rabbit com Dynamic C Functions strlen NEAR SYNTAX int n_strlen char s FAR SYNTAX int f strlen char far s Note By default strlen is defined to pn strlen DESCRIPTION Calculate the length o
395. ts define REGOPTION RESV9 9 For variable length data define REGOPTION BIN len len Binary of given fixed length stored expanded into ascii hexadecimal len must be 1 _REGBUF_SIZE 2 M where M is the size of the key plus 2 As arule of thumb be careful when len is more than about 256 define REGOPTION STRING len 8 len Null terminated string up to len chars counting the null terminator stored as is len must be at least 2 len must not be more than _REGBUF_SIZE M where M is the size of the key plus 2 As a rule of thumb be careful when len is more than about 512 word work Work field for registry read write lib functions May be left uninitialized by the caller unless otherwise noted in the function description RegistryEntry Dynamic C Functions rabbit com 409 registry write cont d RETURN VALUE lt 0 failure to write or read the resource 0 success LIBRARY REGISTRY LIB SEE ALSO sspec_open registry read registry update registry get registry prep write registry finish write 410 rabbit com Dynamic C Functions res void res void address unsigned int bit DESCRIPTION Dynamic C may expand this call inline Clears specified bit at memory address to 0 Bit may be from 0 to 31 This is equivalent to the following expression but more efficient long address amp 1L lt lt bit PARAMETERS address Address of byte containing bits 7
396. un mode by defining a macro to specify the serial port See the sample program SAMPLES STDIO_ SERIAL C for more information See below for the complete list of Dynamic C Conversion Specifiers The user should make sure that e there are enough arguments after fmt to fill in the format parameters in the format string e the types of arguments after fmt match the conversion specifiers in fmt The macroSTDIO DISABLE FLOATS can be defined if it is not necessary to format floating point numbers If this macro is defined e f and g will not be recognized This can save thousands of bytes of code space The macro STDIO_ ENABLE LONG STRINGS can be defined if it is necessary to print strings to the Stdio window that are longer than the default of 127 bytes Without defining this macro such strings are truncated The drawback of defining this macro is that if it is defined in a multi tasking application where more than one task is utilizing printf and at least one of the tasks is printing strings longer than 127 bytes the user must ensure that calls to printf are seri alized via a semaphore or similar means If calls to printf are not serialized under these condi tions printf output from the different tasks may be interleaved in the Stdio window Note this function is task reentrant and it has a 128 byte buffer PARAMETERS fmt String to be formatted sare Format arguments RETURN VALUE Number of characters written LIBRARY STDIO LIB
397. unted RETURN VALUE 0 for success EINVAL if Drive or Partition structure or pnum is invalid ENOPART if Partition does not exist on the device LIBRARY PART LIB 232 rabbit com Dynamic C Functions mbr UnmountPartition int mbr UnmountPartition mbr drive drive int pnum DESCRIPTION Marks the partition as unmounted The partition must not have any user partition data attached through mounting at a higher level Ifthe s_part pointer for the partition being unmounted is not null an EPERM error is returned PARAMETERS drive Pointer to a drive structure containing the partition pnum Partition number to be unmounted RETURN VALUE 0 for success EINVAL if the Drive structure or pnum is invalid ENOPART if the partition is enumerated at a higher level LIBRARY PART LIB Dynamic C Functions rabbit com 233 mbr ValidatePartitions int mbr ValidatePartitions mbr drive drive DESCRIPTION This routine will validate the partition table contained in the drive structure passed It will verify that all partitions fit within the bounds of the drive and that no partitions overlap PARAMETERS drive Pointer to a drive structure RETURN VALUE 0 for success EINVAL if the partition table in the drive structure is invalid LIBRARY PART LIB 234 rabbit com Dynamic C Functions md5 append void md5 append md5 state t pms char data int nbytes DESCRIPTION This function will take a
398. used to pass information in a consistent manner between the major registry API functions It may be passed unini tialized to this function basename Base name including path of the registry This should NOT include any extension e g foo since the extension is manipulated by this function In practice this will need to be a resource name on non volatile storage which supports names with extensions In practice this limits the appropri ate filesystem to FAT filesystem only For example registry_prep_write A myreg amp oldspec amp newspec will select from a set of registry files called A myreg 1 A myreg 2 A myreg 3 of which normally only two will exist at any time one will be opened for reading and the other will be emp ty and ready for writing context ServerContext structure E g from http_getContext Dynamic C Functions rabbit com 403 registry prep write cont d RETURN VALUE lt 0 general failure code will be negative of one of the codes in ERRNO LIB 0 there is currently no resource of the given name oldp will be set to 1 in this case This is not necessarily an error since it will be returned if the registry has not yet been created You can pass oldp to registry write in this case and it will correctly create the new registry without attempting to read the non existent old registry 1 2 3 An existing presumed non corrupt resource has been opened and the open resource han
399. ush File f DESCRIPTION Flush any buffers associated with the given file retained in RAM to the underlying hardware device This ensures that the file is completely written to the filesystem The file system does not currently perform any buffering however future revisions of this library may introduce buffering to improve performance PARAMETERS f Pointer to open file descriptor RETURN VALUE 0 Success 0 Failure ERRNO VALUES EBADFD file invalid or not open EIO I O error LIBRARY fs2 LIB SEE ALSO fs syno FS2 132 rabbit com Dynamic C Functions fftcplx void fftcplx int x int N int blockexp DESCRIPTION Computes the complex DFT of the N point complex sequence contained in the array x and re turns the complex result in x N must be a power of 2 and lie between 4 and 1024 An invalid N causes a RANGE exception The N point complex sequence in array x is replaced with its N point complex spectrum The value of blockexp is increased by 1 each time array x has to be scaled to avoid arithmetic overflow PARAMETERS x Pointer to N element array of complex fractions N Number of complex elements in array x blockexp Pointer to integer block exponent LIBRARY FFT LIB SEE ALSO fftceplxinv fftreal fftrealinv hanncplx hannreal powerspectrum Dynamic C Functions rabbit com 133 fftcplxinv void fftcplxinv int x int N int blockexp DESCRIPTION Computes th
400. vectNum Interrupt number See the above table for valid values isr ISR handler address Must be a root address RETURN VALUE Address of vector table entry or zero if vectNum is not valid LIBRARY SYS LIB SEE ALSO GetVectExtern2000 SetVectExtern2000 GetVectIntern Dynamic C Functions rabbit com 477 sf getPageCount long sf getPageCount sf device dev DESCRIPTION Return number of pages in a flash device PARAMETER dev Pointer to ef device struct for initialized flash device RETURN VALUE Number of pages LIBRARY SFLASH LIB sf getPageSize unsigned int sf getPageSize sf device dev DESCRIPTION Return size in bytes of a page on the current flash device PARAMETER dev Pointer to ef device struct for initialized flash device RETURN VALUE Bytes in a page LIBRARY SFLASH LIB 478 rabbit com Dynamic C Functions sf init int sf _init void DESCRIPTION Initializes serial flash chip This function must be called before the serial flash can be used Cur rently supported devices are e AT45DB041 e AT45DB081 e AT45DB642 e AR45DB1282 Note This function blocks and only works on boards with one serial flash device RETURN VALUE 0 for success 1 if no flash chip detected 2 if error communicating with flash chip 3 if unknown flash chip type LIBRARY SFLASH LIB Dynamic C Functions rabbit com 479 sf initDevice int sf initDevice sf device dev int cs port
401. vice structure is invalid or does not exist ENOMEM memory for page buffer RJ is not available EEXIST the device is already formatted EPERM the device already has mounted partition s EBUSY the device is busy Only if non blocking LIBRARY FAT LIB SEE ALSO fat _AutoMount fat Init fat _EnumDevice fat_PartitionDevice fat _FormatPartition Dynamic C Functions rabbit com 89 fat FormatPartition int fat FormatPartition mbr dev dev fat part part int pnum int type char label int usr DESCRIPTION Formats partition number pnum according to partition type The partition table information in the device must be valid This will always be the case if the device was enumerated The parti tion type must be a valid FAT type Also note that the partition is not mounted after the partition is formatted If EBUSY is returned the partition structure must not be disturbed until a subse quent call returns something other than EBUSY If needed e fat_MountPartition returned error code EBADPART this function is called by fat_AutoMount PARAMETERS dev Pointer to a device structure containing partitions part Pointer to a FAT partition structure to be linked Note that opstate must be set to zero before first call to this function if the library is being used in the non blocking mode pnum Partition number on the device 0 3 type Partition type label Pointer to a partition label string usr Point
402. while 1 4 loophead wid c cof_serAgetc wid cof serAputc c serAclose Dynamic C Functions rabbit com 31 cof serxXgets int cof serXgets char s int max unsigned long tmout where X is A F DESCRIPTION This single user cofunction reads characters from port X until a null terminator linefeed or car riage return character is read max characters are read or until tmout milliseconds transpires between characters read A timeout will never occur if no characters have been received This function is non reentrant It yields to other tasks for as long as the input buffer is locked or whenever the buffer becomes empty as characters are read s will always be null terminated upon return The functions cof_serEgets and oof serFgets may be used with the Rabbit 3000 or Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is cof_serXgets int port where port is one of the macros SER_PORT A through SER_PORT E PARAMETERS s Character array into which a null terminated string is read max The maximum number of characters to read into s tmout Millisecond wait period between characters before timing out RETURN VALUE 1 if CR or max bytes read into s 0 if function times out before reading CR or max bytes LIBRARY RS
403. xplicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run slightly slower than the near version To explicitly call the near version when the USE_FAR_ STRING macro is de fined and all pointers are near pointers append np to the function name e g np strfunc For more information about FAR pointers see the Dynamic C User s Manual or the samples in Samples Rabbit4000 FAR PARAMETERS dst Pointer to memory destination src Pointer to memory source n Number of characters to copy RETURN VALUE Pointer to destination LIBRARY STRING LIB SEE ALSO memmove memset E Dynamic C Functions rabbit com 239 memmove NEAR SYNTAX void n memmove void dst void src unsigned int n FAR SYNTAX f memmove void far dst void far src size t n Note By default memmove is defined to pn memmove DESCRIPTION Copies a block of bytes from one destination to another Overlap is handled correctly For Rabbit 4000 users this function supports FAR pointers By default the near version of the function is called The macro USE_FAR_STRING will change all calls to functions in this li brary to their far versions The user may also explicitly call the far version with f strfunc where st rfunc is the name of the string function Because FAR addresses are larger the far versions of this function will run sligh
404. xts from altering the pool while this operation is in progress In addition d and f are checked to ensure that the following conditions still hold pprev p f d and pnext p d f in other words f follows d This is useful since your application may have determined d and f some time ago but in the meantime some other task may have re ordered the queue or deleted these elements In this case the return value will be null Your application should then re evaluate the appropriate queue elements and retry this function The pool MUST be set to being a linked pool by using pool link p lt non zero gt Otherwise the results are undefined PARAMETERS P Pool handle structure as previously passed to pool_init e Address of element to move obtained by e g plast This must be an allocated element in the given pool otherwise the results are undefined If null then the last element is implied Ge whatever plast would re turn If there are no elements at all or this parameter does not point to a valid allocated element then the results are undefined and probably cata strophic Ife dore f then there is no action except to check whether f follows d This parameter may refer to an unlinked but allocated el ement d First reference element The element e will be inserted after this element On entry it must be true that pnext p d f Otherwise
405. y RETURN VALUE 0 Success 0 Failure ERRNO VALUES EINVAL the reserveblocks parameter was non zero EIO I O error This indicates a hardware problem ENOMEM Insufficient memory for required buffers ENOSPC No valid extents obtained e g there is no recognized flash or RAM memory device available LIBRARY fs2 lib SEE ALSO fs setup FS2 fs get flash 1x FS2 156 rabbit com Dynamic C Functions fs reserve blocks FS1 int Ce reserve blocks int blocks DESCRIPTION Sets up a number of blocks that are guaranteed to be available for privileged files A privileged file has an identifying number in the range 128 through 143 This function is not needed in most cases If it is used it should be called immediately after fs_ init orfs format PARAMETERS blocks Number of blocks to reserve RETURN VALUE 0 Success 1 Failure LIBRARY FILESYSTEM LIB fsck FS1 int fsck int flash DESCRIPTION Check the filesystem for errors PARAMETERS flash A bitmask indicating which checks to NOT perform The following checks are available FSCK_HEADERS Block headers FSCK_CHECKSUMS Data checksums FSCK_VERSION Block versions from a failed write RETURN VALUE 0 Success 0 Failure this is a bitmask indicating which checks failed LIBRARY FILESYSTEM LIB Dynamic C Functions rabbit com 157 fseek FS1 int fseek File f long to char whence DESCRIPTION Places the read po
406. y tailptr _ y y z z tailptr z z Incorrect contents tailptr PARAMETERS sptr String to convert tailptr Assigned the last position of the conversion The next conversion may re sume at the location specified by tailptr base Indicates the radix of conversion RETURN VALUE The long integer LIBRARY STRING LIB SEE ALSO atoi atol 516 rabbit com Dynamic C Functions _sysIsSoftReset void sysIsSoftReset void DESCRIPTION This function should be called at the start of a program if you are using protected variables It determines whether this restart of the board is due to a software reset from Dynamic C or a call to forceSoftReset If it was a soft reset this function then does the following e Calls prot init to initialize the protected variable mechanisms It is up to the user to initialize protected variables e Calls sysResetChain The user my attach functions to this chain to perform additional startup actions for example initializing protected variables If a soft reset did not take place this function calls prot recover to recover any protected variables LIBRARY SYS LIB SEE ALSO chkHardReset chkSoftReset chkWDTO sysResetChain void sysResetChain void DESCRIPTION This is a function chain that should be used to initialize protected variables By default it s emp ty LIBRARY SYS LIB Dynamic C Functions rabbit com 517 tan
407. y t Pointer to a system time structure RETURN VALUE 0 success EINVAL invalid directory entry or time pointer LIBRARY FAT LIB SEE ALSO fat _ReadDir fat Status fat _CreateTime fat _LastAccess 100 rabbit com Dynamic C Functions fat MountPartition int fat MountPartition fat part part DESCRIPTION Marks the enumerated partition as mounted on both the FAT and MBR level The partition MUST be previously enumerated with far EnumPartition This function is called by fat_AutoMount and fat _Init PARAMETER part Pointer to the FAT partition structure to mount RETURN VALUE 0 success EINVAL device or partition structure or part is invalid EBADPART the partition is not a FAT partition ENOPART the partition does not exist on the device EPERM the partition has not been enumerated EACCESS the partition is already linked to another fat_ part structure EBUSY the device is busy Only if non blocking LIBRARY FAT LIB SEE ALSO fat _EnumPartition fat _UnmountPartition Dynamic C Functions rabbit com 101 fat Open int fat Open fat part part char name int type int ff FATfile file DESCRIPTION long prealloc Opens a file or directory optionally creating it if it does not already exist If the function returns EBUSY call it repeatedly with the same arguments until it returns something other than EBUSY PARAMETERS part name type ff fi
408. y rights embodied in the Software including but not limited to patents copyrights and trade secrets 4 Export Law Assurances You agree and certify that neither the Software nor any other technical data received from Rabbit nor the direct product thereof will be exported outside the United States or re exported except as authorized and as permitted by the laws and regulations of the United States and or the laws and regulations of the jurisdiction if other than the United States in which You rightfully obtained the Software The Software may not be exported to any of the following countries Cuba Iran Iraq Libya North Korea Sudan or Syria 5 Government End Users If You are acquiring the Software on behalf of any unit or agency of the United States Government the following provisions apply The Government agrees i if the Software is supplied to the Department of Defense DOD the Software is classified as Commercial Com puter Software and the Government is acquiring only restricted rights in the Software and its docu mentation as that term is defined in Clause 252 227 7013 c 1 of the DFARS and ii if the Software is supplied to any unit or agency of the United States Government other than DOD the Government s rights in the Software and its documentation will be as defined in Clause 52 227 19 c 2 of the FAR or in the case of NASA in Clause 18 52 227 86 d of the NASA Supplement to the FAR 558 rabbit com Dynamic C
409. zed function is serXwrite int port where port is one of the macros SER_PORT A through SER_PORT E PARAMETERS data Data structure to write to serial port X length Number of bytes to write RETURN VALUE The number of bytes successfully written to the serial port LIBRARY RS232 LIB EXAMPLE writes a block of characters repeatedly main Comst last ell W llen Reloloiie p serAopen 19200 while 1 serAwrite s strlen s serAclose 464 rabbit com Dynamic C Functions serXwrUsed int serXwrUsed void where X is A F DESCRIPTION Returns the number of characters in the output buffer This function is non reentrant The functions serErdUsed and serFrdUsed may be used with the Rabbit 3000 and Rabbit 4000 Note Alternatively you can use another form of this function that has been generalized for all serial ports Instead of substituting for X in the function name the prototype of the generalized function is serXwrUsed int port where port is one of the macros SER_PORT A through SER_PORT E RETURN VALUE The number of characters currently in the output buffer LIBRARY RS232 LIB Dynamic C Functions rabbit com 465 Set void set void address unsigned int bit DESCRIPTION Dynamic C may expand this call inline Sets specified bit at memory address to 1 bit may be from 0 to 31 This is equivalent to the following expression but more efficien

Download Pdf Manuals

image

Related Search

Related Contents

Light 2eーt  Accurun®119 anti-HBe 陽性コントロール  Clarion DB125 User's Manual  Chief Flat Panel Swing Arm Wall Mount  AC&バッテリ−両用タイプ BS  Sikafloor 262 AS.cdr - Pretensur, SA de CV  CONSIGNES DE SECURITEET MISES EN GARDE  Z-Vent Quick Start Guide  KJ-4071 取扱説明書  MDC-360C OPERATION AND SERVICE MANUAL  

Copyright © All rights reserved.
Failed to retrieve file