File ns_usb.h
FileList > includes-api > ns_usb.h
Go to the source code of this file
#include "am_bsp.h"
#include "am_mcu_apollo.h"
#include "am_util.h"
#include "ns_core.h"
#include "webusb_controller.h"
Classes
Type | Name |
---|---|
struct | TU_ATTR_PACKED URL buffer Stucture. |
struct | ns_usb_config_t USB Configuration Struct. |
struct | ns_usb_transaction_t USB Transaction Control Stucture. |
Public Types
Type | Name |
---|---|
typedef struct TU_ATTR_PACKED | ns_tusb_desc_webusb_url_t URL buffer Stucture. |
enum | ns_usb_device_type_e USB Device Type. |
typedef void(* | ns_usb_rx_cb |
typedef void(* | ns_usb_service_cb |
typedef void(* | ns_usb_tx_cb |
typedef void * | usb_handle_t |
Public Attributes
Type | Name |
---|---|
const ns_core_api_t | ns_usb_V0_0_1 |
const ns_core_api_t | ns_usb_V1_0_0 |
const ns_core_api_t | ns_usb_current_version |
const ns_core_api_t | ns_usb_oldest_supported_version |
Public Functions
Type | Name |
---|---|
uint32_t | ns_get_cdc_rx_bufferLength () |
uint32_t | ns_get_cdc_tx_bufferLength () |
ns_tusb_desc_webusb_url_t * | ns_get_desc_url () |
bool | ns_usb_data_available (usb_handle_t handle) |
uint8_t * | ns_usb_get_rx_buffer () |
uint8_t * | ns_usb_get_tx_buffer () |
void | ns_usb_handle_read_error (usb_handle_t h) Flushes the USB RX fifo after a delay, resets ns_usb rx state. |
uint32_t | ns_usb_init (ns_usb_config_t * cfg, usb_handle_t * h) Initialize the USB system. |
uint32_t | ns_usb_recieve_data (usb_handle_t handle, void * buffer, uint32_t bufsize) Blocking USB Receive Data. |
void | ns_usb_register_callbacks (usb_handle_t handle, ns_usb_rx_cb rxcb, ns_usb_tx_cb txcb) Register callbacks for USB events, should be called after ns_usb_init. |
uint32_t | ns_usb_send_data (usb_handle_t handle, void * buffer, uint32_t bufsize) Blocking USB Send Data. |
Macros
Type | Name |
---|---|
define | MAX_URL_LENGTH 100 |
define | NS_USB_API_ID 0xCA0006 |
define | NS_USB_CURRENT_VERSION NS_USB_V1_0_0 |
define | NS_USB_OLDEST_SUPPORTED_VERSION NS_USB_V0_0_1 |
define | NS_USB_V0_0_1 { .major = 0, .minor = 0, .revision = 1 } |
define | NS_USB_V1_0_0 { .major = 1, .minor = 0, .revision = 0 } |
Public Types Documentation
typedef ns_tusb_desc_webusb_url_t
typedef struct TU_ATTR_PACKED ns_tusb_desc_webusb_url_t;
enum ns_usb_device_type_e
enum ns_usb_device_type_e {
NS_USB_CDC_DEVICE,
NS_USB_HID_DEVICE,
NS_USB_MSC_DEVICE,
NS_USB_VENDOR_DEVICE
};
typedef ns_usb_rx_cb
typedef void(* ns_usb_rx_cb) (ns_usb_transaction_t *);
typedef ns_usb_service_cb
typedef void(* ns_usb_service_cb) (uint8_t);
typedef ns_usb_tx_cb
typedef void(* ns_usb_tx_cb) (ns_usb_transaction_t *);
typedef usb_handle_t
typedef void* usb_handle_t;
Public Attributes Documentation
variable ns_usb_V0_0_1
const ns_core_api_t ns_usb_V0_0_1;
variable ns_usb_V1_0_0
const ns_core_api_t ns_usb_V1_0_0;
variable ns_usb_current_version
const ns_core_api_t ns_usb_current_version;
variable ns_usb_oldest_supported_version
const ns_core_api_t ns_usb_oldest_supported_version;
Public Functions Documentation
function ns_get_cdc_rx_bufferLength
uint32_t ns_get_cdc_rx_bufferLength ()
function ns_get_cdc_tx_bufferLength
uint32_t ns_get_cdc_tx_bufferLength ()
function ns_get_desc_url
ns_tusb_desc_webusb_url_t * ns_get_desc_url ()
function ns_usb_data_available
bool ns_usb_data_available (
usb_handle_t handle
)
function ns_usb_get_rx_buffer
uint8_t * ns_usb_get_rx_buffer ()
function ns_usb_get_tx_buffer
uint8_t * ns_usb_get_tx_buffer ()
function ns_usb_handle_read_error
Flushes the USB RX fifo after a delay, resets ns_usb rx state.
void ns_usb_handle_read_error (
usb_handle_t h
)
Parameters:
h
handle
function ns_usb_init
Initialize the USB system.
uint32_t ns_usb_init (
ns_usb_config_t * cfg,
usb_handle_t * h
)
Parameters:
cfg
handle
Returns:
uint32_t Status
function ns_usb_recieve_data
Blocking USB Receive Data.
uint32_t ns_usb_recieve_data (
usb_handle_t handle,
void * buffer,
uint32_t bufsize
)
Parameters:
handle
USB handlebuffer
Pointer to buffer where data will be placedbufsize
Requested number of bytes
Returns:
uint32_t
function ns_usb_register_callbacks
Register callbacks for USB events, should be called after ns_usb_init.
void ns_usb_register_callbacks (
usb_handle_t handle,
ns_usb_rx_cb rxcb,
ns_usb_tx_cb txcb
)
Parameters:
handle
rx_cb
tx_cb
function ns_usb_send_data
Blocking USB Send Data.
uint32_t ns_usb_send_data (
usb_handle_t handle,
void * buffer,
uint32_t bufsize
)
Parameters:
handle
USB handlebuffer
Pointer to buffer with data to be sentbufsize
Requested number of bytes
Returns:
uint32_t
Macro Definition Documentation
define MAX_URL_LENGTH
#define MAX_URL_LENGTH 100
define NS_USB_API_ID
#define NS_USB_API_ID 0xCA0006
define NS_USB_CURRENT_VERSION
#define NS_USB_CURRENT_VERSION NS_USB_V1_0_0
define NS_USB_OLDEST_SUPPORTED_VERSION
#define NS_USB_OLDEST_SUPPORTED_VERSION NS_USB_V0_0_1
define NS_USB_V0_0_1
#define NS_USB_V0_0_1 { .major = 0, .minor = 0, .revision = 1 }
define NS_USB_V1_0_0
#define NS_USB_V1_0_0 { .major = 1, .minor = 0, .revision = 0 }
The documentation for this class was generated from the following file neuralSPOT/neuralspot/ns-usb/includes-api/ns_usb.h