diff options
| author | François Cartegnie <281376+fcartegnie@users.noreply.github.com> | 2024-08-20 13:43:09 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-20 13:43:09 +0700 |
| commit | f5874d607315ff88b27414299089b8528b5bb07c (patch) | |
| tree | 9db23b8e6cdfb06d8bab77e83224e604f20c4629 /src/usb/utils.h | |
| parent | b25d62d1362cfd711e6617a9212e3eddc4e9fddd (diff) | |
| parent | c3912e01a2767334103cd139d875d50c834f3f05 (diff) | |
Merge pull request #35 from kienvo/usb
feat: Receive data over USB
Diffstat (limited to 'src/usb/utils.h')
| -rw-r--r-- | src/usb/utils.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/usb/utils.h b/src/usb/utils.h new file mode 100644 index 0000000..595a8b7 --- /dev/null +++ b/src/usb/utils.h @@ -0,0 +1,30 @@ +#ifndef __UTILS_H__ +#define __UTILS_H__ + +#include "CH58x_common.h" + +enum USB_RESPONSE_TYPE { + USB_ACK = 0, + USB_NO_RESP, + USB_NAK, + USB_STALL, +}; + +void cfg_desc_append(void *desc); +int ep_cb_register(int ep_num, void (*cb)()); +int if_cb_register(uint8_t if_num, void (*cb)(USB_SETUP_REQ *request)); +void dma_register(uint8_t endpoint_number, void *buf_addr); + +uint16_t +usb_start_load_block(void *ep_IN_buf, void *buf, uint16_t len, int tog); +void ctrl_start_load_block(void *buf, uint16_t len); +int usb_load_next_chunk(); +void usb_flush(); + +void set_handshake(uint8_t ep_num, int type, int tog, uint8_t len); +void ctrl_ack(); + +void clear_handshake_sent_flag(); +int handshake_sent(); + +#endif /* __UTILS_H__ */ |