aboutsummaryrefslogtreecommitdiffstats
path: root/core/usb
diff options
context:
space:
mode:
authorAJM <poslathian@poslathian.(none)>2010-04-20 16:48:29 -0400
committerbnewbold <bnewbold@robocracy.org>2010-05-20 22:09:15 -0400
commita082defb795cc4495139c8b05de4fd48bd66dacd (patch)
tree7e789a503aae8697b929ee409dd46aae15de27e5 /core/usb
parentbfb86b6c2ac84c691c150e20adcc1b77d57efd10 (diff)
downloadlibrambutan-a082defb795cc4495139c8b05de4fd48bd66dacd.tar.gz
librambutan-a082defb795cc4495139c8b05de4fd48bd66dacd.zip
added virtual com port echoing as the test configuration for the usb serial code
Diffstat (limited to 'core/usb')
-rw-r--r--core/usb/usb_callbacks.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/core/usb/usb_callbacks.c b/core/usb/usb_callbacks.c
index a3febed..3e881ae 100644
--- a/core/usb/usb_callbacks.c
+++ b/core/usb/usb_callbacks.c
@@ -29,12 +29,26 @@ USB_Line_Coding line_coding = {
datatype: 0x08
};
+uint8 vcomBufferTx[VCOM_TX_SIZE];
+uint8 vcomBufferRx[VCOM_RX_SIZE];
+uint8 countTx = 0;
+uint8 countRx = 0;
+
void vcomDataTxCb(void) {
/* do whatever after data has been sent to host */
+ countTx = 0;
}
void vcomDataRxCb(void) {
/* do whatever after data has been received from host */
+ countRx = GetEPRxCount(VCOM_RX_ENDP);
+ PMAToUserBufferCopy(vcomBufferRx,VCOM_RX_ADDR,countRx);
+ SetEPRxValid(VCOM_RX_ENDP);
+
+ countTx = countRx;
+ UserToPMABufferCopy(vcomBufferRx,VCOM_TX_ADDR,countTx);
+ SetEPTxCount(VCOM_TX_ENDP,countTx);
+ SetEPTxValid(VCOM_TX_ENDP);
}
void vcomManagementCb(void) {
@@ -49,7 +63,8 @@ u8* vcomGetSetLineCoding(uint16 length) {
return (uint8*)&line_coding;
}
-void vcomSetLineSate(uint16 wValue);
+void vcomSetLineSate(uint16 wValue) {
+}
void usbInit(void) {
pInformation->Current_Configuration = 0;
@@ -151,6 +166,7 @@ RESULT usbNoDataSetup(u8 request) {
return USB_SUCCESS;
case (SET_CONTROL_LINE_STATE):
/* handle the control line status signal (reset?) */
+ vcomSetLineState();
return USB_SUCCESS;
}
}