Go to the source code of this file.
Data Structures | |
struct | HAL_UsbEndPointDescptr_t |
Typedefs | |
typedef void(*) | TransferCallback_t (void *pArg, uint8_t status, uint16_t transferred, uint16_t remaining) |
Functions | |
END_PACK void | HAL_RegisterRequestHandler (void(*f)(uint8_t *req)) |
Registers user's request handler. | |
void | HAL_RegisterEndOfBusResetHandler (void(*f)(void)) |
Registers user's end of bus reset handler. | |
void | HAL_RegisterResumeHandler (void(*f)(void)) |
Registers user's resume handler. | |
void | HAL_RegisterSuspendHandler (void(*f)(void)) |
Registers user's suspend handler. | |
void | HAL_ConfigureEndpoint (HAL_UsbEndPointDescptr_t *descriptor) |
Configures an endpoint according to its Endpoint Descriptor. | |
uint8_t | HAL_UsbWrite (uint8_t eptnum, void *data, uint32_t size, TransferCallback_t callback, void *argument) |
Sends data through a USB endpoint. Sets up the transfer descriptor, writes one or two data payloads (depending on the number of FIFO bank for the endpoint) and then starts the actual transfer. The operation is complete when all the data has been sent. | |
uint8_t | HAL_UsbRead (uint8_t eptnum, void *data, uint32_t size, TransferCallback_t callback, void *argument) |
Reads incoming data on an USB endpoint This methods sets the transfer descriptor and activate the endpoint interrupt. The actual transfer is then carried out by the endpoint interrupt handler. The Read operation finishes either when the buffer is full, or a short packet (inferior to endpoint maximum size) is received. | |
void | HAL_Halt (uint8_t eptnum) |
Sets the HALT feature on the given endpoint (if not already in this state). | |
void | HAL_Unhalt (uint8_t eptnum) |
Clears the Halt feature on the given endpoint. | |
uint8_t | HAL_IsHalted (uint8_t eptnum) |
Returns the current Halt status of an endpoint. | |
uint8_t | HAL_Stall (uint8_t eptnum) |
Causes the given endpoint to acknowledge the next packet it receives with a STALL handshake. | |
void | HAL_SetAddress (uint8_t *address) |
Sets the device address to the given value. | |
void | HAL_SetConfiguration (uint8_t cfgnum) |
Sets the current device configuration. | |
void | HAL_UsbInit (uint8_t *reqMem) |
Initializes the USB driver. This function must be called before host bus reset and after pull up is connected to D+. After pull up was connected to D+ host resets device with 100ms delay. | |
uint8_t | HAL_GetState (void) |
Returns the current state of the USB device. |
Copyright (c) 2008 , Atmel Corporation. All rights reserved. Licensed under Atmel's Limited License Agreement (BitCloudTM).
Definition in file usb.h.
typedef void(* ) TransferCallback_t(void *pArg, uint8_t status, uint16_t transferred, uint16_t remaining) |
END_PACK void HAL_RegisterRequestHandler | ( | void(*)(uint8_t *req) | f | ) |
Registers user's request handler.
[in] | f | - pointer to user's callback |
void HAL_RegisterEndOfBusResetHandler | ( | void(*)(void) | f | ) |
Registers user's end of bus reset handler.
[in] | f | - pointer to user's callback |
void HAL_RegisterResumeHandler | ( | void(*)(void) | f | ) |
Registers user's resume handler.
[in] | f | - pointer to user's callback |
void HAL_RegisterSuspendHandler | ( | void(*)(void) | f | ) |
Registers user's suspend handler.
[in] | f | - pointer to user's callback |
void HAL_ConfigureEndpoint | ( | HAL_UsbEndPointDescptr_t * | descriptor | ) |
Configures an endpoint according to its Endpoint Descriptor.
[in] | descriptor | - Pointer to an Endpoint descriptor. |
uint8_t HAL_UsbWrite | ( | uint8_t | eptnum, | |
void * | data, | |||
uint32_t | size, | |||
TransferCallback_t | callback, | |||
void * | argument | |||
) |
Sends data through a USB endpoint. Sets up the transfer descriptor, writes one or two data payloads (depending on the number of FIFO bank for the endpoint) and then starts the actual transfer. The operation is complete when all the data has been sent.
If the size of the buffer is greater than the size of the endpoint (or twice the size if the endpoint has two FIFO banks), then the buffer must be kept allocated until the transfer is finished*. This means that it is not possible to declare it on the stack (i.e. as a local variable of a function which returns after starting a transfer).
[in] | eptnum | - Endpoint number. |
[in] | data | - Pointer to a buffer with the data to send. |
[in] | size | - Size of the data buffer. |
[in] | callback | - Optional callback function to invoke when the transfer is complete. |
[in] | argument | - Optional argument to the callback function. |
uint8_t HAL_UsbRead | ( | uint8_t | eptnum, | |
void * | data, | |||
uint32_t | size, | |||
TransferCallback_t | callback, | |||
void * | argument | |||
) |
Reads incoming data on an USB endpoint This methods sets the transfer descriptor and activate the endpoint interrupt. The actual transfer is then carried out by the endpoint interrupt handler. The Read operation finishes either when the buffer is full, or a short packet (inferior to endpoint maximum size) is received.
The buffer must be kept allocated until the transfer is finished*.
[in] | eptnum | - Endpoint number. |
[in] | data | - Pointer to a data buffer. |
[in] | size | - Size of the data buffer in bytes. |
[in] | callback | - Optional end-of-transfer callback function. |
[in] | argument | - Optional argument to the callback function. |
void HAL_Halt | ( | uint8_t | eptnum | ) |
Sets the HALT feature on the given endpoint (if not already in this state).
[in] | eptnum | - Endpoint number. |
void HAL_Unhalt | ( | uint8_t | eptnum | ) |
Clears the Halt feature on the given endpoint.
[in] | eptnum | - Endpoint number. |
uint8_t HAL_IsHalted | ( | uint8_t | eptnum | ) |
Returns the current Halt status of an endpoint.
[in] | eptnum | - Endpoint number. |
uint8_t HAL_Stall | ( | uint8_t | eptnum | ) |
Causes the given endpoint to acknowledge the next packet it receives with a STALL handshake.
[in] | eptnum | - Endpoint number. |
void HAL_SetAddress | ( | uint8_t * | address | ) |
Sets the device address to the given value.
[in] | address | - New device address. |
void HAL_SetConfiguration | ( | uint8_t | cfgnum | ) |
Sets the current device configuration.
[in] | cfgnum | - Configuration number to set. |
void HAL_UsbInit | ( | uint8_t * | reqMem | ) |
Initializes the USB driver. This function must be called before host bus reset and after pull up is connected to D+. After pull up was connected to D+ host resets device with 100ms delay.
[in] | reqMem | - Memory for usb request. Memory is allocated by user. |
uint8_t HAL_GetState | ( | void | ) |
Returns the current state of the USB device.