aboutsummaryrefslogtreecommitdiffstats
path: root/core/usb/usb.c
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.c
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.c')
-rw-r--r--core/usb/usb.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/core/usb/usb.c b/core/usb/usb.c
index 2f458cc..8ef8697 100644
--- a/core/usb/usb.c
+++ b/core/usb/usb.c
@@ -31,12 +31,19 @@
*/
#include "usb.h"
+#include "libmaple.h"
+#include "usb_lib.h"
#include "gpio.h"
+#include "usb_hardware.h"
+
+#include "usb_config.h"
#include "usb_callbacks.h"
+#include "usb_lib.h"
/* persistent usb structs */
+
volatile uint32 bDeviceState = UNCONNECTED;
-volatile uint16 wIstr = 0;
+volatile uint16_t wIstr = 0;
volatile bIntPackSOF = 0;
DEVICE Device_Table =
@@ -55,31 +62,30 @@ DEVICE_PROP Device_Property =
usbNoDataSetup,
usbGetInterfaceSetting,
usbGetDeviceDescriptor,
- usbGetInterfaceDescriptor,
usbGetConfigDescriptor,
usbGetStringDescriptor,
- usbGetFunctionalDescriptor,
+ NOP_Process,
0,
bMaxPacketSize
};
USER_STANDARD_REQUESTS User_Standard_Requests =
{
- usbGetConfiguration,
+ NOP_Process,
usbSetConfiguration,
- usbGetInterface,
- usbSetInterface,
- usbGetStatus,
- usbClearFeature,
- usbSetEndpointFeature,
- usbSetDeviceFeature,
+ NOP_Process,
+ NOP_Process,
+ NOP_Process,
+ NOP_Process,
+ NOP_Process,
+ NOP_Process,
usbSetDeviceAddress
};
void (*pEpInt_IN[7])(void) =
{
- vcomManagementCb,
vcomDataTxCb,
+ vcomManagementCb,
NOP_Process,
NOP_Process,
NOP_Process,
@@ -138,7 +144,6 @@ void usbResumeInit(void) {
_SetCNTR(wCNTR);
/* undo power reduction handlers here */
-
_SetCNTR(ISR_MSK);
}
@@ -242,7 +247,7 @@ void usbDsbISR(void) {
}
/* overloaded ISR routine, this is the main usb ISR */
-void usb_lpIRQHandler(void);
+void usb_lpIRQHandler(void) {
wIstr = _GetISTR();
/* go nuts with the preproc switches since this is an ISTR and must be FAST */
@@ -327,5 +332,12 @@ if (wIstr & ISTR_CTR & wInterrupt_Mask)
CTR_LP(); /* low priority ISR defined in the usb core lib */
}
#endif
+}
+void usbSendHello(void) {
+ char* myStr = "HELLO!";
+ char myCh = 'a';
+ UserToPMABufferCopy((uint8*)myStr,VCOM_TX_ADDR,6);
+ _SetEPTxCount(VCOM_TX_ENDP,6);
+ _SetEPTxValid(VCOM_TX_ENDP);
}