Merge branch 'master' into simposix

This commit is contained in:
prife committed 2013-01-22 16:23:33 +08:00
commit 29d63fe2bc
9 files changed
+97 -279

No files matched your search

@@ -25,11 +25,12 @@
struct rt_mtd_nand_driver_ops;
#define RT_MTD_NAND_DEVICE(device) ((struct rt_mtd_nand_device*)(device))
#define RT_MTD_EOK 0
#define RT_MTD_EECC 1
#define RT_MTD_EBUSY 2
#define RT_MTD_EIO 3
#define RT_MTD_ENOMEM 4
#define RT_MTD_EOK 0 /* NO error */
#define RT_MTD_EECC 1 /* ECC error */
#define RT_MTD_EBUSY 2 /* hardware busy */
#define RT_MTD_EIO 3 /* generic IO issue */
#define RT_MTD_ENOMEM 4 /* out of memory */
#define RT_MTD_ESRC 5 /* source issue */
struct rt_mtd_nand_device
{
+41 -4
View File
@@ -124,7 +124,7 @@ static rt_err_t _get_string_descriptor(struct udevice* device, ureq_t setup)
}
}
if(setup->length == 0xFF)
if(setup->length > len)
len = str_desc.bLength;
else
len = setup->length;
@@ -355,6 +355,38 @@ static rt_err_t _set_address(struct udevice* device, ureq_t setup)
return RT_EOK;
}
/**
* This function will handle standard request to
* interface that defined in class-specifics
*
* @param device the usb device object.
* @param setup the setup request.
*
* @return RT_EOK on successful.
*/
static rt_err_t _request_interface(struct udevice* device, ureq_t setup)
{
uintf_t intf;
uclass_t cls;
rt_err_t ret;
/* parameter check */
RT_ASSERT(device != RT_NULL);
RT_ASSERT(setup != RT_NULL);
RT_DEBUG_LOG(RT_DEBUG_USB, ("_request_interface\n"));
intf = rt_usbd_find_interface(device, setup->index & 0xFF, &cls);
if (intf != RT_NULL)
{
ret = intf->handler(device, cls, setup);
}
else
ret = -RT_ERROR;
return ret;
}
/**
* This function will handle standard request.
*
@@ -419,9 +451,14 @@ static rt_err_t _standard_request(struct udevice* device, ureq_t setup)
_set_interface(device, setup);
break;
default:
rt_kprintf("unknown interface request\n");
dcd_ep_stall(device->dcd, 0);
break;
if (_request_interface(device, setup) != RT_EOK)
{
rt_kprintf("unknown interface request\n");
dcd_ep_stall(device->dcd, 0);
return - RT_ERROR;
}
else
break;
}
break;
case USB_REQ_TYPE_ENDPOINT:
+6 -2
View File
@@ -623,7 +623,9 @@ long list(void)
rt_kprintf("--Variable List:\n");
{
struct finsh_sysvar *index;
for (index = _sysvar_table_begin; index < _sysvar_table_end; index ++)
for (index = _sysvar_table_begin;
index < _sysvar_table_end;
FINSH_NEXT_SYSVAR(index))
{
#ifdef FINSH_USING_DESCRIPTION
rt_kprintf("%-16s -- %s\n", index->name, index->desc);
@@ -761,7 +763,9 @@ void list_prefix(char *prefix)
/* checks in system variable */
{
struct finsh_sysvar* index;
for (index = _sysvar_table_begin; index < _sysvar_table_end; index ++)
for (index = _sysvar_table_begin;
index < _sysvar_table_end;
FINSH_NEXT_SYSVAR(index))
{
if (str_is_prefix(prefix, index->name) == 0)
{
+13 -2
View File
@@ -64,8 +64,16 @@ typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned long u_long;
#if !defined(__CC_ARM) && !defined(__IAR_SYSTEMS_ICC__) && !defined(__ADSPBLACKFIN__) && !defined(_MSC_VER)
#if !defined(__CC_ARM) && \
!defined(__IAR_SYSTEMS_ICC__) && \
!defined(__ADSPBLACKFIN__) && \
!defined(_MSC_VER)
#if !(defined(__GNUC__) && defined(__x86_64__))
typedef unsigned int size_t;
#else
#include <stdio.h>
#endif
#ifndef NULL
#define NULL RT_NULL
@@ -148,11 +156,14 @@ struct finsh_sysvar
void* var ; /* the address of variable */
};
#if defined(_MSC_VER)
#if defined(_MSC_VER) || (defined(__GNUC__) && defined(__x86_64__))
struct finsh_syscall* finsh_syscall_next(struct finsh_syscall* call);
struct finsh_sysvar* finsh_sysvar_next(struct finsh_sysvar* call);
#define FINSH_NEXT_SYSCALL(index) index=finsh_syscall_next(index)
#define FINSH_NEXT_SYSVAR(index) index=finsh_sysvar_next(index)
#else
#define FINSH_NEXT_SYSCALL(index) index++
#define FINSH_NEXT_SYSVAR(index) index++
#endif
/* system variable item */
+3 -1
View File
@@ -121,7 +121,9 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name)
struct finsh_sysvar* index;
struct finsh_sysvar_item* item;
for (index = _sysvar_table_begin; index < _sysvar_table_end; index ++)
for (index = _sysvar_table_begin;
index < _sysvar_table_end;
FINSH_NEXT_SYSVAR(index))
{
if (strcmp(index->name, name) == 0)
return index;
+11 -1
View File
@@ -83,7 +83,7 @@ void finsh_syscall_append(const char* name, syscall_func func)
}
#endif
#ifdef _MSC_VER
#if defined(_MSC_VER) || (defined(__GNUC__) && defined(__x86_64__))
struct finsh_syscall* finsh_syscall_next(struct finsh_syscall* call)
{
unsigned int *ptr;
@@ -93,6 +93,16 @@ struct finsh_syscall* finsh_syscall_next(struct finsh_syscall* call)
return (struct finsh_syscall*)ptr;
}
struct finsh_sysvar* finsh_sysvar_next(struct finsh_sysvar* call)
{
unsigned int *ptr;
ptr = (unsigned int*) (call + 1);
while ((*ptr == 0) && ((unsigned int*)ptr < (unsigned int*) _sysvar_table_end))
ptr ++;
return (struct finsh_sysvar*)ptr;
}
#endif
struct finsh_syscall* finsh_syscall_lookup(const char* name)
+8 -1
View File
@@ -11,6 +11,13 @@ cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]
group = DefineGroup('newlib', src, depend = ['RT_USING_NEWLIB'], CPPPATH = CPPPATH)
# link with libm in default.
# libm is a frequently used lib. Newlib is compiled with -ffunction-sections in
# recent GCC tool chains. The linker would just link in the functions that have
# been referenced. So setting this won't result in bigger text size.
LIBS = ['m']
group = DefineGroup('newlib', src, depend = ['RT_USING_NEWLIB'],
CPPPATH = CPPPATH, LIBS = LIBS)
Return('group')
File diff suppressed because it is too large. Load diff
+9 -3
View File
@@ -273,12 +273,18 @@ rt_err_t rt_timer_start(rt_timer_t timer)
for (n = timer_list->next; n != timer_list; n = n->next)
{
t = rt_list_entry(n, struct rt_timer, list);
/*
* It supposes that the new tick shall less than the half duration of
* tick max.
* tick max. And if we have two timers that timeout at the same time,
* it's prefered that the timer inserted early get called early.
*/
if ((t->timeout_tick - timer->timeout_tick) < RT_TICK_MAX / 2)
if ((t->timeout_tick - timer->timeout_tick) == 0)
{
rt_list_insert_after(n, &(timer->list));
break;
}
else if ((t->timeout_tick - timer->timeout_tick) < RT_TICK_MAX / 2)
{
rt_list_insert_before(n, &(timer->list));
break;