Improved dispatching of user control callbacks.

Only cdc_acm example is updated.
This commit is contained in:
Gareth McMullin
2010-11-06 12:21:46 +13:00
parent 5bba6d9206
commit 7f002110dc
4 changed files with 72 additions and 115 deletions

View File

@@ -21,6 +21,8 @@
#ifndef __USB_PRIVATE_H
#define __USB_PRIVATE_H
#define MAX_USER_CONTROL_CALLBACK 4
#define MIN(a, b) ((a)<(b) ? (a) : (b))
/** Internal collection of device information. */
@@ -42,14 +44,11 @@ extern struct _usbd_device {
void (*user_callback_suspend)(void);
void (*user_callback_resume)(void);
int (*user_callback_control_command)(struct usb_setup_data *req,
void (**complete)(struct usb_setup_data *req));
int (*user_callback_control_read)(struct usb_setup_data *req,
uint8_t **buf, uint16_t *len,
void (**complete)(struct usb_setup_data *req));
int (*user_callback_control_write)(struct usb_setup_data *req,
uint8_t *buf, uint16_t len,
void (**complete)(struct usb_setup_data *req));
struct user_control_callback {
usbd_control_callback cb;
uint8_t type;
uint8_t type_mask;
} user_control_callback[MAX_USER_CONTROL_CALLBACK];
void (*user_callback_ctr[8][3])(uint8_t ea);