aboutsummaryrefslogtreecommitdiffstats
path: root/core/usb/usb_callbacks.h
diff options
context:
space:
mode:
authorAJM <poslathian@poslathian.(none)>2010-04-22 23:27:09 -0400
committerbnewbold <bnewbold@robocracy.org>2010-05-20 22:09:15 -0400
commita86ec7c81d7ad2037e900899a0b32c5592cae7c0 (patch)
tree391e3abb0ce95ec6901399bdce628aadf8a0c339 /core/usb/usb_callbacks.h
parenta082defb795cc4495139c8b05de4fd48bd66dacd (diff)
downloadlibrambutan-a86ec7c81d7ad2037e900899a0b32c5592cae7c0.tar.gz
librambutan-a86ec7c81d7ad2037e900899a0b32c5592cae7c0.zip
c++ ified all of the usb_core files, added the auto-reset feature to the virtual com port, got the descriptors in functional although not pretty order that can be fixed using the attribute packing
Diffstat (limited to 'core/usb/usb_callbacks.h')
-rw-r--r--core/usb/usb_callbacks.h53
1 files changed, 35 insertions, 18 deletions
diff --git a/core/usb/usb_callbacks.h b/core/usb/usb_callbacks.h
index 4fe287f..53857ae 100644
--- a/core/usb/usb_callbacks.h
+++ b/core/usb/usb_callbacks.h
@@ -1,8 +1,21 @@
+/* insert license */
+
+#ifndef __USB_CALLBACKS
+#define __USB_CALLBACKS
+
+#include "libmaple.h"
+#include "usb_lib.h"
+
#define SET_LINE_CODING 0x20
#define GET_LINE_CODING 0x21
+#define SET_COMM_FEATURE 0x02
#define SET_CONTROL_LINE_STATE 0x22
-#define CONTROL_LINE_DTR (1 << 0)
-#define CONTROL_LINE_RTS (1 << 1)
+#define CONTROL_LINE_DTR (0x01)
+#define CONTROL_LINE_RTS (0x02)
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
typedef struct {
uint32 bitrate;
@@ -11,12 +24,18 @@ typedef struct {
uint8 datatype;
} USB_Line_Coding;
+typedef enum {
+ START,
+ NDTR_NRTS,
+ DTR_NRTS
+} RESET_STATE;
+
void vcomDataTxCb(void);
void vcomDataRxCb(void);
void vcomManagementCb(void);
-u8* vcomGetSetLineCoding(uint16 length);
-void vcomSetLineSate(uint16 wValue);
+uint8* vcomGetSetLineCoding(uint16 length);
+void vcomSetLineSate(void);
void usbInit(void);
/* internal functions (as per the usb_core pProperty structure) */
@@ -25,23 +44,21 @@ void usbReset(void);
void usbStatusIn(void);
void usbStatusOut(void);
-RESULT usbDataSetup(u8 request);
-RESULT usbNoDataSetup(u8 request);
-RESULT usbGetInterfaceSetting(u8,u8);
+RESULT usbDataSetup(uint8 request);
+RESULT usbNoDataSetup(uint8 request);
+RESULT usbGetInterfaceSetting(uint8,uint8);
-u8* usbGetDeviceDescriptor(u16 length);
-u8* usbGetConfigDescriptor(u16 length);
-u8* usbGetStringDescriptor(u16 length);
-u8* usbGetFunctionalDescriptor(u16 length);
+uint8* usbGetDeviceDescriptor(uint16 length);
+uint8* usbGetConfigDescriptor(uint16 length);
+uint8* usbGetStringDescriptor(uint16 length);
/* internal callbacks to respond to standard requests */
-void usbGetConfiguration(void);
void usbSetConfiguration(void);
-void usbGetInterface(void);
-void usbSetInterface(void);
-void usbGetStatus(void);
-void usbClearFeature(void);
-void usbSetEndpointFeature(void);
-void usbSetDeviceFeature(void);
void usbSetDeviceAddress(void);
+#if defined(__cplusplus)
+}
+#endif
+
+
+#endif