This function is normally used to send 64 bytes packets to the USB endpoint EP1 (0x01).
This function is also able to obtain the response of the USB FX2 microcontroller, MicroBlaze embedded processor or SPI Flash through the USB FX2 microcontroller endpoint EP1 (0x81).
Using API command, TE_USB_FX2_SendCommand() is able to communicate with:
The connection with EP1 command is used to:
E_USB_FX2_CYAPI int TE_USB_FX2_SendCommand(CCyUSBDevice USBDeviceList, byte Command, long CmdLength, byte* Reply, long ReplyLength, unsigned long Timeout)
Your application program shall call this function like this:
TE_USB_FX2_SendCommand( USBDeviceList, Command, CmdLength, Reply, ReplyLength, Timeout);
CCyUSBDevice *USBDeviceList
CCyUSBDevice is a type defined in CyAPI.lib. Its name is misleading because it is not a class that represents a single USB device, but it rather represents a list of USB devices.
CCyUSBDevice is the list of devices served by the CyUSB.sys driver (or a derivative like TE_USB_FX2_xx.sys). This parameter is passed by pointer. See page 7 and pages 23-49 of CyAPI.pdf (Cypress CyAPI Programmer's Reference).
byte* Command
This parameter is passed by pointer. It is the pointer to the byte array that contains the commands to send to USB FX2 microcontroller (FX2_Commands), to MicroBlaze (MB_Commands) or to SPI Flash.
long CmdLength
This parameter is the length (in bytes) of the previous byte array; it is the length of the packet to transmit to USB FX2 controller endpoint EP1 (0x01). It is typically initialized to 64 bytes.
byte* Reply
This parameter (passed by pointer) is the pointer to the byte array that contains the response to the command sent to the USB FX2 microcontroller (FX2_Commands) or to the MicroBlaze embedded processor (MB_Commands).
long ReplyLength
This parameter is the length (in bytes) of the previous byte array; it is the length of the packet to transmit to the USB FX2 microcontroller endpoint EP1 (0x81). It is typically initialized to 64 byes, but normally the meaningful bytes are less.
unsigned long Timeout
The unsigned integer value is the time in milliseconds assigned to the synchronous method XferData() of data transfer used by CyAPI.lib.
TimeOut is the time that is allowed to the function for sending/receiving the data packet passed to the function; this timeout shall be large enough to allow the data/command transmission/reception. Otherwise the transmission/reception will fail. See Timeout Setting.
int : integer type
This function returns true (ST_OK=0) if it is able to send a command to EP1 and receive a response within 2*Timeout milliseconds. This function returns false (ST_ERROR=1) otherwise.
enum ST_Status { ST_OK = 0, ST_ERROR = 1 };