udd.h
Go to the documentation of this file.
1 
33 /*
34  * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
35  */
36 
37 #ifndef _UDD_H_
38 #define _UDD_H_
39 
40 #include "usb_protocol.h"
41 #include "udc_desc.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
58 typedef uint8_t udd_ep_id_t;
60 
63 typedef enum {
67 
74 typedef struct {
78 
81  uint8_t *payload;
82 
84  uint16_t payload_size;
85 
87  void (*callback) (void);
88 
91  bool(*over_under_run) (void);
94 
96 #define Udd_setup_is_in() \
97  (USB_REQ_DIR_IN == (udd_g_ctrlreq.req.bmRequestType & USB_REQ_DIR_MASK))
98 
100 #define Udd_setup_is_out() \
101  (USB_REQ_DIR_OUT == (udd_g_ctrlreq.req.bmRequestType & USB_REQ_DIR_MASK))
102 
104 #define Udd_setup_type() \
105  (udd_g_ctrlreq.req.bmRequestType & USB_REQ_TYPE_MASK)
106 
108 #define Udd_setup_recipient() \
109  (udd_g_ctrlreq.req.bmRequestType & USB_REQ_RECIP_MASK)
110 
116 typedef void (*udd_callback_halt_cleared_t) (void);
117 
127 typedef void (*udd_callback_trans_t) (udd_ep_status_t status,
128  iram_size_t nb_transfered, udd_ep_id_t ep);
129 
135 bool udd_include_vbus_monitoring(void);
136 
140 void udd_enable(void);
141 
145 void udd_disable(void);
146 
154 void udd_attach(void);
155 
161 void udd_detach(void);
162 
169 bool udd_is_high_speed(void);
170 
176 void udd_set_address(uint8_t address);
177 
183 uint8_t udd_getaddress(void);
184 
190 uint16_t udd_get_frame_number(void);
191 
197 uint16_t udd_get_micro_frame_number(void);
198 
201 void udd_send_remotewakeup(void);
202 
209 void udd_set_setup_payload( uint8_t *payload, uint16_t payload_size );
210 
211 
220 
221 #if (USB_DEVICE_MAX_EP != 0)
222 
232 bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes,
233  uint16_t MaxEndpointSize);
234 
240 void udd_ep_free(udd_ep_id_t ep);
241 
249 bool udd_ep_is_halted(udd_ep_id_t ep);
250 
262 bool udd_ep_set_halt(udd_ep_id_t ep);
263 
275 bool udd_ep_clear_halt(udd_ep_id_t ep);
276 
287 bool udd_ep_wait_stall_clear(udd_ep_id_t ep,
288  udd_callback_halt_cleared_t callback);
289 
314 bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket,
315  uint8_t * buf, iram_size_t buf_size,
316  udd_callback_trans_t callback);
326 void udd_ep_abort(udd_ep_id_t ep);
327 
328 #endif
329 
331 
332 
339 void udd_test_mode_j(void);
340 void udd_test_mode_k(void);
341 void udd_test_mode_se0_nak(void);
342 void udd_test_mode_packet(void);
344 
345 
352 
363 extern bool udc_process_setup(void);
364 
370 extern void udc_reset(void);
371 
377 extern void udc_sof_notify(void);
378 
380 
382 
383 #ifdef __cplusplus
384 }
385 #endif
386 #endif // _UDD_H_
void udd_test_mode_packet(void)
void udd_attach(void)
Attach device to the bus when possible.
Definition: usbhs_device.c:898
Common API for USB Device Interface.
void udd_disable(void)
Disables the USB Device mode.
Definition: usbhs_device.c:858
udd_ep_status_t
Endpoint transfer status Returned in parameters of callback register via udd_ep_run routine...
Definition: udd.h:63
USB protocol definitions.
void udd_test_mode_se0_nak(void)
A USB Device SETUP request.
Definition: usb_protocol.h:302
Global variable to give and record information of the setup request management.
Definition: udd.h:74
void udd_test_mode_k(void)
bool udc_process_setup(void)
Decodes and manages a setup request.
Definition: udc.c:1092
void udd_send_remotewakeup(void)
The USB driver sends a resume signal called Upstream Resume.
Definition: usbhs_device.c:984
bool udd_is_high_speed(void)
Test whether the USB Device Controller is running at high speed or not.
Definition: usbhs_device.c:950
uint8_t * payload
Definition: udd.h:81
void udd_enable(void)
Enables the USB Device mode.
Definition: usbhs_device.c:764
void udd_set_address(uint8_t address)
Changes the USB address of device.
Definition: usbhs_device.c:960
uint8_t udd_ep_id_t
Endpoint identifier.
Definition: udd.h:59
void udc_reset(void)
Reset the UDC.
Definition: udc.c:368
void udc_sof_notify(void)
To signal that a SOF is occurred.
Definition: udc.c:395
void(* udd_callback_trans_t)(udd_ep_status_t status, iram_size_t nb_transfered, udd_ep_id_t ep)
End of transfer callback function type. Registered by routine udd_ep_run() Callback called by USB int...
Definition: udd.h:127
uint16_t udd_get_frame_number(void)
Returns the current start of frame number.
Definition: usbhs_device.c:974
void(* udd_callback_halt_cleared_t)(void)
End of halt callback function type. Registered by routine udd_ep_wait_stall_clear() Callback called w...
Definition: udd.h:116
uint16_t udd_get_micro_frame_number(void)
Returns the current micro start of frame number.
Definition: usbhs_device.c:979
uint32_t iram_size_t
Definition: compiler.h:260
unsigned char bool
Boolean.
Definition: compiler.h:243
bool udd_include_vbus_monitoring(void)
Authorizes the VBUS event.
Definition: usbhs_device.c:754
usb_setup_req_t req
Definition: udd.h:77
void udd_detach(void)
Detaches the device from the bus.
Definition: usbhs_device.c:939
uint8_t udd_getaddress(void)
Returns the USB address of device.
Definition: usbhs_device.c:968
udd_ctrl_request_t udd_g_ctrlreq
Global variable to give and record information about setup request management.
Definition: usbhs_device.c:459
void udd_set_setup_payload(uint8_t *payload, uint16_t payload_size)
Load setup payload.
Definition: usbhs_device.c:997
uint16_t payload_size
Size of buffer to send or fill, and content the number of byte transfered.
Definition: udd.h:84
void udd_test_mode_j(void)
uint8_t bmAttributes


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:58