aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-02-06 13:51:08 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-02-06 13:51:08 +0000
commit100573d2c30750a50c3dfd9f3e7a051dcc987724 (patch)
tree39b8c04ed673e00350150dbfb2dbbb0f8f4f1ba9 /os
parent18853dba2210eadd2d919da2f17a9b5b553245fd (diff)
downloadChibiOS-100573d2c30750a50c3dfd9f3e7a051dcc987724.tar.gz
ChibiOS-100573d2c30750a50c3dfd9f3e7a051dcc987724.tar.bz2
ChibiOS-100573d2c30750a50c3dfd9f3e7a051dcc987724.zip
Serial over USB changes, work in progress, the USB demo is not buildable.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2717 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/include/serial_usb.h18
-rw-r--r--os/hal/src/serial_usb.c26
2 files changed, 24 insertions, 20 deletions
diff --git a/os/hal/include/serial_usb.h b/os/hal/include/serial_usb.h
index b75f6fe59..9223c82a3 100644
--- a/os/hal/include/serial_usb.h
+++ b/os/hal/include/serial_usb.h
@@ -114,10 +114,14 @@ typedef struct {
InputQueue iqueue; \
/* Output queue.*/ \
OutputQueue oqueue; \
- /* Input circular buffer.*/ \
- uint8_t ib[SERIAL_USB_BUFFERS_SIZE]; \
- /* Output circular buffer.*/ \
- uint8_t ob[SERIAL_USB_BUFFERS_SIZE]; \
+ /* Input buffer 1.*/ \
+ uint8_t ib1[SERIAL_USB_BUFFERS_SIZE]; \
+ /* Input buffer 2.*/ \
+ uint8_t ib2[SERIAL_USB_BUFFERS_SIZE]; \
+ /* Output buffer 1.*/ \
+ uint8_t ob1[SERIAL_USB_BUFFERS_SIZE]; \
+ /* Output buffer 2.*/ \
+ uint8_t ob2[SERIAL_USB_BUFFERS_SIZE]; \
/* End of the mandatory fields.*/ \
/* Current configuration data.*/ \
const SerialUSBConfig *config;
@@ -164,9 +168,9 @@ extern "C" {
void sduStart(SerialUSBDriver *sdup, const SerialUSBConfig *config);
void sduStop(SerialUSBDriver *sdup);
bool_t sduRequestsHook(USBDriver *usbp);
- void sduDataRequest(USBDriver *usbp, usbep_t ep);
- void sduDataAvailable(USBDriver *usbp, usbep_t ep);
- void sduInterruptRequest(USBDriver *usbp, usbep_t ep);
+ void sduDataTransmitted(USBDriver *usbp, usbep_t ep);
+ void sduDataReceived(USBDriver *usbp, usbep_t ep);
+ void sduInterruptTransmitted(USBDriver *usbp, usbep_t ep);
#ifdef __cplusplus
}
#endif
diff --git a/os/hal/src/serial_usb.c b/os/hal/src/serial_usb.c
index 62a901162..60976eca2 100644
--- a/os/hal/src/serial_usb.c
+++ b/os/hal/src/serial_usb.c
@@ -206,7 +206,7 @@ void sduStart(SerialUSBDriver *sdup, const SerialUSBConfig *config) {
"invalid state");
sdup->config = config;
usbStart(config->usbp, &config->usb_config);
- config->usbp->usb_param = sdup;
+ config->usbp->param = sdup;
sdup->state = SDU_READY;
chSysUnlock();
}
@@ -245,17 +245,17 @@ void sduStop(SerialUSBDriver *sdup) {
*/
bool_t sduRequestsHook(USBDriver *usbp) {
- if ((usbp->usb_setup[0] & USB_RTYPE_TYPE_MASK) == USB_RTYPE_TYPE_CLASS) {
- switch (usbp->usb_setup[1]) {
+ if ((usbp->setup[0] & USB_RTYPE_TYPE_MASK) == USB_RTYPE_TYPE_CLASS) {
+ switch (usbp->setup[1]) {
case CDC_GET_LINE_CODING:
- usbSetupTransfer(usbp, (uint8_t *)&linecoding, sizeof(linecoding), NULL);
+ usbSetupTransfer(usbp, (uint8_t *)&linecoding, sizeof(linecoding));
return TRUE;
case CDC_SET_LINE_CODING:
- usbSetupTransfer(usbp, (uint8_t *)&linecoding, sizeof(linecoding), NULL);
+ usbSetupTransfer(usbp, (uint8_t *)&linecoding, sizeof(linecoding));
return TRUE;
case CDC_SET_CONTROL_LINE_STATE:
/* Nothing to do, there are no control lines.*/
- usbSetupTransfer(usbp, NULL, 0, NULL);
+ usbSetupTransfer(usbp, NULL, 0);
return TRUE;
default:
return FALSE;
@@ -265,12 +265,12 @@ bool_t sduRequestsHook(USBDriver *usbp) {
}
/**
- * @brief Default data request callback.
+ * @brief Default data transmitted callback.
* @details The application must use this function as callback for the IN
* data endpoint.
*/
-void sduDataRequest(USBDriver *usbp, usbep_t ep) {
- SerialUSBDriver *sdup = usbp->usb_param;
+void sduDataTransmitted(USBDriver *usbp, usbep_t ep) {
+ SerialUSBDriver *sdup = usbp->param;
size_t n;
chSysLockFromIsr();
@@ -289,12 +289,12 @@ void sduDataRequest(USBDriver *usbp, usbep_t ep) {
}
/**
- * @brief Default data available callback.
+ * @brief Default data received callback.
* @details The application must use this function as callback for the OUT
* data endpoint.
*/
-void sduDataAvailable(USBDriver *usbp, usbep_t ep) {
- SerialUSBDriver *sdup = usbp->usb_param;
+void sduDataReceived(USBDriver *usbp, usbep_t ep) {
+ SerialUSBDriver *sdup = usbp->param;
chSysLockFromIsr();
/* Writes to the input queue can only happen when the queue has been
@@ -317,7 +317,7 @@ void sduDataAvailable(USBDriver *usbp, usbep_t ep) {
* @details The application must use this function as callback for the IN
* interrupt endpoint.
*/
-void sduInterruptRequest(USBDriver *usbp, usbep_t ep) {
+void sduInterruptTransmitted(USBDriver *usbp, usbep_t ep) {
(void)usbp;
(void)ep;