Data Structures | Macros
Usbchap9_src

Data Structures

struct  USBLIB_PACKED
 This structure is used to access the Command Block wrapper (CBW) data structure that is used when the communicating with the mass storage class device. More...
 

Macros

#define USBShort(usValue)   (usValue & 0xff), (usValue >> 8)
 
#define USB3Byte(ulValue)
 
#define USBLong(ulValue)
 
#define NEXT_USB_DESCRIPTOR(ptr)
 

Detailed Description

Macro Definition Documentation

#define NEXT_USB_DESCRIPTOR (   ptr)
Value:
(tDescriptorHeader *)(((uint8_t *)(ptr)) + \
*((uint8_t *)(ptr)))

Traverse to the next USB descriptor in a block.

Parameters
ptrpoints to the first byte of a descriptor in a block of USB descriptors.

This macro aids in traversing lists of descriptors by returning a pointer to the next descriptor in the list given a pointer to the current one.

Returns
Returns a pointer to the next descriptor in the block following ptr.
#define USB3Byte (   ulValue)
Value:
(ulValue & 0xff), \
((ulValue >> 8) & 0xff), \
((ulValue >> 16) & 0xff)

Write a 3 byte unsigned long value to a USB descriptor block.

Parameters
ulValueis the three byte unsigned value that is to be written to the descriptor.

This helper macro is used in descriptor definitions to write three-byte values. Since the configuration descriptor contains all interface and endpoint descriptors in a contiguous block of memory, these descriptors are typically defined using an array of bytes rather than as packed structures.

Returns
Not a function.
#define USBLong (   ulValue)
Value:
(ulValue & 0xff), \
((ulValue >> 8) & 0xff), \
((ulValue >> 16) & 0xff), \
((ulValue >> 24) & 0xff)

Write a 4 byte unsigned long value to a USB descriptor block.

Parameters
ulValueis the four byte unsigned long that is to be written to the descriptor.

This helper macro is used in descriptor definitions to write four-byte values. Since the configuration descriptor contains all interface and endpoint descriptors in a contiguous block of memory, these descriptors are typically defined using an array of bytes rather than as packed structures.

Returns
Not a function.
#define USBShort (   usValue)    (usValue & 0xff), (usValue >> 8)

Write a 2 byte uint16_t value to a USB descriptor block.

Parameters
usValueis the two byte uint16_t that is to be written to the descriptor.

This helper macro is used in descriptor definitions to write two-byte values. Since the configuration descriptor contains all interface and endpoint descriptors in a contiguous block of memory, these descriptors are typically defined using an array of bytes rather than as packed structures.

Returns
Not a function.

Copyright 2016, Texas Instruments Incorporated