CYCLONE-User-Manual.pdf - 第78页
User Manual For Cyclone LC Programmers 78 Checks to see if the Cyclone has completed a programming operation started with either the “startImageExecution” or “startDynamicDataProgram” functions. After this function retur…

User Manual For Cyclone LC Programmers 77
A Cyclone may have several independent programming images in its non-volatile internal or
external memory. A programming image contains the programming algorithms, binary data, and
programming sequence. This function instructs the Cyclone to start execution of an image. After
invoking this call, the “checkCycloneExecutionStatus” function is used to poll the Cyclone until
completion.
8.2.4.4.2 startDynamicDataProgram
bool startDynamicDataProgram(uint32_t cycloneHandle, uint32_t targetAddress,
uint16_t dataLength, char *buffer);
Sometimes, in addition to the large amount of static data being programmed into a target from the
Cyclone, it is advantageous for the calling application to program small sections of unique data
dynamically. Examples of this include date/time, serial number, MAC addresses, and lot numbers.
This function is valid to be called only after a programming image has been programmed into the
target (once startImageExecution has completed). Call the “checkCycloneExecutionStatus”
function to wait for completion. If the target is reset by the Cyclone or by a power cycle after
programming the image, this function will fail. The workaround for this is to execute a second
image that will re-load the algorithm before you call startDynamicDataProgram.
8.2.4.4.3 checkCycloneExecutionStatus
uint32_t checkCycloneExecutionStatus(uint32_t cycloneHandle);
@parameter cycloneHandle The handle of the Cyclone to begin programming operations
@parameter imageId
Selects the image on the Cyclone to use. The valid range of this
parameter is from 1 to the total number of images in the Cyclone
with the count starting from internal memory and then external
memory.
If a Cyclone only stores one image, this parameter is 1.
@returnvalue
True if the programming process has started successfully.
False otherwise.
@parameter cycloneHandle The handle of the Cyclone to begin dynamic programming.
@parameter targetAddress
The first memory address of the target processor where the
dynamic data should be written.
@parameter dataLength
The total number of bytes to be written. This parameter cannot
be greater than 255.
@parameter buffer A pointer to the array which holds the data to be written.
@returnvalue
True if the programming process has started successfully.
False otherwise.

User Manual For Cyclone LC Programmers 78
Checks to see if the Cyclone has completed a programming operation started with either the
“startImageExecution” or “startDynamicDataProgram” functions.
After this function returns with completed value, “getLastErrorCode” should be called to determine
the programming result. A result of 0 will be returned even if a programming error has occurred or
if communication with the Cyclone is lost.
8.2.4.4.4 dynamicReadBytes
bool dynamicReadBytes(uint32_t cycloneHandle, uint32_t targetAddress, uint16_t
dataLength, char *buffer);
This function reads a specified number of bytes from a specified memory address of the target
processor. This call is only valid after first having made a call to the “startImageExecution” function
in the sequence of commands.
8.2.4.4.5 getNumberOfErrors
uint32_t getNumberOfErrors(uint32_t cycloneHandle);
This function returns a count of all the errors recorded in the DLL and in the Cyclone.
8.2.4.4.6 getErrorCode
uint32_t getErrorCode(uint32_t cycloneHandle, uint32_t errorNum);
This function returns the specified error code recorded in the DLL or in the Cyclone.
@parameter cycloneHandle The handle of the Cyclone to perform a status check on.
@returnvalue
1 = Currently programming
0 = Completed (with or without error)
@parameter cycloneHandle The handle of the Cyclone that will perform the dynamic read.
@parameter targetAddress
The first memory address of the target processor where the
data will be read.
@parameter dataLength The number of total bytes to read from the target processor
@parameter buffer
A pointer to the array where the data read will be stored. This
array must have been allocated prior to calling this function.
@returnvalue
True if the data was successfully read
False otherwise
@parameter cycloneHandle The handle of the Cyclone to get a count of the errors.
@returnvalue The number of errors in the DLL and in the Cyclone.
@parameter cycloneHandle The handle of the Cyclone to retrieve the error code.
@parameter errorNum
If getNumberOfErrors is greater than 1, this specifies the error
number.

User Manual For Cyclone LC Programmers 79
8.2.4.4.7 getLastErrorAddr
uint32_t getLastErrorAddr(uint32_t cycloneHandle);
If the “getErrorCode” function returns a non-zero value (indicating an error has occurred), this
routine can be used to query the address where the error occurred.
8.2.4.4.8 getDescriptionOfErrorCode
char *getDescriptionOfErrorCode(uint32_t cycloneHandle, uint16_t errorCode);
This function returns a description of the error code.
8.2.4.4.9 resetCyclone
bool resetCyclone(uint32_t cycloneHandle, uint32_t resetDelayInMs);
This function performs a hard reset of the Cyclone. It is the same as pressing the reset button. This
is considered a legacy call and does not need to be called by the application.
8.2.4.5 Configuration / Image Maintenance Calls
8.2.4.5.1 getImageDescription
char *getImageDescription(uint32_t cycloneHandle, uint32_t imageId) ;
This function returns the description of a particular image stored on the Cyclone (internal Flash or
external memory card). This description is specified by the user when the image is created.
@returnvalue The error code of the DLL or Cyclone
@parameter cycloneHandle
The handle of the Cyclone from which to request the error
address.
@returnvalue
The memory address where the last programming error
occurred.
@parameter cycloneHandle The handle of the Cyclone to retrieve the error code description.
@parameter errorCode The error code to check.
@returnvalue
A pointer to a null-terminated character string that contains the
error code description.
@parameter cycloneHandle The handle of the Cyclone that will be reset.
@parameter resetDelayInMs
The reset delay, specified in milliseconds. The delay should be
at least 5500 ms.
@returnvalue
True if reset was successful
False otherwise
@parameter cycloneHandle The handle of the Cyclone to get an image description.