Fix USB, DOS line endings, integrate and reorganize project
[rapper.git] / new_cmsis / usb / user.c
similarity index 93%
rename from new_cmsis/usb/usbuser.c
rename to new_cmsis/usb/user.c
index 03ade78..3d3fe72 100755 (executable)
-/*----------------------------------------------------------------------------\r
- *      U S B  -  K e r n e l\r
- *----------------------------------------------------------------------------\r
- * Name:    usbuser.c\r
- * Purpose: USB Custom User Module\r
- * Version: V1.20\r
- *----------------------------------------------------------------------------\r
- *      This software is supplied "AS IS" without any warranties, express,\r
- *      implied or statutory, including but not limited to the implied\r
- *      warranties of fitness for purpose, satisfactory quality and\r
- *      noninfringement. Keil extends you a royalty-free right to reproduce\r
- *      and distribute executable files created using this software for use\r
- *      on NXP Semiconductors LPC family microcontroller devices only. Nothing\r
- *      else gives you the right to use this software.\r
- *\r
- * Copyright (c) 2009 Keil - An ARM Company. All rights reserved.\r
- *---------------------------------------------------------------------------*/\r
-#include "lpc_types.h"\r
-\r
-#include "usb.h"\r
-#include "usbcfg.h"\r
-#include "usbhw.h"\r
-#include "usbcore.h"\r
-#include "usbuser.h"\r
-#include "cdcuser.h"\r
-\r
-\r
-/*\r
- *  USB Power Event Callback\r
- *   Called automatically on USB Power Event\r
- *    Parameter:       power: On(TRUE)/Off(FALSE)\r
- */\r
-\r
-#if USB_POWER_EVENT\r
-void USB_Power_Event (uint32_t  power) {\r
-}\r
-#endif\r
-\r
-\r
-/*\r
- *  USB Reset Event Callback\r
- *   Called automatically on USB Reset Event\r
- */\r
-\r
-#if USB_RESET_EVENT\r
-void USB_Reset_Event (void) {\r
-  USB_ResetCore();\r
-}\r
-#endif\r
-\r
-\r
-/*\r
- *  USB Suspend Event Callback\r
- *   Called automatically on USB Suspend Event\r
- */\r
-\r
-#if USB_SUSPEND_EVENT\r
-void USB_Suspend_Event (void) {\r
-}\r
-#endif\r
-\r
-\r
-/*\r
- *  USB Resume Event Callback\r
- *   Called automatically on USB Resume Event\r
- */\r
-\r
-#if USB_RESUME_EVENT\r
-void USB_Resume_Event (void) {\r
-}\r
-#endif\r
-\r
-\r
-/*\r
- *  USB Remote Wakeup Event Callback\r
- *   Called automatically on USB Remote Wakeup Event\r
- */\r
-\r
-#if USB_WAKEUP_EVENT\r
-void USB_WakeUp_Event (void) {\r
-}\r
-#endif\r
-\r
-\r
-/*\r
- *  USB Start of Frame Event Callback\r
- *   Called automatically on USB Start of Frame Event\r
- */\r
-\r
-#if USB_SOF_EVENT\r
-void USB_SOF_Event (void) {\r
-}\r
-#endif\r
-\r
-\r
-/*\r
- *  USB Error Event Callback\r
- *   Called automatically on USB Error Event\r
- *    Parameter:       error: Error Code\r
- */\r
-\r
-#if USB_ERROR_EVENT\r
-void USB_Error_Event (uint32_t error) {\r
-}\r
-#endif\r
-\r
-\r
-/*\r
- *  USB Set Configuration Event Callback\r
- *   Called automatically on USB Set Configuration Request\r
- */\r
-\r
-#if USB_CONFIGURE_EVENT\r
-void USB_Configure_Event (void) {\r
-\r
-  if (USB_Configuration) {                  /* Check if USB is configured */\r
-    /* add your code here */\r
-  }\r
-}\r
-#endif\r
-\r
-\r
-/*\r
- *  USB Set Interface Event Callback\r
- *   Called automatically on USB Set Interface Request\r
- */\r
-\r
-#if USB_INTERFACE_EVENT\r
-void USB_Interface_Event (void) {\r
-}\r
-#endif\r
-\r
-\r
-/*\r
- *  USB Set/Clear Feature Event Callback\r
- *   Called automatically on USB Set/Clear Feature Request\r
- */\r
-\r
-#if USB_FEATURE_EVENT\r
-void USB_Feature_Event (void) {\r
-}\r
-#endif\r
-\r
-\r
-#define P_EP(n) ((USB_EP_EVENT & (1 << (n))) ? USB_EndPoint##n : NULL)\r
-\r
-/* USB Endpoint Events Callback Pointers */\r
-void (* const USB_P_EP[16]) (uint32_t event) = {\r
-  P_EP(0),\r
-  P_EP(1),\r
-  P_EP(2),\r
-  P_EP(3),\r
-  P_EP(4),\r
-  P_EP(5),\r
-  P_EP(6),\r
-  P_EP(7),\r
-  P_EP(8),\r
-  P_EP(9),\r
-  P_EP(10),\r
-  P_EP(11),\r
-  P_EP(12),\r
-  P_EP(13),\r
-  P_EP(14),\r
-  P_EP(15),\r
-};\r
-\r
-\r
-/*\r
- *  USB Endpoint 1 Event Callback\r
- *   Called automatically on USB Endpoint 1 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint1 (uint32_t event) {\r
-  uint16_t temp;\r
-  static uint16_t serialState;\r
-\r
-  switch (event) {\r
-    case USB_EVT_IN:\r
-      temp = CDC_GetSerialState();\r
-      if (serialState != temp) {\r
-         serialState = temp;\r
-         CDC_NotificationIn();            /* send SERIAL_STATE notification */\r
-      }\r
-      break;\r
-  }\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 2 Event Callback\r
- *   Called automatically on USB Endpoint 2 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint2 (uint32_t event) {\r
-\r
-  switch (event) {\r
-    case USB_EVT_OUT:\r
-      CDC_BulkOut ();                /* data received from Host */\r
-      break;\r
-    case USB_EVT_IN:\r
-      CDC_BulkIn ();                 /* data expected from Host */\r
-      break;\r
-  }\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 3 Event Callback\r
- *   Called automatically on USB Endpoint 3 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint3 (uint32_t event) {\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 4 Event Callback\r
- *   Called automatically on USB Endpoint 4 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint4 (uint32_t event) {\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 5 Event Callback\r
- *   Called automatically on USB Endpoint 5 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint5 (uint32_t event) {\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 6 Event Callback\r
- *   Called automatically on USB Endpoint 6 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint6 (uint32_t event) {\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 7 Event Callback\r
- *   Called automatically on USB Endpoint 7 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint7 (uint32_t event) {\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 8 Event Callback\r
- *   Called automatically on USB Endpoint 8 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint8 (uint32_t event) {\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 9 Event Callback\r
- *   Called automatically on USB Endpoint 9 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint9 (uint32_t event) {\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 10 Event Callback\r
- *   Called automatically on USB Endpoint 10 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint10 (uint32_t event) {\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 11 Event Callback\r
- *   Called automatically on USB Endpoint 11 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint11 (uint32_t event) {\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 12 Event Callback\r
- *   Called automatically on USB Endpoint 12 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint12 (uint32_t event) {\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 13 Event Callback\r
- *   Called automatically on USB Endpoint 13 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint13 (uint32_t event) {\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 14 Event Callback\r
- *   Called automatically on USB Endpoint 14 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint14 (uint32_t event) {\r
-}\r
-\r
-\r
-/*\r
- *  USB Endpoint 15 Event Callback\r
- *   Called automatically on USB Endpoint 15 Event\r
- *    Parameter:       event\r
- */\r
-\r
-void USB_EndPoint15 (uint32_t event) {\r
-}\r
+/*----------------------------------------------------------------------------
+ *      U S B  -  K e r n e l
+ *----------------------------------------------------------------------------
+ * Name:    usbuser.c
+ * Purpose: USB Custom User Module
+ * Version: V1.20
+ *----------------------------------------------------------------------------
+ *      This software is supplied "AS IS" without any warranties, express,
+ *      implied or statutory, including but not limited to the implied
+ *      warranties of fitness for purpose, satisfactory quality and
+ *      noninfringement. Keil extends you a royalty-free right to reproduce
+ *      and distribute executable files created using this software for use
+ *      on NXP Semiconductors LPC family microcontroller devices only. Nothing
+ *      else gives you the right to use this software.
+ *
+ * Copyright (c) 2009 Keil - An ARM Company. All rights reserved.
+ *---------------------------------------------------------------------------*/
+#include "lpc_types.h"
+
+#include "usb.h"
+#include "cfg.h"
+#include "hw.h"
+#include "core.h"
+#include "user.h"
+#include "cdcuser.h"
+
+
+/*
+ *  USB Power Event Callback
+ *   Called automatically on USB Power Event
+ *    Parameter:       power: On(TRUE)/Off(FALSE)
+ */
+
+#if USB_POWER_EVENT
+void USB_Power_Event (uint32_t  power) {
+}
+#endif
+
+
+/*
+ *  USB Reset Event Callback
+ *   Called automatically on USB Reset Event
+ */
+
+#if USB_RESET_EVENT
+void USB_Reset_Event (void) {
+  USB_ResetCore();
+}
+#endif
+
+
+/*
+ *  USB Suspend Event Callback
+ *   Called automatically on USB Suspend Event
+ */
+
+#if USB_SUSPEND_EVENT
+void USB_Suspend_Event (void) {
+}
+#endif
+
+
+/*
+ *  USB Resume Event Callback
+ *   Called automatically on USB Resume Event
+ */
+
+#if USB_RESUME_EVENT
+void USB_Resume_Event (void) {
+}
+#endif
+
+
+/*
+ *  USB Remote Wakeup Event Callback
+ *   Called automatically on USB Remote Wakeup Event
+ */
+
+#if USB_WAKEUP_EVENT
+void USB_WakeUp_Event (void) {
+}
+#endif
+
+
+/*
+ *  USB Start of Frame Event Callback
+ *   Called automatically on USB Start of Frame Event
+ */
+
+#if USB_SOF_EVENT
+void USB_SOF_Event (void) {
+}
+#endif
+
+
+/*
+ *  USB Error Event Callback
+ *   Called automatically on USB Error Event
+ *    Parameter:       error: Error Code
+ */
+
+#if USB_ERROR_EVENT
+void USB_Error_Event (uint32_t error) {
+}
+#endif
+
+
+/*
+ *  USB Set Configuration Event Callback
+ *   Called automatically on USB Set Configuration Request
+ */
+
+#if USB_CONFIGURE_EVENT
+void USB_Configure_Event (void) {
+
+  if (USB_Configuration) {                  /* Check if USB is configured */
+    /* add your code here */
+  }
+}
+#endif
+
+
+/*
+ *  USB Set Interface Event Callback
+ *   Called automatically on USB Set Interface Request
+ */
+
+#if USB_INTERFACE_EVENT
+void USB_Interface_Event (void) {
+}
+#endif
+
+
+/*
+ *  USB Set/Clear Feature Event Callback
+ *   Called automatically on USB Set/Clear Feature Request
+ */
+
+#if USB_FEATURE_EVENT
+void USB_Feature_Event (void) {
+}
+#endif
+
+
+#define P_EP(n) ((USB_EP_EVENT & (1 << (n))) ? USB_EndPoint##n : NULL)
+
+/* USB Endpoint Events Callback Pointers */
+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),
+};
+
+
+/*
+ *  USB Endpoint 1 Event Callback
+ *   Called automatically on USB Endpoint 1 Event
+ *    Parameter:       event
+ */
+
+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();            /* send SERIAL_STATE notification */
+      }
+      break;
+  }
+}
+
+
+/*
+ *  USB Endpoint 2 Event Callback
+ *   Called automatically on USB Endpoint 2 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint2 (uint32_t event) {
+
+  switch (event) {
+    case USB_EVT_OUT:
+      CDC_BulkOut ();                /* data received from Host */
+      break;
+    case USB_EVT_IN:
+      CDC_BulkIn ();                 /* data expected from Host */
+      break;
+  }
+}
+
+
+/*
+ *  USB Endpoint 3 Event Callback
+ *   Called automatically on USB Endpoint 3 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint3 (uint32_t event) {
+}
+
+
+/*
+ *  USB Endpoint 4 Event Callback
+ *   Called automatically on USB Endpoint 4 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint4 (uint32_t event) {
+}
+
+
+/*
+ *  USB Endpoint 5 Event Callback
+ *   Called automatically on USB Endpoint 5 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint5 (uint32_t event) {
+}
+
+
+/*
+ *  USB Endpoint 6 Event Callback
+ *   Called automatically on USB Endpoint 6 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint6 (uint32_t event) {
+}
+
+
+/*
+ *  USB Endpoint 7 Event Callback
+ *   Called automatically on USB Endpoint 7 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint7 (uint32_t event) {
+}
+
+
+/*
+ *  USB Endpoint 8 Event Callback
+ *   Called automatically on USB Endpoint 8 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint8 (uint32_t event) {
+}
+
+
+/*
+ *  USB Endpoint 9 Event Callback
+ *   Called automatically on USB Endpoint 9 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint9 (uint32_t event) {
+}
+
+
+/*
+ *  USB Endpoint 10 Event Callback
+ *   Called automatically on USB Endpoint 10 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint10 (uint32_t event) {
+}
+
+
+/*
+ *  USB Endpoint 11 Event Callback
+ *   Called automatically on USB Endpoint 11 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint11 (uint32_t event) {
+}
+
+
+/*
+ *  USB Endpoint 12 Event Callback
+ *   Called automatically on USB Endpoint 12 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint12 (uint32_t event) {
+}
+
+
+/*
+ *  USB Endpoint 13 Event Callback
+ *   Called automatically on USB Endpoint 13 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint13 (uint32_t event) {
+}
+
+
+/*
+ *  USB Endpoint 14 Event Callback
+ *   Called automatically on USB Endpoint 14 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint14 (uint32_t event) {
+}
+
+
+/*
+ *  USB Endpoint 15 Event Callback
+ *   Called automatically on USB Endpoint 15 Event
+ *    Parameter:       event
+ */
+
+void USB_EndPoint15 (uint32_t event) {
+}