To send a switching request to the TX board, the calling application must perform the following steps:
Step |
Action |
1 |
Initialize all parameters expected by the TX SWI function. Most TX SWI functions have information blocks associated with the function. |
2 |
Determine the packet size by calling the TX SWI function and providing all parameters except the CPIPKT. Pass the CPIPKT as NULL to indicate that the CPI packet size is needed. The TX SWI function returns the byte length of the CPI packet required to issue the request. |
3 |
Obtain the CPIPKT by either dynamically allocating memory for the CPI packet or pointing to an available global memory space that is large enough to use as the CPI packet. |
4 |
Address the packet by calling txswiAddress to zero-fill the packet and to set the addressing information in the CPI packet header. |
5 |
Format the request packet by calling the same TX SWI function used in Step 2 to determine the required packet size, passing all the same parameters, and passing the address of the CPI packet rather than a NULL pointer. This command triggers the TX SWI function to fill in the payload of the request message. |
6 |
Send the request to the board by calling cpia_send. |
7 |
Expect a response. The TX board processes the TX SWI request message and issues an asynchronous response message after the request is serviced. These response messages are received like any other message from the TX board, with the receive notification provided to the cpia_open call. |
To receive TX SWI responses, the application must perform the following steps:
Step |
Action |
1 |
Handle the response indication. When a signal is received indicating that the CPI channel requires servicing, call cpia_intr to begin handling the notification. cpia_intr calls the receive notification function provided to cpia_open. Call cpia_get_data to get a pointer to the received packet. |
2 |
Decode the response packet. After calling cpia_get_data, call txswiReply to decode the received message from inside the response notification. |
3 |
Check for errors. Verify that NULL was not returned from txswiReply and that the returned completion code is zero. |
4 |
Process successes. Perform any processing that is waiting on the response message. |
To stop using the TX SWI library, call cpi_close to close the CPI channel.