1 /*----------------------------------------------------------------------------
3 *----------------------------------------------------------------------------
5 * Purpose: USB Custom User Module
7 *----------------------------------------------------------------------------
8 * This software is supplied "AS IS" without any warranties, express,
9 * implied or statutory, including but not limited to the implied
10 * warranties of fitness for purpose, satisfactory quality and
11 * noninfringement. Keil extends you a royalty-free right to reproduce
12 * and distribute executable files created using this software for use
13 * on NXP Semiconductors LPC family microcontroller devices only. Nothing
14 * else gives you the right to use this software.
16 * Copyright (c) 2009 Keil - An ARM Company. All rights reserved.
17 *---------------------------------------------------------------------------*/
20 #include "lpc_types.h"
32 * USB Power Event Callback
33 * Called automatically on USB Power Event
34 * Parameter: power: On(TRUE)/Off(FALSE)
38 void USB_Power_Event (uint32_t power) {
44 * USB Reset Event Callback
45 * Called automatically on USB Reset Event
49 void USB_Reset_Event (void) {
56 * USB Suspend Event Callback
57 * Called automatically on USB Suspend Event
61 void USB_Suspend_Event (void) {
67 * USB Resume Event Callback
68 * Called automatically on USB Resume Event
72 void USB_Resume_Event (void) {
78 * USB Remote Wakeup Event Callback
79 * Called automatically on USB Remote Wakeup Event
83 void USB_WakeUp_Event (void) {
89 * USB Start of Frame Event Callback
90 * Called automatically on USB Start of Frame Event
94 void USB_SOF_Event (void) {
100 * USB Error Event Callback
101 * Called automatically on USB Error Event
102 * Parameter: error: Error Code
106 void USB_Error_Event (uint32_t error) {
112 * USB Set Configuration Event Callback
113 * Called automatically on USB Set Configuration Request
116 #if USB_CONFIGURE_EVENT
117 void USB_Configure_Event (void) {
119 if (USB_Configuration) { /* Check if USB is configured */
120 /* add your code here */
127 * USB Set Interface Event Callback
128 * Called automatically on USB Set Interface Request
131 #if USB_INTERFACE_EVENT
132 void USB_Interface_Event (void) {
138 * USB Set/Clear Feature Event Callback
139 * Called automatically on USB Set/Clear Feature Request
142 #if USB_FEATURE_EVENT
143 void USB_Feature_Event (void) {
148 #define P_EP(n) ((USB_EP_EVENT & (1 << (n))) ? USB_EndPoint##n : NULL)
150 /* USB Endpoint Events Callback Pointers */
151 void (* const USB_P_EP[USB_EP_NUM]) (uint32_t event) = {
160 * USB Endpoint 1 Event Callback
161 * Called automatically on USB Endpoint 1 Event
165 void USB_EndPoint1 (uint32_t event) {
171 * USB Endpoint 2 Event Callback
172 * Called automatically on USB Endpoint 2 Event
176 void USB_EndPoint2 (uint32_t event) {
178 case USB_EVT_OUT_NAK:
182 CDC_BulkOut (); /* data received from Host */
185 CDC_BulkIn (); /* data expected from Host */
192 * USB Endpoint 3 Event Callback
193 * Called automatically on USB Endpoint 3 Event
197 void USB_EndPoint3 (uint32_t event) {
203 * USB Endpoint 4 Event Callback
204 * Called automatically on USB Endpoint 4 Event
208 void USB_EndPoint4 (uint32_t event) {
214 * USB Endpoint 5 Event Callback
215 * Called automatically on USB Endpoint 5 Event
219 void USB_EndPoint5 (uint32_t event) {