aboutsummaryrefslogtreecommitdiff
path: root/src/usb/utils.h
blob: 595a8b7a75d79b2e92c8a7d8cf13f4097a819cd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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__ */