aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--example-cdc/usb-cdc.c4
-rw-r--r--example-fs-bb48/usb-cdc.c31
-rw-r--r--mcu/usb-mkl27z.c12
-rw-r--r--mcu/usb-stm32f103.c14
-rw-r--r--usb_lld.h2
6 files changed, 42 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index f0c7d5c..f6b4690 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-06-10 NIIBE Yutaka <gniibe@fsij.org>
+
+ * usb_lld.h (USB_EVENT_OK): Rename.
+ * mcu/usb-stm32f103.c: Update.
+ * mcu/usb-mkl27z.c: Likewise.
+
+ * example-cdc/usb-cdc.c: Follow the change of API.
+ * example-fs-bb48/usb-cdc.c: Likewise.
+
2016-06-09 NIIBE Yutaka <gniibe@fsij.org>
* mcu/usb-stm32f103.c (usb_lld_ctrl_recv): Rename.
diff --git a/example-cdc/usb-cdc.c b/example-cdc/usb-cdc.c
index 5ff2a30..5614425 100644
--- a/example-cdc/usb-cdc.c
+++ b/example-cdc/usb-cdc.c
@@ -739,7 +739,7 @@ tty_main (void *arg)
/* The addres is assigned to the device. We don't
* need to do anything for this actually, but in this
* application, we maintain the USB status of the
- * device. Usually, just "continue" as EVENT_NONE is
+ * device. Usually, just "continue" as EVENT_OK is
* OK.
*/
chopstx_mutex_lock (&tty0.mtx);
@@ -791,7 +791,7 @@ tty_main (void *arg)
usb_ctrl_write_finish (&dev);
continue;
- case USB_EVENT_NONE:
+ case USB_EVENT_OK:
case USB_EVENT_DEVICE_SUSPEND:
default:
continue;
diff --git a/example-fs-bb48/usb-cdc.c b/example-fs-bb48/usb-cdc.c
index 8e5fd9e..0936a40 100644
--- a/example-fs-bb48/usb-cdc.c
+++ b/example-fs-bb48/usb-cdc.c
@@ -722,24 +722,24 @@ tty_main (void *arg)
usb_device_reset (&dev);
continue;
- case USB_EVENT_GET_DESCRIPTOR:
- if (usb_get_descriptor (&dev) < 0)
- usb_lld_ctrl_error (&dev);
- continue;
-
+ case USB_EVENT_DEVICE_ADDRESSED:
/* The addres is assigned to the device. We don't
* need to do anything for this actually, but in this
* application, we maintain the USB status of the
- * device. Usually, just "continue" as EVENT_NONE is
+ * device. Usually, just "continue" as EVENT_OK is
* OK.
*/
- case USB_EVENT_DEVICE_ADDRESSED:
chopstx_mutex_lock (&tty0.mtx);
tty0.device_state = ADDRESSED;
chopstx_cond_signal (&tty0.cnd);
chopstx_mutex_unlock (&tty0.mtx);
continue;
+ case USB_EVENT_GET_DESCRIPTOR:
+ if (usb_get_descriptor (&dev) < 0)
+ usb_lld_ctrl_error (&dev);
+ continue;
+
case USB_EVENT_SET_CONFIGURATION:
if (usb_set_configuration (&dev) < 0)
usb_lld_ctrl_error (&dev);
@@ -750,17 +750,12 @@ tty_main (void *arg)
usb_lld_ctrl_error (&dev);
continue;
- /* Non standard device request. */
case USB_EVENT_CTRL_REQUEST:
+ /* Device specific device request. */
if (usb_setup (&dev) < 0)
usb_lld_ctrl_error (&dev);
continue;
- /* Control WRITE transfer finished. */
- case USB_EVENT_CTRL_WRITE_FINISH:
- usb_ctrl_write_finish (&dev);
- continue;
-
case USB_EVENT_GET_STATUS_INTERFACE:
if (usb_get_status_interface (&dev) < 0)
usb_lld_ctrl_error (&dev);
@@ -771,11 +766,19 @@ tty_main (void *arg)
usb_lld_ctrl_error (&dev);
continue;
- case USB_EVENT_NONE:
case USB_EVENT_SET_FEATURE_DEVICE:
case USB_EVENT_SET_FEATURE_ENDPOINT:
case USB_EVENT_CLEAR_FEATURE_DEVICE:
case USB_EVENT_CLEAR_FEATURE_ENDPOINT:
+ usb_lld_ctrl_ack (&dev);
+ continue;
+
+ case USB_EVENT_CTRL_WRITE_FINISH:
+ /* Control WRITE transfer finished. */
+ usb_ctrl_write_finish (&dev);
+ continue;
+
+ case USB_EVENT_OK:
case USB_EVENT_DEVICE_SUSPEND:
default:
continue;
diff --git a/mcu/usb-mkl27z.c b/mcu/usb-mkl27z.c
index 0b9b049..ae7e8af 100644
--- a/mcu/usb-mkl27z.c
+++ b/mcu/usb-mkl27z.c
@@ -332,7 +332,7 @@ usb_lld_ctrl_ack (struct usb_dev *dev)
/* Zero length packet for ACK. */
dev->state = WAIT_STATUS_IN;
kl27z_prepare_ep0_in (&dev->dev_req, 0, DATA1);
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
@@ -392,7 +392,7 @@ usb_lld_event_handler (struct usb_dev *dev)
USB_CTRL1->ISTAT = USB_IS_STALL;
}
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
@@ -736,7 +736,7 @@ handle_setup0 (struct usb_dev *dev)
if ((r = (*handler) (dev)) < 0)
{
usb_lld_ctrl_error (dev);
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
else
return r;
@@ -829,7 +829,7 @@ handle_transaction (struct usb_dev *dev, uint8_t stat)
{
handle_out0 (dev, stat);
USB_CTRL1->ISTAT = USB_IS_TOKDNE;
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
}
else
@@ -963,7 +963,7 @@ usb_lld_ctrl_recv (struct usb_dev *dev, void *p, size_t len)
kl27z_prepare_ep0_out (p, len, DATA1);
dev->state = OUT_DATA;
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
/*
@@ -1006,7 +1006,7 @@ usb_lld_ctrl_send (struct usb_dev *dev, const void *buf, size_t buflen)
data_p->len -= len;
data_p->addr += len;
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
void
diff --git a/mcu/usb-stm32f103.c b/mcu/usb-stm32f103.c
index 9091d8d..347539f 100644
--- a/mcu/usb-stm32f103.c
+++ b/mcu/usb-stm32f103.c
@@ -359,7 +359,7 @@ usb_lld_ctrl_ack (struct usb_dev *dev)
dev->state = WAIT_STATUS_IN;
st103_set_tx_count (ENDP0, 0);
st103_ep_set_rxtx_status (ENDP0, EP_RX_NAK, EP_TX_VALID);
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
void usb_lld_init (struct usb_dev *dev, uint8_t feature)
@@ -416,7 +416,7 @@ usb_lld_event_handler (struct usb_dev *dev)
return usb_handle_transfer (dev, istr_value);
}
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
static void handle_datastage_out (struct usb_dev *dev)
@@ -797,7 +797,7 @@ static int handle_setup0 (struct usb_dev *dev)
if ((r = (*handler) (dev)) < 0)
{
usb_lld_ctrl_error (dev);
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
else
return r;
@@ -885,7 +885,7 @@ usb_handle_transfer (struct usb_dev *dev, uint16_t istr_value)
else
{
handle_out0 (dev);
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
}
}
@@ -908,7 +908,7 @@ usb_handle_transfer (struct usb_dev *dev, uint16_t istr_value)
}
}
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
void usb_lld_reset (struct usb_dev *dev, uint8_t feature)
@@ -1016,7 +1016,7 @@ int usb_lld_ctrl_recv (struct usb_dev *dev, void *p, size_t len)
struct ctrl_data *data_p = &dev->ctrl_data;
data_p->addr = p;
data_p->len = len;
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
void usb_lld_to_pmabuf (const void *src, uint16_t addr, size_t n)
@@ -1136,5 +1136,5 @@ usb_lld_ctrl_send (struct usb_dev *dev, const void *buf, size_t buflen)
st103_set_tx_count (ENDP0, len);
st103_ep_set_rxtx_status (ENDP0, EP_RX_NAK, EP_TX_VALID);
- return USB_EVENT_NONE;
+ return USB_EVENT_OK;
}
diff --git a/usb_lld.h b/usb_lld.h
index cb51ee8..2451ce4 100644
--- a/usb_lld.h
+++ b/usb_lld.h
@@ -60,7 +60,7 @@ struct usb_dev {
};
enum {
- USB_EVENT_NONE=0, /* Processed in lower layer. */
+ USB_EVENT_OK=0, /* Processed in lower layer. */
/* Device reset and suspend. */
USB_EVENT_DEVICE_RESET,
USB_EVENT_DEVICE_SUSPEND,