NONE sounds bad, use OK instead
This commit is contained in:
@@ -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>
|
2016-06-09 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
* mcu/usb-stm32f103.c (usb_lld_ctrl_recv): Rename.
|
* mcu/usb-stm32f103.c (usb_lld_ctrl_recv): Rename.
|
||||||
|
|||||||
@@ -739,7 +739,7 @@ tty_main (void *arg)
|
|||||||
/* The addres is assigned to the device. We don't
|
/* The addres is assigned to the device. We don't
|
||||||
* need to do anything for this actually, but in this
|
* need to do anything for this actually, but in this
|
||||||
* application, we maintain the USB status of the
|
* 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.
|
* OK.
|
||||||
*/
|
*/
|
||||||
chopstx_mutex_lock (&tty0.mtx);
|
chopstx_mutex_lock (&tty0.mtx);
|
||||||
@@ -791,7 +791,7 @@ tty_main (void *arg)
|
|||||||
usb_ctrl_write_finish (&dev);
|
usb_ctrl_write_finish (&dev);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case USB_EVENT_NONE:
|
case USB_EVENT_OK:
|
||||||
case USB_EVENT_DEVICE_SUSPEND:
|
case USB_EVENT_DEVICE_SUSPEND:
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -722,24 +722,24 @@ tty_main (void *arg)
|
|||||||
usb_device_reset (&dev);
|
usb_device_reset (&dev);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case USB_EVENT_GET_DESCRIPTOR:
|
case USB_EVENT_DEVICE_ADDRESSED:
|
||||||
if (usb_get_descriptor (&dev) < 0)
|
|
||||||
usb_lld_ctrl_error (&dev);
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* The addres is assigned to the device. We don't
|
/* The addres is assigned to the device. We don't
|
||||||
* need to do anything for this actually, but in this
|
* need to do anything for this actually, but in this
|
||||||
* application, we maintain the USB status of the
|
* 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.
|
* OK.
|
||||||
*/
|
*/
|
||||||
case USB_EVENT_DEVICE_ADDRESSED:
|
|
||||||
chopstx_mutex_lock (&tty0.mtx);
|
chopstx_mutex_lock (&tty0.mtx);
|
||||||
tty0.device_state = ADDRESSED;
|
tty0.device_state = ADDRESSED;
|
||||||
chopstx_cond_signal (&tty0.cnd);
|
chopstx_cond_signal (&tty0.cnd);
|
||||||
chopstx_mutex_unlock (&tty0.mtx);
|
chopstx_mutex_unlock (&tty0.mtx);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
case USB_EVENT_GET_DESCRIPTOR:
|
||||||
|
if (usb_get_descriptor (&dev) < 0)
|
||||||
|
usb_lld_ctrl_error (&dev);
|
||||||
|
continue;
|
||||||
|
|
||||||
case USB_EVENT_SET_CONFIGURATION:
|
case USB_EVENT_SET_CONFIGURATION:
|
||||||
if (usb_set_configuration (&dev) < 0)
|
if (usb_set_configuration (&dev) < 0)
|
||||||
usb_lld_ctrl_error (&dev);
|
usb_lld_ctrl_error (&dev);
|
||||||
@@ -750,17 +750,12 @@ tty_main (void *arg)
|
|||||||
usb_lld_ctrl_error (&dev);
|
usb_lld_ctrl_error (&dev);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Non standard device request. */
|
|
||||||
case USB_EVENT_CTRL_REQUEST:
|
case USB_EVENT_CTRL_REQUEST:
|
||||||
|
/* Device specific device request. */
|
||||||
if (usb_setup (&dev) < 0)
|
if (usb_setup (&dev) < 0)
|
||||||
usb_lld_ctrl_error (&dev);
|
usb_lld_ctrl_error (&dev);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Control WRITE transfer finished. */
|
|
||||||
case USB_EVENT_CTRL_WRITE_FINISH:
|
|
||||||
usb_ctrl_write_finish (&dev);
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case USB_EVENT_GET_STATUS_INTERFACE:
|
case USB_EVENT_GET_STATUS_INTERFACE:
|
||||||
if (usb_get_status_interface (&dev) < 0)
|
if (usb_get_status_interface (&dev) < 0)
|
||||||
usb_lld_ctrl_error (&dev);
|
usb_lld_ctrl_error (&dev);
|
||||||
@@ -771,11 +766,19 @@ tty_main (void *arg)
|
|||||||
usb_lld_ctrl_error (&dev);
|
usb_lld_ctrl_error (&dev);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case USB_EVENT_NONE:
|
|
||||||
case USB_EVENT_SET_FEATURE_DEVICE:
|
case USB_EVENT_SET_FEATURE_DEVICE:
|
||||||
case USB_EVENT_SET_FEATURE_ENDPOINT:
|
case USB_EVENT_SET_FEATURE_ENDPOINT:
|
||||||
case USB_EVENT_CLEAR_FEATURE_DEVICE:
|
case USB_EVENT_CLEAR_FEATURE_DEVICE:
|
||||||
case USB_EVENT_CLEAR_FEATURE_ENDPOINT:
|
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:
|
case USB_EVENT_DEVICE_SUSPEND:
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ usb_lld_ctrl_ack (struct usb_dev *dev)
|
|||||||
/* Zero length packet for ACK. */
|
/* Zero length packet for ACK. */
|
||||||
dev->state = WAIT_STATUS_IN;
|
dev->state = WAIT_STATUS_IN;
|
||||||
kl27z_prepare_ep0_in (&dev->dev_req, 0, DATA1);
|
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;
|
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)
|
if ((r = (*handler) (dev)) < 0)
|
||||||
{
|
{
|
||||||
usb_lld_ctrl_error (dev);
|
usb_lld_ctrl_error (dev);
|
||||||
return USB_EVENT_NONE;
|
return USB_EVENT_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return r;
|
return r;
|
||||||
@@ -829,7 +829,7 @@ handle_transaction (struct usb_dev *dev, uint8_t stat)
|
|||||||
{
|
{
|
||||||
handle_out0 (dev, stat);
|
handle_out0 (dev, stat);
|
||||||
USB_CTRL1->ISTAT = USB_IS_TOKDNE;
|
USB_CTRL1->ISTAT = USB_IS_TOKDNE;
|
||||||
return USB_EVENT_NONE;
|
return USB_EVENT_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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);
|
kl27z_prepare_ep0_out (p, len, DATA1);
|
||||||
dev->state = OUT_DATA;
|
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->len -= len;
|
||||||
data_p->addr += len;
|
data_p->addr += len;
|
||||||
|
|
||||||
return USB_EVENT_NONE;
|
return USB_EVENT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ usb_lld_ctrl_ack (struct usb_dev *dev)
|
|||||||
dev->state = WAIT_STATUS_IN;
|
dev->state = WAIT_STATUS_IN;
|
||||||
st103_set_tx_count (ENDP0, 0);
|
st103_set_tx_count (ENDP0, 0);
|
||||||
st103_ep_set_rxtx_status (ENDP0, EP_RX_NAK, EP_TX_VALID);
|
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)
|
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_handle_transfer (dev, istr_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return USB_EVENT_NONE;
|
return USB_EVENT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_datastage_out (struct usb_dev *dev)
|
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)
|
if ((r = (*handler) (dev)) < 0)
|
||||||
{
|
{
|
||||||
usb_lld_ctrl_error (dev);
|
usb_lld_ctrl_error (dev);
|
||||||
return USB_EVENT_NONE;
|
return USB_EVENT_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return r;
|
return r;
|
||||||
@@ -885,7 +885,7 @@ usb_handle_transfer (struct usb_dev *dev, uint16_t istr_value)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
handle_out0 (dev);
|
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)
|
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;
|
struct ctrl_data *data_p = &dev->ctrl_data;
|
||||||
data_p->addr = p;
|
data_p->addr = p;
|
||||||
data_p->len = len;
|
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)
|
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_set_tx_count (ENDP0, len);
|
||||||
st103_ep_set_rxtx_status (ENDP0, EP_RX_NAK, EP_TX_VALID);
|
st103_ep_set_rxtx_status (ENDP0, EP_RX_NAK, EP_TX_VALID);
|
||||||
return USB_EVENT_NONE;
|
return USB_EVENT_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ struct usb_dev {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
USB_EVENT_NONE=0, /* Processed in lower layer. */
|
USB_EVENT_OK=0, /* Processed in lower layer. */
|
||||||
/* Device reset and suspend. */
|
/* Device reset and suspend. */
|
||||||
USB_EVENT_DEVICE_RESET,
|
USB_EVENT_DEVICE_RESET,
|
||||||
USB_EVENT_DEVICE_SUSPEND,
|
USB_EVENT_DEVICE_SUSPEND,
|
||||||
|
|||||||
Reference in New Issue
Block a user