ccid: Implement class-specific requests in core ccid_device.c layer
This has been tested succesfully with usb_f_fs for
GET_{CLOCK_FREQS,DATA_RATES}. The ABORT handling is currently just
a stub that needs to be completed once the state machine handling
for asynchronously dispatched requests becomes more clear.
Change-Id: I21d9d9f125ad4c0056d26c575faca5ecad689134
diff --git a/ccid/ccid_device.h b/ccid/ccid_device.h
index 7eba842..d9cba52 100644
--- a/ccid/ccid_device.h
+++ b/ccid/ccid_device.h
@@ -96,6 +96,12 @@
/* set of function pointers implementing specific operations */
const struct ccid_ops *ops;
const struct ccid_slot_ops *slot_ops;
+ /* USB CCID Class Specific Descriptor */
+ const struct usb_ccid_class_descriptor *class_desc;
+ /* array of permitted data rates; length: bNumDataRatesSupported */
+ const uint32_t *data_rates;
+ /* array of permitted clock frequencies; length: bNumClockSupported */
+ const uint32_t *clock_freqs;
const char *name;
/* user-supplied opaque data */
void *priv;
@@ -111,5 +117,17 @@
uint32_t data_len);
void ccid_instance_init(struct ccid_instance *ci, const struct ccid_ops *ops,
- const struct ccid_slot_ops *slot_ops, const char *name, void *priv);
+ const struct ccid_slot_ops *slot_ops,
+ const struct usb_ccid_class_descriptor *class_desc,
+ const uint32_t *data_rates, const uint32_t *clock_freqs,
+ const char *name, void *priv);
int ccid_handle_out(struct ccid_instance *ci, struct msgb *msg);
+
+/* Invalid request received: Please return STALL */
+#define CCID_CTRL_RET_INVALID -1
+/* Unknown request received: Not something CCID is supposed to handle */
+#define CCID_CTRL_RET_UNKNOWN 0
+/* Request OK. In case of a CTRL-IN: continue by sending wLength bytes to host */
+#define CCID_CTRL_RET_OK 1
+
+int ccid_handle_ctrl(struct ccid_instance *ci, const uint8_t *ctrl_req, const uint8_t **data_in);