summaryrefslogtreecommitdiff
path: root/firmware/src/os/usb_handler.h
blob: 9d5ad4803d3f4431cbbe758b39b5efe434135c4d (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, u_int8_t class);
extern void usb_hdlr_unregister(u_int8_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