|
STM32 core 3.0.1-dev
Arduino core for STM32 based boards: API reference
|
← STM32duino documentation
|
Header for cdc_queue.c module. More...
#include <stdbool.h>#include "usbd_def.h"Classes | |
| struct | CDC_TransmitQueue_TypeDef |
| Transmit queue: ring buffer filled by the application and drained by USB IN transfers. More... | |
| struct | CDC_ReceiveQueue_TypeDef |
| Receive queue: ring buffer filled by USB OUT transfers and drained by the application. More... | |
Macros | |
| #define | CDC_QUEUE_MAX_PACKET_SIZE USB_FS_MAX_PACKET_SIZE |
| Maximum size, in bytes, of one USB packet handled by the queues. | |
| #define | CDC_TRANSMIT_QUEUE_BUFFER_PACKET_NUMBER 2 |
| Number of packets the transmit queue buffer can hold. | |
| #define | CDC_RECEIVE_QUEUE_BUFFER_PACKET_NUMBER 3 |
| Number of packets the receive queue buffer can hold. | |
| #define | CDC_TRANSMIT_QUEUE_BUFFER_SIZE ((uint16_t)(CDC_QUEUE_MAX_PACKET_SIZE * CDC_TRANSMIT_QUEUE_BUFFER_PACKET_NUMBER)) |
| Size, in bytes, of the transmit queue buffer. | |
| #define | CDC_RECEIVE_QUEUE_BUFFER_SIZE ((uint16_t)(CDC_QUEUE_MAX_PACKET_SIZE * CDC_RECEIVE_QUEUE_BUFFER_PACKET_NUMBER)) |
| Size, in bytes, of the receive queue buffer. | |
Functions | |
| void | CDC_TransmitQueue_Init (CDC_TransmitQueue_TypeDef *queue) |
| Initialize read and write position of the transmit queue. | |
| int | CDC_TransmitQueue_WriteSize (CDC_TransmitQueue_TypeDef *queue) |
| Get the free space available for writing into the transmit queue. | |
| int | CDC_TransmitQueue_ReadSize (CDC_TransmitQueue_TypeDef *queue) |
| Get the amount of data stored in the transmit queue. | |
| void | CDC_TransmitQueue_Enqueue (CDC_TransmitQueue_TypeDef *queue, const uint8_t *buffer, uint32_t size) |
| Copy data into the transmit queue, wrapping at the end of the buffer. | |
| uint8_t * | CDC_TransmitQueue_ReadBlock (CDC_TransmitQueue_TypeDef *queue, uint16_t *size) |
| Get a contiguous block of queued data to transmit. | |
| void | CDC_TransmitQueue_CommitRead (CDC_TransmitQueue_TypeDef *queue) |
| Release the block returned by CDC_TransmitQueue_ReadBlock(). | |
| void | CDC_ReceiveQueue_Init (CDC_ReceiveQueue_TypeDef *queue) |
| Initialize read and write position of the receive queue. | |
| int | CDC_ReceiveQueue_ReadSize (CDC_ReceiveQueue_TypeDef *queue) |
| Get the amount of data available for reading from the receive queue. | |
| int | CDC_ReceiveQueue_Dequeue (CDC_ReceiveQueue_TypeDef *queue) |
| Read and remove one byte from the receive queue. | |
| int | CDC_ReceiveQueue_Peek (CDC_ReceiveQueue_TypeDef *queue) |
| Read one byte from the receive queue without removing it. | |
| uint16_t | CDC_ReceiveQueue_Read (CDC_ReceiveQueue_TypeDef *queue, uint8_t *buffer, uint16_t size) |
| Read and remove up to size bytes from the receive queue. | |
| bool | CDC_ReceiveQueue_ReadUntil (CDC_ReceiveQueue_TypeDef *queue, uint8_t terminator, uint8_t *buffer, uint16_t size, uint16_t *fetched) |
| Read and remove bytes from the receive queue up to a terminator. | |
| uint8_t * | CDC_ReceiveQueue_ReserveBlock (CDC_ReceiveQueue_TypeDef *queue) |
| Reserve space in the receive queue for an incoming packet. | |
| void | CDC_ReceiveQueue_CommitBlock (CDC_ReceiveQueue_TypeDef *queue, uint16_t size) |
| Commit bytes written to a block returned by CDC_ReceiveQueue_ReserveBlock(). | |
Header for cdc_queue.c module.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| #define CDC_QUEUE_MAX_PACKET_SIZE USB_FS_MAX_PACKET_SIZE |
Maximum size, in bytes, of one USB packet handled by the queues.
Depends on the USB speed in use (high speed or full speed).
| #define CDC_RECEIVE_QUEUE_BUFFER_PACKET_NUMBER 3 |
Number of packets the receive queue buffer can hold.
Can be overridden.
| #define CDC_TRANSMIT_QUEUE_BUFFER_PACKET_NUMBER 2 |
Number of packets the transmit queue buffer can hold.
Can be overridden.
| void CDC_ReceiveQueue_CommitBlock | ( | CDC_ReceiveQueue_TypeDef * | queue, |
| uint16_t | size | ||
| ) |
Commit bytes written to a block returned by CDC_ReceiveQueue_ReserveBlock().
| queue | receive queue. |
| size | number of bytes written into the reserved block. |
| int CDC_ReceiveQueue_Dequeue | ( | CDC_ReceiveQueue_TypeDef * | queue | ) |
Read and remove one byte from the receive queue.
| queue | receive queue. |
| void CDC_ReceiveQueue_Init | ( | CDC_ReceiveQueue_TypeDef * | queue | ) |
Initialize read and write position of the receive queue.
| queue | receive queue to initialize. |
| int CDC_ReceiveQueue_Peek | ( | CDC_ReceiveQueue_TypeDef * | queue | ) |
Read one byte from the receive queue without removing it.
| queue | receive queue. |
| uint16_t CDC_ReceiveQueue_Read | ( | CDC_ReceiveQueue_TypeDef * | queue, |
| uint8_t * | buffer, | ||
| uint16_t | size | ||
| ) |
Read and remove up to size bytes from the receive queue.
| queue | receive queue. |
| buffer | destination buffer. |
| size | maximum number of bytes to read. |
| int CDC_ReceiveQueue_ReadSize | ( | CDC_ReceiveQueue_TypeDef * | queue | ) |
Get the amount of data available for reading from the receive queue.
| queue | receive queue. |
| bool CDC_ReceiveQueue_ReadUntil | ( | CDC_ReceiveQueue_TypeDef * | queue, |
| uint8_t | terminator, | ||
| uint8_t * | buffer, | ||
| uint16_t | size, | ||
| uint16_t * | fetched | ||
| ) |
Read and remove bytes from the receive queue up to a terminator.
| queue | receive queue. |
| terminator | byte that ends the read. |
| buffer | destination buffer. |
| size | maximum number of bytes to copy into buffer. |
| fetched | output: number of bytes copied into buffer, excluding the terminator. |
| uint8_t * CDC_ReceiveQueue_ReserveBlock | ( | CDC_ReceiveQueue_TypeDef * | queue | ) |
Reserve space in the receive queue for an incoming packet.
| queue | receive queue. |
| void CDC_TransmitQueue_CommitRead | ( | CDC_TransmitQueue_TypeDef * | queue | ) |
Release the block returned by CDC_TransmitQueue_ReadBlock().
| queue | transmit queue. |
| void CDC_TransmitQueue_Enqueue | ( | CDC_TransmitQueue_TypeDef * | queue, |
| const uint8_t * | buffer, | ||
| uint32_t | size | ||
| ) |
Copy data into the transmit queue, wrapping at the end of the buffer.
| queue | transmit queue. |
| buffer | data to copy. |
| size | number of bytes to copy. |
| void CDC_TransmitQueue_Init | ( | CDC_TransmitQueue_TypeDef * | queue | ) |
Initialize read and write position of the transmit queue.
| queue | transmit queue to initialize. |
| uint8_t * CDC_TransmitQueue_ReadBlock | ( | CDC_TransmitQueue_TypeDef * | queue, |
| uint16_t * | size | ||
| ) |
Get a contiguous block of queued data to transmit.
| queue | transmit queue. |
| size | output: length of the returned block in bytes. |
| int CDC_TransmitQueue_ReadSize | ( | CDC_TransmitQueue_TypeDef * | queue | ) |
Get the amount of data stored in the transmit queue.
| queue | transmit queue. |
| int CDC_TransmitQueue_WriteSize | ( | CDC_TransmitQueue_TypeDef * | queue | ) |
Get the free space available for writing into the transmit queue.
| queue | transmit queue. |