M2M_API_RESULT m2m_hw_usb_ioctl (M2M_T_HW_USB_HANDLE handle,
M2M_USB_ACTION_SELECTOR arg, INT32 value)
Description: the function configures the USB channel feature using "arg" parameter (selector) and the "value" parameter (option). If USB opening mode is set in no blocking mode, and the USB cable is not plugged in, the function returns a failure indication.
Parameters:
handle: USB channel
handle
arg: selector of the USB feature, refer to M2M_USB_ACTION_SELECTOR
enum
value: option related to the selected USB feature, refer to the tables
below:
arg: sets the USB feature |
value: sets the option related to the selected USB feature |
M2M_USB_BLOCKING_SET valid for TX and RX |
M2M_HW_USB_IO_BLOCKING_ON: sets blocking to ON, default mode.
TX: The API returns the control when "len" bytes have been moved to the USB transmitter buffer. "len_sent" points to the number of bytes moved, and it is equal to "len".
RX: The API returns the control when "len" or more bytes have been received. "len_read" is the number of bytes moved into the buffer, it is equal to "len". Bytes exceeding "len" remain in the USB receiver buffer. You can delete them using the following function: m2m_hw_usb_ioctl (usb_handle, M2M_USB_CLEAR_RX, M2M_HW_USB_IO_NO_ARG) |
M2M_HW_USB_IO_BLOCKING_OFF: sets blocking to OFF
TX: The API tries to move "len" bytes in USB transmitter buffer, in accordance with the available resources. In any case, returns immediately the control. "len_sent" points to the number of bytes actually moved into USB transmitter buffer
RX: The API collects "len" bytes if they are available in the USB receiver buffer, and returns immediately the control. "len_read" is the number of available bytes moved from USB receiver buffer into the allocated buffer pointed by "buffer". | |
M2M_HW_USB_IO_BLOCKING_RELEASE: releases both pending RX and TX activities, and set blocking to OFF. The new mode is blocking OFF |
Refer to the M2M_HW_UART_IO_BLOCKING_SET examples.
arg: sets the UART feature |
value: sets the option related to the selected UART feature |
M2M_USB_RX_BLOCKING_SET valid only for RX |
M2M_HW_USB_IO_BLOCKING_ON: sets blocking to ON only for RX activity, default. |
M2M_HW_USB_IO_BLOCKING_OFF: sets blocking to OFF only for RX activity. | |
M2M_HW_USB_IO_BLOCKING_RELEASE: releases RX pending activity if any, and lets unchanged the blocking mode. |
Refer to the M2M_HW_UART_RX_BLOCKING_SET examples.
arg: sets the UART feature |
value: sets the option related to the selected UART feature |
M2M_USB_TX_BLOCKING_SET valid only for TX |
M2M_HW_USB_IO_BLOCKING_ON: sets blocking to ON only for TX activity, default. |
M2M_HW_USB_IO_BLOCKING_OFF: sets blocking to OFF only for TX activity | |
M2M_HW_USB_IO_BLOCKING_RELEASE: releases TX pending activity if any, and lets unchanged the blocking mode. |
Refer to the M2M_HW_UART_RX_BLOCKING_SET examples.
arg: sets the USB feature |
value: sets the option related to the selected USB feature |
M2M_USB_AT_MODE_SET Set AT command mode |
M2M_HW_USB_IO_AT_MODE_OFF: default option. It routes the data received from the USB to the user AppZone application as they are, see document [4]/[8]. |
M2M_HW_USB_IO_AT_MODE_ON: this options routes the data received from the selected USBx channel to AT1 parser by means of AZ1 logical port, see document [4]/[8]. In addition, it sets RX in blocking OFF, and TX blocking mode is unchanged. |
Refer to the M2M_HW_UART_IO_AT_MODE_SET example.
arg: sets the USB feature |
value: sets the option related to the selected USB feature |
M2M_USB_CLEAR_RX Clear the input buffer of the USB channel |
M2M_HW_USB_IO_NO_ARG: the m2m_hw_usb_ioctl function uses a "arg" parameter that do not need options |
Refer to the M2M_HW_UART_CLEAR_RX example.
arg: sets the USB feature |
value: sets the option related to the selected USB feature |
M2M_USB_RCV_FUNC Indicates that the value parameter is a callback to manage received data |
static INT32 hw_usb_read_cb ( M2M_T_HW_USB_HANDLE handle, CHAR *buffer, INT32 len ) |
Refer to the M2M_HW_UART_IO_RCV_FUNC example.
arg: sets the USB feature |
value: sets the option related to the selected USB feature |
M2M_USB_NO_ACTION For internal use only |
/ |
Return
value:
refer to M2M_API_RESULT
enum