123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
-
-
- extern "C" {
- #include "lpc_types.h"
- #include <debug_frmwrk.h>
- }
-
- #include "usb.h"
- #include "usbcfg.h"
- #include "usbhw.h"
- #include "usbcore.h"
- #include "usbuser.h"
- #include "cdcuser.h"
- #include "mscuser.h"
-
-
-
-
- #if USB_POWER_EVENT
- void USB_Power_Event (uint32_t power) {
- }
- #endif
-
-
-
-
- #if USB_RESET_EVENT
- void USB_Reset_Event (void) {
- USB_ResetCore();
- }
- #endif
-
-
-
-
- #if USB_SUSPEND_EVENT
- void USB_Suspend_Event (void) {
- }
- #endif
-
-
-
-
- #if USB_RESUME_EVENT
- void USB_Resume_Event (void) {
- }
- #endif
-
-
-
-
- #if USB_WAKEUP_EVENT
- void USB_WakeUp_Event (void) {
- }
- #endif
-
-
-
-
- #if USB_SOF_EVENT
- void USB_SOF_Event (void) {
- }
- #endif
-
-
-
-
- #if USB_ERROR_EVENT
- void USB_Error_Event (uint32_t error) {
- }
- #endif
-
-
-
-
- #if USB_CONFIGURE_EVENT
- void USB_Configure_Event (void) {
-
- if (USB_Configuration) {
-
- }
- }
- #endif
-
-
-
-
- #if USB_INTERFACE_EVENT
- void USB_Interface_Event (void) {
- }
- #endif
-
-
-
-
- #if USB_FEATURE_EVENT
- void USB_Feature_Event (void) {
- }
- #endif
-
-
- #define P_EP(n) ((USB_EP_EVENT & (1 << (n))) ? USB_EndPoint##n : nullptr)
-
-
- void (* const USB_P_EP[16]) (uint32_t event) = {
- P_EP(0),
- P_EP(1),
- P_EP(2),
- P_EP(3),
- P_EP(4),
- P_EP(5),
- P_EP(6),
- P_EP(7),
- P_EP(8),
- P_EP(9),
- P_EP(10),
- P_EP(11),
- P_EP(12),
- P_EP(13),
- P_EP(14),
- P_EP(15),
- };
-
-
-
-
- void USB_EndPoint1 (uint32_t event) {
- uint16_t temp;
- static uint16_t serialState;
-
- switch (event) {
- case USB_EVT_IN:
- temp = CDC_GetSerialState();
- if (serialState != temp) {
- serialState = temp;
- CDC_NotificationIn();
- }
- break;
- default:
- _DBG("Unhandled EP1 event: ");
- _DBH(event);
- _DBG("\n");
- }
- }
-
-
-
-
- void USB_EndPoint2 (uint32_t event) {
-
- switch (event) {
- case USB_EVT_OUT:
- CDC_BulkOut ();
- break;
- case USB_EVT_IN:
- CDC_BulkIn ();
- break;
- }
- }
-
-
-
-
- void USB_EndPoint3 (uint32_t event) {
- }
-
-
-
-
- void USB_EndPoint4 (uint32_t event) {
- }
-
-
-
-
- void USB_EndPoint5 (uint32_t event) {
- switch (event) {
- case USB_EVT_OUT:
- MSC_BulkOut();
- break;
- case USB_EVT_IN:
- MSC_BulkIn();
- break;
- }
- }
-
-
-
-
- void USB_EndPoint6 (uint32_t event) {
- }
-
-
-
-
- void USB_EndPoint7 (uint32_t event) {
- }
-
-
-
-
- void USB_EndPoint8 (uint32_t event) {
- }
-
-
-
-
- void USB_EndPoint9 (uint32_t event) {
- }
-
-
-
-
- void USB_EndPoint10 (uint32_t event) {
- }
-
-
-
-
- void USB_EndPoint11 (uint32_t event) {
- }
-
-
-
-
- void USB_EndPoint12 (uint32_t event) {
- }
-
-
-
-
- void USB_EndPoint13 (uint32_t event) {
- }
-
-
-
-
- void USB_EndPoint14 (uint32_t event) {
- }
-
-
-
-
- void USB_EndPoint15 (uint32_t event) {
- }
|