CYCLONE-User-Manual.pdf - 第73页
User Manual For Cyclone LC Programmers 73 “checkCycloneExecutionStatus” call. A result of 0 will be returned even if an error has occurred or if communication with the Cyclone is lost. c. Retrieve the error code from the…

User Manual For Cyclone LC Programmers 72
function will be called once for each Cyclone.
8.2.3.4 Finalization
Before closing the application, it is recommended that the session with the PEmicro hardware be
terminated and the DLL unloaded from memory.
These calls should always be made before the application closes:
disconnectFromAllCyclones( );
unloadLibrary();
Note that the “unloadLibrary” call is only required for C/C++ applications. For the Delphi and C#
example projects, the DLL is automatically unloaded when the application closes.
8.2.3.5 Initial Cyclone Setup
The Cyclone Image Creation Utility software, which is included with each Cyclone, is used to
create the standalone images that will be stored in the non-volatile memory of the Cyclone. These
images contain the FLASH / EEPROM programming algorithms, the actual binary data to be
programmed, the sequence of programming operations, and user specified Cyclone settings.
Prior to using the Cyclone Control Suite, these standalone images need to be created. Please
refer to the user’s manual of your Cyclone unit for more information on standalone images and
image creation.
8.2.3.6 Typical Usage
Figure 8-1: Typical programming procedure flow chart
Figure 8-1 describes the most common sequence of calls to the DLL after successfully connecting
to the Cyclone unit.
a. Initiate programming operations. “startImageExecution” carries out the programming
operations defined in the stand-alone image stored on the Cyclone unit.
b. Wait for programming completion. Note that no error checking is provided by the

User Manual For Cyclone LC Programmers 73
“checkCycloneExecutionStatus” call. A result of 0 will be returned even if an error has
occurred or if communication with the Cyclone is lost.
c. Retrieve the error code from the Cyclone unit to determine if the programming was
successful.
8.2.3.7 External Memory Storage Support
Some Cyclones support external memory storage. The Cyclone Control SDK and Cyclone Control
Console both support images residing on external memory cards. The parameter
“selectedMediaType” is used to select between Cyclone internal Flash and external memory.
Image numbers will go in ascending order starting with image number 1. Internal images will be
counted first and external image numbers will start after the last internal image number. Image
number 1 will refer to the first image in the internal memory if there are any images in the Cyclone
internal memory, if there are no internal images, image 1 will refer to the first image in the external
memory.
Modifying images residing in external memory will only be available on Cyclones with the proper
license. Certain Cyclones may require a supplementary license to support external memory.
8.2.4 Application Programming Interface (API)
This chapter describes the API of the “CycloneControlSDK.dll” in detail. A C/C++ function
prototype is given here. Header files are provided for the following languages:
Pascal
C/C++
8.2.4.1 Constants
8.2.4.2 DLL Loading / Unloading Calls
8.2.4.2.1 loadLibrary
bool loadLibrary(char *filepath);
This function loads the CycloneControlSDK.dll into memory and gives the user access to all of the
Name 32-bit Value
CyclonePortType_USB 5
CyclonePortType_Ethernet 6
CyclonePortType_Serial 7
CycloneInformation_IP_Address 1
CycloneInformation_Name 2
CycloneInformation_Generic_Port_Number 3
CycloneInformation_Cyclone_Type_String 4
MEDIA_INTERNAL 1
MEDIA_EXTERNAL 2

User Manual For Cyclone LC Programmers 74
functions available in the library. This routine must be called before any of the other routines
can be called.
8.2.4.2.2 unloadLibrary
void unloadLibrary(void);
This function unloads the DLL loaded with loadLibrary( ). This call should be made before the
application starts to unload itself.
8.2.4.2.3 enumerateAllPorts
void enumerateAllPorts(void);
This function performs all necessary initialization in order to successfully communicate with a
Cyclone. The function is called once before the first call to “connectToCyclone”.
8.2.4.2.4 disconnectFromAllCyclones
void disconnectFromAllCyclones(void);
This function closes all open Cyclones (if any) and frees all dynamic memory used by the DLL. The
function is called before the user application is closed.
8.2.4.2.5 version
char *version(void);
This call returns a pointer to a null-terminated string that contains the version number of the DLL.
8.2.4.2.6 queryNumberOfAutodetectedCyclones
uint32_t *queryNumberOfAutodetectedCyclones(void);
This function returns the number of Cyclones connected locally on USB and on your local network.
8.2.4.2.7 queryInformationOfAutodetectedCyclone
char *queryInformationOfAutodetectedCyclone(int32_t autodetectIndex, int32_t
informationType);
@returnvalue True if the load was successful, false otherwise.
@returnvalue A pointer to a null-terminated string containing the version number of the DLL.
@returnvalue The number of Cyclones.
@parameter
autodetectIndex
Specifies the index of the detected Cyclone by the function
queryNumberOfAutodetectedCyclones()