CYCLONE-User-Manual.pdf - 第76页

User Manual For Cyclone LC Programmers 76 8.2.4.3.3 setLocalMachineIpNumber void setLocalMachineIpNumber(char* ipNumber); If a PC has multiple network interface cards, this function sets the IP address of the network car…

100%1 / 149
User Manual For Cyclone LC Programmers 75
8.2.4.3 Cyclone Connecting / Disconnecting Calls
8.2.4.3.1 connectToCyclone
uint32_t connectToCyclone(char *nameIpOrPortIdentifier) ;
This function opens a session with a Cyclone and tests the connection. The handle returned by
this function is passed as a parameter to other functions provided by the DLL. If you connect to a
Cyclone that already has a handle, the same handle is returned. If there is a failure contacting the
Cyclone, the function returns a 0.
Note that the DLL does not support multiple Cyclones connected via the serial port. If you require
more than one Cyclone to use a serial port connection, PEmicro recommends using the RS232
communication protocols.
8.2.4.3.2 connectToMultipleCyclones
bool connectToMultipleCyclones(char *nameIpOrPortIdentifierArray,
multipleCycloneHandleArrayPtrType cycloneHandleArrayPointer, int32_t
*numberOfCycloneOpensAttempted);
This function returns a array of handles to opened Cyclones from a null-terminated String of
comma delimited identifiers.
@parameter
informationType
Specifies the property of the Cyclone to return. The possible values
are:
CycloneInformationation_IP_Address
CycloneInformation_Name
CycloneInformation_Generic_port_number
@returnvalue
A pointer to a null-terminated string containing the property value of
the specified Cyclone.
@parameter
nameIPOrPortIdentifier
A pointer to a null-terminated string which uniquely identifies the
Cyclone connected to the host PC.
If identifying by IP address, the string should be in the format of
xxx.xxx.xxx.xxx, where xxx = 0…255.
If identifying by name, the string should contain the name of the
Cyclone.
If identifying by port and the Cyclone is connected by USB, the
string should be USB# where # is 1…8. If the Cyclone is
connected by Ethernet, the string should be in the format of
xxx.xxx.xxx.xxx, where xxx = 0…255.
If the Cyclone is connected by Serial, the string should be
COM1.
@returnvalue
The handle to the opened Cyclone unit. A return value of 0
indicates a failure to connect to the specified Cyclone unit.
User Manual For Cyclone LC Programmers 76
8.2.4.3.3 setLocalMachineIpNumber
void setLocalMachineIpNumber(char* ipNumber);
If a PC has multiple network interface cards, this function sets the IP address of the network card
to use communicate with the Cyclones. This is called prior to calling any other functions.
8.2.4.4 Controlling Cyclone Programming
8.2.4.4.1 startImageExecution
bool startImageExecution(uint32_t cycloneHandle, uint32_t imageId);
@parameter nameIpOrPortIdentifierArray
A null terminated string containing one or more
Cyclone identifiers (name, IP address, or port
number) delimited by commas.
Example: USB1,209.1.10.2,Orion,COM1
If identifying by IP address, the string should be
in the format of xxx.xxx.xxx.xxx, where xxx =
0…255.
If identifying by port and the Cyclone is
connected by USB, the string should be USB#
where # is 1…8.
If the Cyclone is connected by Serial, the string
should be COM1.
@parameter
multipleCycloneHandleArrayPtrType
A pointer to an array of Cyclone handles. Each
element of the array corresponds to the position
of the identifier in the previous parameter. If the
function connected to the Cyclone, the value of
the array element would correspond to its
handle otherwise it will be 0.
@parameter
numberOfCycloneOpensAttempted
This value will be modified with the number of
Cyclones that the function attempted to open. It
is also the size of the
multipleCycloneHandleArrayPtrType structure.
@returnvalue
True if every Cyclone was identified and has a
valid handle.
False if there were any errors identifying or
connecting to any of the Cyclones.
@parameter ipNumber
A pointer to a null-terminated character string in the format
xxx.xxx.xxx.xxx, where xxx = 0…255, representing the IP address of
the network card.
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.