summaryrefslogtreecommitdiff
path: root/components/drivers/usb/usbdevice
diff options
context:
space:
mode:
authorGrissiom <[email protected]>2013-08-19 10:50:20 +0800
committerGrissiom <[email protected]>2013-08-19 14:12:35 +0800
commit981d929b562610328309ee4e01d66727f5e6896e (patch)
treec359aa49f1e68671f7c871074a73e54605f6467d /components/drivers/usb/usbdevice
parent6f75988cee4c0e7bfd77211c56c40681cbc4710e (diff)
ringbuffer: fix the ambiguous name
RT_RINGBUFFER_SIZE could mean "the size of the whole buffer", "the size of the empty space" or "the size of the data". Moreover, it's never a micro anymore. Change it to rt_ringbuffer_data_len before it's too late. Also, RT_RINGBUFFER_EMPTY is changed to rt_ringbuffer_space_len.
Diffstat (limited to 'components/drivers/usb/usbdevice')
-rw-r--r--components/drivers/usb/usbdevice/class/cdc_vcom.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/components/drivers/usb/usbdevice/class/cdc_vcom.c b/components/drivers/usb/usbdevice/class/cdc_vcom.c
index 1dee3a4d79..5f284b0294 100644
--- a/components/drivers/usb/usbdevice/class/cdc_vcom.c
+++ b/components/drivers/usb/usbdevice/class/cdc_vcom.c
@@ -188,7 +188,7 @@ static rt_err_t _ep_in_handler(udevice_t device, uclass_t cls, rt_size_t size)
eps = (cdc_eps_t)cls->eps;
level = rt_hw_interrupt_disable();
- remain = RT_RINGBUFFER_SIZE(&tx_ringbuffer);
+ remain = rt_ringbuffer_data_len(&tx_ringbuffer);
if (remain != 0)
{
/* although vcom_in_sending is set in SOF handler in the very
@@ -453,7 +453,7 @@ static rt_err_t _class_sof_handler(udevice_t device, uclass_t cls)
eps = (cdc_eps_t)cls->eps;
- size = RT_RINGBUFFER_SIZE(&tx_ringbuffer);
+ size = rt_ringbuffer_data_len(&tx_ringbuffer);
if (size == 0)
return -RT_EFULL;
@@ -611,7 +611,7 @@ static int _vcom_putc(struct rt_serial_device *serial, char c)
* data out soon. But we cannot rely on that and if we wait to long, just
* return. */
for (cnt = 500;
- RT_RINGBUFFER_EMPTY(&tx_ringbuffer) == 0 && cnt;
+ rt_ringbuffer_space_len(&tx_ringbuffer) == 0 && cnt;
cnt--)
{
/*rt_kprintf("wait for %d\n", cnt);*/
@@ -628,7 +628,7 @@ static int _vcom_putc(struct rt_serial_device *serial, char c)
}
level = rt_hw_interrupt_disable();
- if (RT_RINGBUFFER_EMPTY(&tx_ringbuffer))
+ if (rt_ringbuffer_space_len(&tx_ringbuffer))
{
rt_ringbuffer_putchar(&tx_ringbuffer, c);
}
@@ -646,7 +646,7 @@ static int _vcom_getc(struct rt_serial_device *serial)
result = -1;
level = rt_hw_interrupt_disable();
- if (RT_RINGBUFFER_SIZE(&rx_ringbuffer))
+ if (rt_ringbuffer_data_len(&rx_ringbuffer))
{
rt_ringbuffer_getchar(&rx_ringbuffer, &ch);
result = ch;