tinyusb
std_request.h
Go to the documentation of this file.
1 /**************************************************************************/
37 /**************************************************************************/
38 
42 #ifndef _TUSB_STD_REQUEST_H_
43 #define _TUSB_STD_REQUEST_H_
44 
45 #ifdef __cplusplus
46  extern "C" {
47 #endif
48 
49 typedef ATTR_PACKED_STRUCT(struct){
50  union {
51  ATTR_PACKED_STRUCT(struct) {
52  uint8_t recipient : 5;
53  uint8_t type : 2;
54  uint8_t direction : 1;
55  } bmRequestType_bit;
56  uint8_t bmRequestType;
57  };
58 
59  uint8_t bRequest;
60  uint16_t wValue;
61  uint16_t wIndex;
62  uint16_t wLength;
64 
65 STATIC_ASSERT( sizeof(tusb_control_request_t) == 8, "mostly compiler option issue");
66 
67 // TODO move to somewhere suitable
68 static inline uint8_t bm_request_type(uint8_t direction, uint8_t type, uint8_t recipient) ATTR_CONST ATTR_ALWAYS_INLINE;
69 static inline uint8_t bm_request_type(uint8_t direction, uint8_t type, uint8_t recipient)
70 {
71  return ((uint8_t) (direction << 7)) | ((uint8_t) (type << 5)) | (recipient);
72 }
73 
74 #ifdef __cplusplus
75  }
76 #endif
77 
78 #endif /* _TUSB_STD_REQUEST_H_ */
79 
Definition: std_request.h:49
#define ATTR_ALWAYS_INLINE
Generally, functions are not inlined unless optimization is specified. For functions declared inline...
Definition: compiler_gcc.h:89
#define ATTR_CONST
Many functions do not examine any values except their arguments, and have no effects except the retur...
Definition: compiler_gcc.h:100