openpcd/firmware/src/os/usb_handler.h @ master
1 |
#ifndef _USB_HANDLER_H
|
---|---|
2 |
#define _USB_HANDLER_H
|
3 |
|
4 |
#include "openpcd.h"
|
5 |
#include <os/req_ctx.h>
|
6 |
|
7 |
#define MAX_PAYLOAD_LEN (64 - sizeof(struct openpcd_hdr))
|
8 |
|
9 |
#define USB_RET_RESPOND (1 << 8)
|
10 |
#define USB_RET_ERR (2 << 8)
|
11 |
#define USB_ERR(x) (USB_RET_RESPOND|USB_RET_ERR|(x & 0xff))
|
12 |
|
13 |
enum usbapi_err { |
14 |
USB_ERR_NONE, |
15 |
USB_ERR_CMD_UNKNOWN, |
16 |
USB_ERR_CMD_NOT_IMPL, |
17 |
};
|
18 |
|
19 |
typedef int usb_cmd_fn(struct req_ctx *rctx); |
20 |
|
21 |
extern int usb_hdlr_register(usb_cmd_fn *hdlr, uint8_t class); |
22 |
extern void usb_hdlr_unregister(uint8_t class); |
23 |
|
24 |
extern void usb_in_process(void); |
25 |
extern void usb_out_process(void); |
26 |
|
27 |
#endif
|