summaryrefslogtreecommitdiff
path: root/firmware/src/os/usb_handler.h
blob: 52814fd0c55b54613b4a169b3278ee4ddbe40c7c (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
#ifndef _USB_HANDLER_H
#define _USB_HANDLER_H

#include "openpcd.h"
#include <os/req_ctx.h>

#define MAX_PAYLOAD_LEN	(64 - sizeof(struct openpcd_hdr))

#define USB_RET_RESPOND		(1 << 8)
#define USB_RET_ERR		(2 << 8)
#define USB_ERR(x)	(USB_RET_RESPOND|USB_RET_ERR|(x & 0xff))

enum usbapi_err {
	USB_ERR_NONE,
	USB_ERR_CMD_UNKNOWN,
	USB_ERR_CMD_NOT_IMPL,
};

typedef int usb_cmd_fn(struct req_ctx *rctx);

extern int usb_hdlr_register(usb_cmd_fn *hdlr, uint8_t class);
extern void usb_hdlr_unregister(uint8_t class);

extern void usb_in_process(void);
extern void usb_out_process(void);

#endif
personal git repositories of Harald Welte. Your mileage may vary