Merge pull request #1189 from ChunfengMu/fix_bugs

[Components][Drivers][USB]fix compiling errors
This commit is contained in:
ZYH 2018-01-24 12:50:19 +08:00 committed by GitHub
commit 6f117e8e36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 10 deletions

View File

@ -49,7 +49,7 @@
#ifdef RT_VCOM_TX_USE_DMA #ifdef RT_VCOM_TX_USE_DMA
#define VCOM_TX_USE_DMA #define VCOM_TX_USE_DMA
#endif /*RT_VCOM_TASK_STK_SIZE*/ #endif /*RT_VCOM_TX_USE_DMA*/
#ifdef RT_VCOM_SERNO #ifdef RT_VCOM_SERNO
#define _SER_NO RT_VCOM_SERNO #define _SER_NO RT_VCOM_SERNO
@ -58,9 +58,9 @@
#endif /*RT_VCOM_SERNO*/ #endif /*RT_VCOM_SERNO*/
#ifdef RT_VCOM_SER_LEN #ifdef RT_VCOM_SER_LEN
#define __SER_NO_LEN RT_VCOM_SER_LEN #define _SER_NO_LEN RT_VCOM_SER_LEN
#else /*!RT_VCOM_SER_LEN*/ #else /*!RT_VCOM_SER_LEN*/
#define __SER_NO_LEN rt_strlen("32021919830108") #define _SER_NO_LEN 14 /*rt_strlen("32021919830108")*/
#endif /*RT_VCOM_SER_LEN*/ #endif /*RT_VCOM_SER_LEN*/
ALIGN(RT_ALIGN_SIZE) ALIGN(RT_ALIGN_SIZE)
@ -209,11 +209,14 @@ const static struct ucdc_data_descriptor _data_desc =
0x00, 0x00,
}; };
static char serno[_SER_NO_LEN + 1] = {'\0',}; static char serno[_SER_NO_LEN + 1] = {'\0'};
RT_WEAK rt_err_t vcom_get_stored_serno(char *serno, int size) RT_WEAK rt_err_t vcom_get_stored_serno(char *serno, int size);
rt_err_t vcom_get_stored_serno(char *serno, int size)
{ {
return RT_ERROR; return RT_ERROR;
} }
const static char* _ustring[] = const static char* _ustring[] =
{ {
"Language", "Language",
@ -544,8 +547,6 @@ ufunction_t rt_usbd_function_cdc_create(udevice_t device)
/* parameter check */ /* parameter check */
RT_ASSERT(device != RT_NULL); RT_ASSERT(device != RT_NULL);
extern rt_err_t vcom_get_stored_serno(char *serno, int size);
rt_memset(serno, 0, _SER_NO_LEN + 1); rt_memset(serno, 0, _SER_NO_LEN + 1);
if(vcom_get_stored_serno(serno, _SER_NO_LEN) != RT_EOK) if(vcom_get_stored_serno(serno, _SER_NO_LEN) != RT_EOK)
{ {
@ -672,14 +673,14 @@ static rt_size_t _vcom_tx(struct rt_serial_device *serial, rt_uint8_t *buf, rt_s
struct ufunction *func; struct ufunction *func;
struct vcom *data; struct vcom *data;
func = (struct ufunction*)serial->parent.user_data;
data = (struct vcom*)func->user_data;
rt_uint32_t baksize = size; rt_uint32_t baksize = size;
rt_size_t ptr = 0; rt_size_t ptr = 0;
int empty = 0; int empty = 0;
rt_uint8_t crlf[2] = {'\r', '\n',}; rt_uint8_t crlf[2] = {'\r', '\n',};
func = (struct ufunction*)serial->parent.user_data;
data = (struct vcom*)func->user_data;
RT_ASSERT(serial != RT_NULL); RT_ASSERT(serial != RT_NULL);
RT_ASSERT(buf != RT_NULL); RT_ASSERT(buf != RT_NULL);