split export symbols from rtm.c to each file
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2263 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
907e1703e6
commit
a73abdccf5
|
@ -52,6 +52,7 @@ rt_tick_t rt_tick_get(void)
|
|||
/* return the global tick */
|
||||
return rt_tick;
|
||||
}
|
||||
RTM_EXPORT(rt_tick_get);
|
||||
|
||||
/**
|
||||
* This function will set current tick
|
||||
|
@ -105,6 +106,7 @@ rt_tick_t rt_tick_from_millisecond(rt_uint32_t ms)
|
|||
/* return the calculated tick */
|
||||
return (RT_TICK_PER_SECOND * ms + 999) / 1000;
|
||||
}
|
||||
RTM_EXPORT(rt_tick_from_millisecond);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
|
38
src/ipc.c
38
src/ipc.c
|
@ -209,6 +209,7 @@ rt_err_t rt_sem_init(rt_sem_t sem, const char *name, rt_uint32_t value, rt_uint8
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_sem_init);
|
||||
|
||||
/**
|
||||
* This function will detach a semaphore from resource management
|
||||
|
@ -231,6 +232,7 @@ rt_err_t rt_sem_detach(rt_sem_t sem)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_sem_detach);
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/**
|
||||
|
@ -266,6 +268,7 @@ rt_sem_t rt_sem_create(const char *name, rt_uint32_t value, rt_uint8_t flag)
|
|||
|
||||
return sem;
|
||||
}
|
||||
RTM_EXPORT(rt_sem_create);
|
||||
|
||||
/**
|
||||
* This function will delete a semaphore object and release the memory
|
||||
|
@ -290,6 +293,7 @@ rt_err_t rt_sem_delete(rt_sem_t sem)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_sem_delete);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -379,6 +383,7 @@ rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t time)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_sem_take);
|
||||
|
||||
/**
|
||||
* This function will try to take a semaphore and immediately return
|
||||
|
@ -391,6 +396,7 @@ rt_err_t rt_sem_trytake(rt_sem_t sem)
|
|||
{
|
||||
return rt_sem_take(sem, 0);
|
||||
}
|
||||
RTM_EXPORT(rt_sem_trytake);
|
||||
|
||||
/**
|
||||
* This function will release a semaphore, if there are threads suspended on
|
||||
|
@ -434,6 +440,7 @@ rt_err_t rt_sem_release(rt_sem_t sem)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_sem_release);
|
||||
|
||||
/**
|
||||
* This function can get or set some extra attributions of a semaphore object.
|
||||
|
@ -474,6 +481,7 @@ rt_err_t rt_sem_control(rt_sem_t sem, rt_uint8_t cmd, void *arg)
|
|||
|
||||
return -RT_ERROR;
|
||||
}
|
||||
RTM_EXPORT(rt_sem_control);
|
||||
#endif /* end of RT_USING_SEMAPHORE */
|
||||
|
||||
#ifdef RT_USING_MUTEX
|
||||
|
@ -507,6 +515,7 @@ rt_err_t rt_mutex_init(rt_mutex_t mutex, const char *name, rt_uint8_t flag)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mutex_init);
|
||||
|
||||
/**
|
||||
* This function will detach a mutex from resource management
|
||||
|
@ -529,6 +538,7 @@ rt_err_t rt_mutex_detach(rt_mutex_t mutex)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mutex_detach);
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/**
|
||||
|
@ -565,6 +575,7 @@ rt_mutex_t rt_mutex_create(const char *name, rt_uint8_t flag)
|
|||
|
||||
return mutex;
|
||||
}
|
||||
RTM_EXPORT(rt_mutex_create);
|
||||
|
||||
/**
|
||||
* This function will delete a mutex object and release the memory
|
||||
|
@ -589,6 +600,7 @@ rt_err_t rt_mutex_delete(rt_mutex_t mutex)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mutex_delete);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -715,6 +727,7 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mutex_take);
|
||||
|
||||
/**
|
||||
* This function will release a mutex, if there are threads suspended on mutex,
|
||||
|
@ -805,6 +818,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mutex_release);
|
||||
|
||||
/**
|
||||
* This function can get or set some extra attributions of a mutex object.
|
||||
|
@ -819,6 +833,7 @@ rt_err_t rt_mutex_control(rt_mutex_t mutex, rt_uint8_t cmd, void *arg)
|
|||
{
|
||||
return -RT_ERROR;
|
||||
}
|
||||
RTM_EXPORT(rt_mutex_control);
|
||||
#endif /* end of RT_USING_MUTEX */
|
||||
|
||||
#ifdef RT_USING_EVENT
|
||||
|
@ -850,6 +865,7 @@ rt_err_t rt_event_init(rt_event_t event, const char *name, rt_uint8_t flag)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_event_init);
|
||||
|
||||
/**
|
||||
* This function will detach an event object from resource management
|
||||
|
@ -871,6 +887,7 @@ rt_err_t rt_event_detach(rt_event_t event)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_event_detach);
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/**
|
||||
|
@ -903,6 +920,7 @@ rt_event_t rt_event_create(const char *name, rt_uint8_t flag)
|
|||
|
||||
return event;
|
||||
}
|
||||
RTM_EXPORT(rt_event_create);
|
||||
|
||||
/**
|
||||
* This function will delete an event object and release the memory
|
||||
|
@ -926,6 +944,7 @@ rt_err_t rt_event_delete(rt_event_t event)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_event_delete);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -1017,6 +1036,7 @@ rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_event_send);
|
||||
|
||||
/**
|
||||
* This function will receive an event from event object, if the event is unavailable,
|
||||
|
@ -1124,6 +1144,7 @@ rt_err_t rt_event_recv(rt_event_t event, rt_uint32_t set, rt_uint8_t option, rt_
|
|||
|
||||
return thread->error;
|
||||
}
|
||||
RTM_EXPORT(rt_event_recv);
|
||||
|
||||
/**
|
||||
* This function can get or set some extra attributions of an event object.
|
||||
|
@ -1160,6 +1181,7 @@ rt_err_t rt_event_control(rt_event_t event, rt_uint8_t cmd, void *arg)
|
|||
|
||||
return -RT_ERROR;
|
||||
}
|
||||
RTM_EXPORT(rt_event_control);
|
||||
#endif /* end of RT_USING_EVENT */
|
||||
|
||||
#ifdef RT_USING_MAILBOX
|
||||
|
@ -1200,6 +1222,7 @@ rt_err_t rt_mb_init(rt_mailbox_t mb, const char *name, void *msgpool, rt_size_t
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mb_init);
|
||||
|
||||
/**
|
||||
* This function will detach a mailbox from resource management
|
||||
|
@ -1223,6 +1246,7 @@ rt_err_t rt_mb_detach(rt_mailbox_t mb)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mb_detach);
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/**
|
||||
|
@ -1270,6 +1294,7 @@ rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag)
|
|||
|
||||
return mb;
|
||||
}
|
||||
RTM_EXPORT(rt_mb_create);
|
||||
|
||||
/**
|
||||
* This function will delete a mailbox object and release the memory
|
||||
|
@ -1306,6 +1331,7 @@ rt_err_t rt_mb_delete(rt_mailbox_t mb)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mb_delete);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -1431,6 +1457,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb, rt_uint32_t value, rt_int32_t timeout)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mb_send_wait);
|
||||
|
||||
/**
|
||||
* This function will send a mail to mailbox object, if there are threads suspended
|
||||
|
@ -1446,6 +1473,7 @@ rt_err_t rt_mb_send(rt_mailbox_t mb, rt_uint32_t value)
|
|||
{
|
||||
return rt_mb_send_wait(mb, value, 0);
|
||||
}
|
||||
RTM_EXPORT(rt_mb_send);
|
||||
|
||||
/**
|
||||
* This function will receive a mail from mailbox object, if there is no mail in
|
||||
|
@ -1577,6 +1605,7 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_uint32_t *value, rt_int32_t timeout)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mb_recv);
|
||||
|
||||
/**
|
||||
* This function can get or set some extra attributions of a mailbox object.
|
||||
|
@ -1617,6 +1646,7 @@ rt_err_t rt_mb_control(rt_mailbox_t mb, rt_uint8_t cmd, void *arg)
|
|||
|
||||
return -RT_ERROR;
|
||||
}
|
||||
RTM_EXPORT(rt_mb_control);
|
||||
#endif /* end of RT_USING_MAILBOX */
|
||||
|
||||
#ifdef RT_USING_MESSAGEQUEUE
|
||||
|
@ -1681,6 +1711,7 @@ rt_err_t rt_mq_init(rt_mq_t mq, const char *name, void *msgpool, rt_size_t msg_s
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mq_init);
|
||||
|
||||
/**
|
||||
* This function will detach a message queue object from resource management
|
||||
|
@ -1702,6 +1733,7 @@ rt_err_t rt_mq_detach(rt_mq_t mq)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mq_detach);
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/**
|
||||
|
@ -1767,6 +1799,7 @@ rt_mq_t rt_mq_create(const char *name, rt_size_t msg_size, rt_size_t max_msgs, r
|
|||
|
||||
return mq;
|
||||
}
|
||||
RTM_EXPORT(rt_mq_create);
|
||||
|
||||
/**
|
||||
* This function will delete a message queue object and release the memory
|
||||
|
@ -1800,6 +1833,7 @@ rt_err_t rt_mq_delete(rt_mq_t mq)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mq_delete);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -1887,6 +1921,7 @@ rt_err_t rt_mq_send(rt_mq_t mq, void *buffer, rt_size_t size)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mq_send);
|
||||
|
||||
/**
|
||||
* This function will send urgently a message to message queue object, which means
|
||||
|
@ -1968,6 +2003,7 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, void *buffer, rt_size_t size)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mq_urgent);
|
||||
|
||||
/**
|
||||
* This function will receive a message from message queue object, if there is no
|
||||
|
@ -2099,6 +2135,7 @@ rt_err_t rt_mq_recv(rt_mq_t mq, void *buffer, rt_size_t size, rt_int32_t timeout
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mq_recv);
|
||||
|
||||
/**
|
||||
* This function can get or set some extra attributions of a message queue object.
|
||||
|
@ -2154,6 +2191,7 @@ rt_err_t rt_mq_control(rt_mq_t mq, rt_uint8_t cmd, void *arg)
|
|||
|
||||
return -RT_ERROR;
|
||||
}
|
||||
RTM_EXPORT(rt_mq_control);
|
||||
#endif /* end of RT_USING_MESSAGEQUEUE */
|
||||
|
||||
/*@}*/
|
||||
|
|
|
@ -58,6 +58,7 @@ rt_err_t rt_get_errno(void)
|
|||
|
||||
return tid->error;
|
||||
}
|
||||
RTM_EXPORT(rt_get_errno);
|
||||
|
||||
/*
|
||||
* This function will set errno
|
||||
|
@ -86,6 +87,7 @@ void rt_set_errno(rt_err_t error)
|
|||
|
||||
tid->error = error;
|
||||
}
|
||||
RTM_EXPORT(rt_set_errno);
|
||||
|
||||
/**
|
||||
* This function returns errno.
|
||||
|
@ -105,6 +107,7 @@ int *_rt_errno(void)
|
|||
|
||||
return (int *)&_errno;
|
||||
}
|
||||
RTM_EXPORT(_rt_errno);
|
||||
|
||||
/**
|
||||
* This function will set the content of memory to specified value
|
||||
|
@ -186,6 +189,7 @@ void *rt_memset(void *s, int c, rt_ubase_t count)
|
|||
#undef TOO_SMALL
|
||||
#endif
|
||||
}
|
||||
RTM_EXPORT(rt_memset);
|
||||
|
||||
/**
|
||||
* This function will copy memory content from source address to destination
|
||||
|
@ -259,6 +263,7 @@ void *rt_memcpy(void *dst, const void *src, rt_ubase_t count)
|
|||
#undef TOO_SMALL
|
||||
#endif
|
||||
}
|
||||
RTM_EXPORT(rt_memcpy);
|
||||
|
||||
/**
|
||||
* This function will move memory content from source address to destination
|
||||
|
@ -290,6 +295,7 @@ void *rt_memmove(void *dest, const void *src, rt_ubase_t n)
|
|||
|
||||
return dest;
|
||||
}
|
||||
RTM_EXPORT(rt_memmove);
|
||||
|
||||
/**
|
||||
* This function will compare two areas of memory
|
||||
|
@ -311,6 +317,7 @@ rt_int32_t rt_memcmp(const void *cs, const void *ct, rt_ubase_t count)
|
|||
|
||||
return res;
|
||||
}
|
||||
RTM_EXPORT(rt_memcmp);
|
||||
|
||||
/**
|
||||
* This function will return the first occurrence of a string.
|
||||
|
@ -338,6 +345,7 @@ char *rt_strstr(const char *s1, const char *s2)
|
|||
|
||||
return RT_NULL;
|
||||
}
|
||||
RTM_EXPORT(rt_strstr);
|
||||
|
||||
/**
|
||||
* This function will compare two strings while ignoring differences in case
|
||||
|
@ -364,6 +372,7 @@ rt_uint32_t rt_strcasecmp(const char *a, const char *b)
|
|||
|
||||
return ca - cb;
|
||||
}
|
||||
RTM_EXPORT(rt_strcasecmp);
|
||||
|
||||
/**
|
||||
* This function will copy string no more than n bytes.
|
||||
|
@ -395,6 +404,7 @@ char *rt_strncpy(char *dst, const char *src, rt_ubase_t n)
|
|||
|
||||
return (dst);
|
||||
}
|
||||
RTM_EXPORT(rt_strncpy);
|
||||
|
||||
/**
|
||||
* This function will compare two strings with specified maximum length
|
||||
|
@ -418,6 +428,7 @@ rt_ubase_t rt_strncmp(const char *cs, const char *ct, rt_ubase_t count)
|
|||
|
||||
return __res;
|
||||
}
|
||||
RTM_EXPORT(rt_strncmp);
|
||||
|
||||
/**
|
||||
* This function will compare two strings without specified length
|
||||
|
@ -434,6 +445,7 @@ rt_ubase_t rt_strcmp(const char *cs, const char *ct)
|
|||
|
||||
return (*cs - *ct);
|
||||
}
|
||||
RTM_EXPORT(rt_strcmp);
|
||||
|
||||
/**
|
||||
* This function will return the length of a string, which terminate will
|
||||
|
@ -452,6 +464,7 @@ rt_ubase_t rt_strlen(const char *s)
|
|||
|
||||
return sc - s;
|
||||
}
|
||||
RTM_EXPORT(rt_strlen);
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/**
|
||||
|
@ -473,6 +486,7 @@ char *rt_strdup(const char *s)
|
|||
|
||||
return tmp;
|
||||
}
|
||||
RTM_EXPORT(rt_strdup);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -485,6 +499,7 @@ void rt_show_version(void)
|
|||
rt_kprintf(" / | \\ %d.%d.%d build %s\n", RT_VERSION, RT_SUBVERSION, RT_REVISION, __DATE__);
|
||||
rt_kprintf(" 2006 - 2012 Copyright by rt-thread team\n");
|
||||
}
|
||||
RTM_EXPORT(rt_show_version);
|
||||
|
||||
/* private function */
|
||||
#define isdigit(c) ((unsigned)((c) - '0') < 10)
|
||||
|
@ -947,6 +962,7 @@ rt_int32_t rt_snprintf(char *buf, rt_size_t size, const char *fmt, ...)
|
|||
|
||||
return n;
|
||||
}
|
||||
RTM_EXPORT(rt_snprintf);
|
||||
|
||||
/**
|
||||
* This function will fill a formatted string to buffer
|
||||
|
@ -959,6 +975,7 @@ rt_int32_t rt_vsprintf(char *buf, const char *format, va_list arg_ptr)
|
|||
{
|
||||
return vsnprintf(buf, (rt_size_t) -1, format, arg_ptr);
|
||||
}
|
||||
RTM_EXPORT(rt_vsprintf);
|
||||
|
||||
/**
|
||||
* This function will fill a formatted string to buffer
|
||||
|
@ -977,6 +994,7 @@ rt_int32_t rt_sprintf(char *buf, const char *format, ...)
|
|||
|
||||
return n;
|
||||
}
|
||||
RTM_EXPORT(rt_sprintf);
|
||||
|
||||
#ifdef RT_USING_CONSOLE
|
||||
|
||||
|
@ -990,6 +1008,7 @@ rt_device_t rt_console_get_device(void)
|
|||
{
|
||||
return _console_device;
|
||||
}
|
||||
RTM_EXPORT(rt_console_get_device);
|
||||
|
||||
/**
|
||||
* This function will set a device as console device.
|
||||
|
@ -1024,6 +1043,7 @@ rt_device_t rt_console_set_device(const char *name)
|
|||
|
||||
return old;
|
||||
}
|
||||
RTM_EXPORT(rt_console_set_device);
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__ADSPBLACKFIN__)
|
||||
|
@ -1040,6 +1060,7 @@ void rt_hw_console_output(const char *str)
|
|||
{
|
||||
/* empty console output */
|
||||
}
|
||||
RTM_EXPORT(rt_hw_console_output);
|
||||
|
||||
/**
|
||||
* This function will print a formatted string on system console
|
||||
|
@ -1068,10 +1089,13 @@ void rt_kprintf(const char *fmt, ...)
|
|||
#endif
|
||||
va_end(args);
|
||||
}
|
||||
RTM_EXPORT(rt_kprintf);
|
||||
#else
|
||||
void rt_kprintf(const char *fmt, ...)
|
||||
{
|
||||
}
|
||||
RTM_EXPORT(rt_kprintf);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
|
@ -1116,6 +1140,7 @@ void* rt_malloc_align(rt_size_t size, rt_size_t align)
|
|||
|
||||
return ptr;
|
||||
}
|
||||
RTM_EXPORT(rt_malloc_align);
|
||||
|
||||
/**
|
||||
* This function release the memory block, which is allocated by rt_malloc_align
|
||||
|
@ -1130,6 +1155,7 @@ void rt_free_align(void *ptr)
|
|||
real_ptr = (void*)*(rt_uint32_t*)((rt_uint32_t)ptr - sizeof(void*));
|
||||
rt_free(real_ptr);
|
||||
}
|
||||
RTM_EXPORT(rt_free_align);
|
||||
#endif
|
||||
|
||||
#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC) && defined (__GNUC__)
|
||||
|
|
|
@ -350,6 +350,7 @@ void *rt_malloc(rt_size_t size)
|
|||
|
||||
return RT_NULL;
|
||||
}
|
||||
RTM_EXPORT(rt_malloc);
|
||||
|
||||
/**
|
||||
* This function will change the previously allocated memory block.
|
||||
|
@ -441,6 +442,7 @@ void *rt_realloc(void *rmem, rt_size_t newsize)
|
|||
|
||||
return nmem;
|
||||
}
|
||||
RTM_EXPORT(rt_realloc);
|
||||
|
||||
/**
|
||||
* This function will contiguously allocate enough space for count objects
|
||||
|
@ -469,6 +471,7 @@ void *rt_calloc(rt_size_t count, rt_size_t size)
|
|||
|
||||
return p;
|
||||
}
|
||||
RTM_EXPORT(rt_calloc);
|
||||
|
||||
/**
|
||||
* This function will release the previously allocated memory block by rt_malloc.
|
||||
|
@ -529,6 +532,7 @@ void rt_free(void *rmem)
|
|||
plug_holes(mem);
|
||||
rt_sem_release(&heap_sem);
|
||||
}
|
||||
RTM_EXPORT(rt_free);
|
||||
|
||||
#ifdef RT_MEM_STATS
|
||||
void rt_memory_info(rt_uint32_t *total, rt_uint32_t *used, rt_uint32_t *max_used)
|
||||
|
|
|
@ -101,6 +101,7 @@ rt_err_t rt_memheap_init(struct rt_memheap *memheap, const char *name,
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_memheap_init);
|
||||
|
||||
rt_err_t rt_memheap_detach(struct rt_memheap *heap)
|
||||
{
|
||||
|
@ -109,6 +110,7 @@ rt_err_t rt_memheap_detach(struct rt_memheap *heap)
|
|||
/* Return a successful completion. */
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_memheap_detach);
|
||||
|
||||
void *rt_memheap_alloc(struct rt_memheap *pool_ptr, rt_uint32_t size)
|
||||
{
|
||||
|
@ -219,6 +221,7 @@ void *rt_memheap_alloc(struct rt_memheap *pool_ptr, rt_uint32_t size)
|
|||
/* Return the completion status. */
|
||||
return RT_NULL;
|
||||
}
|
||||
RTM_EXPORT(rt_memheap_alloc);
|
||||
|
||||
void rt_memheap_free(void *ptr)
|
||||
{
|
||||
|
@ -297,5 +300,6 @@ void rt_memheap_free(void *ptr)
|
|||
header_ptr->next_free, header_ptr->prev_free));
|
||||
}
|
||||
}
|
||||
RTM_EXPORT(rt_memheap_free);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -119,6 +119,7 @@ rt_err_t rt_mp_init(struct rt_mempool *mp, const char *name, void *start, rt_siz
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mp_init);
|
||||
|
||||
/**
|
||||
* This function will detach a memory pool from system object management.
|
||||
|
@ -165,6 +166,7 @@ rt_err_t rt_mp_detach(struct rt_mempool *mp)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mp_detach);
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/**
|
||||
|
@ -225,6 +227,7 @@ rt_mp_t rt_mp_create(const char *name, rt_size_t block_count, rt_size_t block_si
|
|||
|
||||
return mp;
|
||||
}
|
||||
RTM_EXPORT(rt_mp_create);
|
||||
|
||||
/**
|
||||
* This function will delete a memory pool and release the object memory.
|
||||
|
@ -283,6 +286,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_mp_delete);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -373,6 +377,7 @@ void *rt_mp_alloc(rt_mp_t mp, rt_int32_t time)
|
|||
|
||||
return (rt_uint8_t *)(block_ptr + sizeof(rt_uint8_t *));
|
||||
}
|
||||
RTM_EXPORT(rt_mp_alloc);
|
||||
|
||||
/**
|
||||
* This function will release a memory block
|
||||
|
@ -428,6 +433,7 @@ void rt_mp_free(void *block)
|
|||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
RTM_EXPORT(rt_mp_free);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
|
|
@ -180,6 +180,7 @@ struct rt_object_information *rt_object_get_information(enum rt_object_class_typ
|
|||
{
|
||||
return &rt_object_container[type];
|
||||
}
|
||||
RTM_EXPORT(rt_object_get_information);
|
||||
|
||||
/**
|
||||
* This function will initialize an object and add it to object system management.
|
||||
|
|
259
src/rtm.c
259
src/rtm.c
|
@ -1,259 +0,0 @@
|
|||
/*
|
||||
* File : rtm.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-04-12 yi.qiu first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* some buildin kernel symbol */
|
||||
|
||||
#ifdef RT_USING_MODULE
|
||||
#include <rtm.h>
|
||||
|
||||
RTM_EXPORT(rt_object_get_information);
|
||||
|
||||
/*
|
||||
* thread interface symbol
|
||||
*/
|
||||
|
||||
RTM_EXPORT(rt_thread_init);
|
||||
RTM_EXPORT(rt_thread_detach);
|
||||
RTM_EXPORT(rt_thread_create);
|
||||
RTM_EXPORT(rt_thread_self);
|
||||
RTM_EXPORT(rt_thread_find);
|
||||
RTM_EXPORT(rt_thread_startup);
|
||||
RTM_EXPORT(rt_thread_delete);
|
||||
RTM_EXPORT(rt_thread_yield);
|
||||
RTM_EXPORT(rt_thread_delay);
|
||||
RTM_EXPORT(rt_thread_control);
|
||||
RTM_EXPORT(rt_thread_suspend);
|
||||
RTM_EXPORT(rt_thread_resume);
|
||||
RTM_EXPORT(rt_thread_timeout);
|
||||
|
||||
#ifdef RT_USING_SEMAPHORE
|
||||
/*
|
||||
* semaphore interface symbol
|
||||
*/
|
||||
RTM_EXPORT(rt_sem_init);
|
||||
RTM_EXPORT(rt_sem_detach);
|
||||
RTM_EXPORT(rt_sem_create);
|
||||
RTM_EXPORT(rt_sem_delete);
|
||||
RTM_EXPORT(rt_sem_take);
|
||||
RTM_EXPORT(rt_sem_trytake);
|
||||
RTM_EXPORT(rt_sem_release);
|
||||
RTM_EXPORT(rt_sem_control);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_MUTEX
|
||||
/*
|
||||
* mutex interface symbol
|
||||
*/
|
||||
RTM_EXPORT(rt_mutex_init);
|
||||
RTM_EXPORT(rt_mutex_detach);
|
||||
RTM_EXPORT(rt_mutex_create);
|
||||
RTM_EXPORT(rt_mutex_delete);
|
||||
RTM_EXPORT(rt_mutex_take);
|
||||
RTM_EXPORT(rt_mutex_release);
|
||||
RTM_EXPORT(rt_mutex_control);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_EVENT
|
||||
/*
|
||||
* event interface symbol
|
||||
*/
|
||||
RTM_EXPORT(rt_event_init);
|
||||
RTM_EXPORT(rt_event_detach);
|
||||
RTM_EXPORT(rt_event_create);
|
||||
RTM_EXPORT(rt_event_delete);
|
||||
RTM_EXPORT(rt_event_send);
|
||||
RTM_EXPORT(rt_event_recv);
|
||||
RTM_EXPORT(rt_event_control);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_MAILBOX
|
||||
/*
|
||||
* mailbox interface symbol
|
||||
*/
|
||||
RTM_EXPORT(rt_mb_init);
|
||||
RTM_EXPORT(rt_mb_detach);
|
||||
RTM_EXPORT(rt_mb_create);
|
||||
RTM_EXPORT(rt_mb_delete);
|
||||
RTM_EXPORT(rt_mb_send);
|
||||
RTM_EXPORT(rt_mb_recv);
|
||||
RTM_EXPORT(rt_mb_control);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_MESSAGEQUEUE
|
||||
/*
|
||||
* message queue interface symbol
|
||||
*/
|
||||
RTM_EXPORT(rt_mq_init);
|
||||
RTM_EXPORT(rt_mq_detach);
|
||||
RTM_EXPORT(rt_mq_create);
|
||||
RTM_EXPORT(rt_mq_delete);
|
||||
RTM_EXPORT(rt_mq_send);
|
||||
RTM_EXPORT(rt_mq_urgent);
|
||||
RTM_EXPORT(rt_mq_recv);
|
||||
RTM_EXPORT(rt_mq_control);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_MEMHEAP
|
||||
/*
|
||||
* memory heap interface symbol
|
||||
*/
|
||||
RTM_EXPORT(rt_memheap_init);
|
||||
RTM_EXPORT(rt_memheap_detach);
|
||||
RTM_EXPORT(rt_memheap_alloc);
|
||||
RTM_EXPORT(rt_memheap_free);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_MEMPOOL
|
||||
/*
|
||||
* memory pool interface symbol
|
||||
*/
|
||||
RTM_EXPORT(rt_mp_init);
|
||||
RTM_EXPORT(rt_mp_detach);
|
||||
RTM_EXPORT(rt_mp_create);
|
||||
RTM_EXPORT(rt_mp_delete);
|
||||
RTM_EXPORT(rt_mp_alloc);
|
||||
RTM_EXPORT(rt_mp_free);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/*
|
||||
* heap memory interface symbol
|
||||
*/
|
||||
RTM_EXPORT(rt_malloc);
|
||||
RTM_EXPORT(rt_free);
|
||||
RTM_EXPORT(rt_realloc);
|
||||
RTM_EXPORT(rt_calloc);
|
||||
#endif
|
||||
/*
|
||||
* clock & timer interface symbol
|
||||
*/
|
||||
RTM_EXPORT(rt_tick_get);
|
||||
RTM_EXPORT(rt_tick_from_millisecond);
|
||||
RTM_EXPORT(rt_system_timer_init);
|
||||
RTM_EXPORT(rt_system_timer_thread_init);
|
||||
RTM_EXPORT(rt_timer_init);
|
||||
RTM_EXPORT(rt_timer_detach);
|
||||
RTM_EXPORT(rt_timer_create);
|
||||
RTM_EXPORT(rt_timer_delete);
|
||||
RTM_EXPORT(rt_timer_start);
|
||||
RTM_EXPORT(rt_timer_stop);
|
||||
RTM_EXPORT(rt_timer_control);
|
||||
|
||||
/*
|
||||
* kservice interface symbol
|
||||
*/
|
||||
RTM_EXPORT(rt_memcpy);
|
||||
RTM_EXPORT(rt_memcmp);
|
||||
RTM_EXPORT(rt_memset);
|
||||
RTM_EXPORT(rt_kprintf);
|
||||
RTM_EXPORT(rt_sprintf);
|
||||
RTM_EXPORT(rt_strstr);
|
||||
RTM_EXPORT(rt_snprintf);
|
||||
|
||||
RTM_EXPORT(strcmp);
|
||||
RTM_EXPORT(strcpy);
|
||||
RTM_EXPORT(strlen);
|
||||
RTM_EXPORT(rand);
|
||||
RTM_EXPORT(memset);
|
||||
RTM_EXPORT(memcpy);
|
||||
|
||||
#if defined(RT_USING_NEWLIB) && defined(RT_USING_PTHREADS)
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
RTM_EXPORT(printf);
|
||||
RTM_EXPORT(snprintf);
|
||||
RTM_EXPORT(access);
|
||||
RTM_EXPORT(__assert_func);
|
||||
|
||||
#include <time.h>
|
||||
RTM_EXPORT(localtime);
|
||||
RTM_EXPORT(time);
|
||||
|
||||
#include <math.h>
|
||||
RTM_EXPORT(sin);
|
||||
RTM_EXPORT(cos);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
#include <dfs_posix.h>
|
||||
|
||||
RTM_EXPORT(open);
|
||||
RTM_EXPORT(close);
|
||||
RTM_EXPORT(read);
|
||||
RTM_EXPORT(write);
|
||||
RTM_EXPORT(stat);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
/* FIX ME , should be removed from here */
|
||||
#include <rtgui/dc.h>
|
||||
#include <rtgui/rtgui_server.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/widgets/widget.h>
|
||||
#include <rtgui/widgets/button.h>
|
||||
#include <rtgui/widgets/label.h>
|
||||
#include <rtgui/widgets/list_view.h>
|
||||
#include <rtgui/widgets/listctrl.h>
|
||||
#include <rtgui/widgets/filelist_view.h>
|
||||
#include <rtgui/rtgui_app.h>
|
||||
#include <rtgui/widgets/window.h>
|
||||
|
||||
RTM_EXPORT(rtgui_app_destroy);
|
||||
RTM_EXPORT(rtgui_app_run);
|
||||
RTM_EXPORT(rtgui_app_create);
|
||||
RTM_EXPORT(rtgui_object_check_cast);
|
||||
RTM_EXPORT(_rtgui_container);
|
||||
RTM_EXPORT(_rtgui_widget);
|
||||
RTM_EXPORT(rtgui_win_create);
|
||||
RTM_EXPORT(rtgui_win_show);
|
||||
RTM_EXPORT(rtgui_graphic_driver_get_rect);
|
||||
RTM_EXPORT(rtgui_graphic_driver_get_default);
|
||||
RTM_EXPORT(rtgui_label_create);
|
||||
RTM_EXPORT(rtgui_dc_draw_text);
|
||||
RTM_EXPORT(rtgui_dc_begin_drawing);
|
||||
RTM_EXPORT(rtgui_dc_end_drawing);
|
||||
RTM_EXPORT(rtgui_timer_start);
|
||||
RTM_EXPORT(rtgui_timer_create);
|
||||
RTM_EXPORT(rtgui_timer_destory);
|
||||
RTM_EXPORT(rtgui_timer_stop);
|
||||
RTM_EXPORT(rtgui_widget_focus);
|
||||
RTM_EXPORT(rtgui_widget_rect_to_device);
|
||||
RTM_EXPORT(rtgui_widget_update);
|
||||
RTM_EXPORT(rtgui_widget_get_rect);
|
||||
RTM_EXPORT(rtgui_widget_set_rect);
|
||||
RTM_EXPORT(rtgui_widget_get_toplevel);
|
||||
RTM_EXPORT(rtgui_button_create);
|
||||
RTM_EXPORT(rtgui_button_destroy);
|
||||
RTM_EXPORT(rtgui_button_set_onbutton);
|
||||
RTM_EXPORT(rtgui_container_add_child);
|
||||
RTM_EXPORT(rtgui_filelist_view_create);
|
||||
RTM_EXPORT(rtgui_filelist_view_get_fullpath);
|
||||
RTM_EXPORT(rtgui_list_view_create);
|
||||
RTM_EXPORT(rtgui_list_view_destroy);
|
||||
RTM_EXPORT(rtgui_listctrl_set_onitem);
|
||||
RTM_EXPORT(rtgui_image_create_from_mem);
|
||||
RTM_EXPORT(rtgui_listctrl_create);
|
||||
RTM_EXPORT(rtgui_listctrl_set_items);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -83,6 +83,7 @@ void rt_malloc_sethook(void (*hook)(void *ptr, rt_size_t size))
|
|||
{
|
||||
rt_malloc_hook = hook;
|
||||
}
|
||||
RTM_EXPORT(rt_malloc_sethook);
|
||||
|
||||
/**
|
||||
* This function will set a hook function, which will be invoked when a memory
|
||||
|
@ -94,6 +95,7 @@ void rt_free_sethook(void (*hook)(void *ptr))
|
|||
{
|
||||
rt_free_hook = hook;
|
||||
}
|
||||
RTM_EXPORT(rt_free_sethook);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
@ -665,6 +667,7 @@ fail:
|
|||
|
||||
return RT_NULL;
|
||||
}
|
||||
RTM_EXPORT(rt_malloc);
|
||||
|
||||
/**
|
||||
* This function will change the size of previously allocated memory block.
|
||||
|
@ -736,6 +739,7 @@ void *rt_realloc(void *ptr, rt_size_t size)
|
|||
|
||||
return RT_NULL;
|
||||
}
|
||||
RTM_EXPORT(rt_realloc);
|
||||
|
||||
/**
|
||||
* This function will contiguously allocate enough space for count objects
|
||||
|
@ -762,6 +766,7 @@ void *rt_calloc(rt_size_t count, rt_size_t size)
|
|||
|
||||
return p;
|
||||
}
|
||||
RTM_EXPORT(rt_calloc);
|
||||
|
||||
/**
|
||||
* This function will release the previously allocated memory block by rt_malloc.
|
||||
|
@ -908,6 +913,7 @@ void rt_free(void *ptr)
|
|||
/* unlock heap */
|
||||
rt_sem_release(&heap_sem);
|
||||
}
|
||||
RTM_EXPORT(rt_free);
|
||||
|
||||
#ifdef RT_MEM_STATS
|
||||
void rt_memory_info(rt_uint32_t *total, rt_uint32_t *used, rt_uint32_t *max_used)
|
||||
|
|
14
src/thread.c
14
src/thread.c
|
@ -158,6 +158,7 @@ rt_err_t rt_thread_init(struct rt_thread *thread,
|
|||
stack_start, stack_size,
|
||||
priority, tick);
|
||||
}
|
||||
RTM_EXPORT(rt_thread_init);
|
||||
|
||||
/**
|
||||
* This function will return self thread object
|
||||
|
@ -168,6 +169,7 @@ rt_thread_t rt_thread_self(void)
|
|||
{
|
||||
return rt_current_thread;
|
||||
}
|
||||
RTM_EXPORT(rt_thread_self);
|
||||
|
||||
/**
|
||||
* This function will start a thread and put it to system ready queue
|
||||
|
@ -208,6 +210,7 @@ rt_err_t rt_thread_startup(rt_thread_t thread)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_thread_startup);
|
||||
|
||||
/**
|
||||
* This function will detach a thread. The thread object will be removed from
|
||||
|
@ -250,6 +253,8 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_thread_detach);
|
||||
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/**
|
||||
|
@ -293,6 +298,7 @@ rt_thread_t rt_thread_create(const char *name,
|
|||
|
||||
return thread;
|
||||
}
|
||||
RTM_EXPORT(rt_thread_create);
|
||||
|
||||
/**
|
||||
* This function will delete a thread. The thread object will be removed from
|
||||
|
@ -329,6 +335,7 @@ rt_err_t rt_thread_delete(rt_thread_t thread)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_thread_delete);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -372,6 +379,7 @@ rt_err_t rt_thread_yield(void)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_thread_yield);
|
||||
|
||||
/**
|
||||
* This function will let current thread sleep for some ticks.
|
||||
|
@ -421,6 +429,7 @@ rt_err_t rt_thread_delay(rt_tick_t tick)
|
|||
{
|
||||
return rt_thread_sleep(tick);
|
||||
}
|
||||
RTM_EXPORT(rt_thread_delay);
|
||||
|
||||
/**
|
||||
* This function will control thread behaviors according to control command.
|
||||
|
@ -500,6 +509,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, rt_uint8_t cmd, void *arg)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_thread_control);
|
||||
|
||||
/**
|
||||
* This function will suspend the specified thread.
|
||||
|
@ -540,6 +550,7 @@ rt_err_t rt_thread_suspend(rt_thread_t thread)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_thread_suspend);
|
||||
|
||||
/**
|
||||
* This function will resume a thread and put it to system ready queue.
|
||||
|
@ -585,6 +596,7 @@ rt_err_t rt_thread_resume(rt_thread_t thread)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_thread_resume);
|
||||
|
||||
/**
|
||||
* This function is the timeout function for thread, normally which is invoked
|
||||
|
@ -614,6 +626,7 @@ void rt_thread_timeout(void *parameter)
|
|||
/* do schedule */
|
||||
rt_schedule();
|
||||
}
|
||||
RTM_EXPORT(rt_thread_timeout);
|
||||
|
||||
/**
|
||||
* This function will find the specified thread.
|
||||
|
@ -658,5 +671,6 @@ rt_thread_t rt_thread_find(char *name)
|
|||
/* not found */
|
||||
return RT_NULL;
|
||||
}
|
||||
RTM_EXPORT(rt_thread_find);
|
||||
|
||||
/*@}*/
|
||||
|
|
|
@ -120,6 +120,7 @@ void rt_timer_init(rt_timer_t timer,
|
|||
|
||||
_rt_timer_init(timer, timeout, parameter, time, flag);
|
||||
}
|
||||
RTM_EXPORT(rt_timer_init);
|
||||
|
||||
/**
|
||||
* This function will detach a timer from timer management.
|
||||
|
@ -148,6 +149,7 @@ rt_err_t rt_timer_detach(rt_timer_t timer)
|
|||
|
||||
return -RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_timer_detach);
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/**
|
||||
|
@ -177,6 +179,7 @@ rt_timer_t rt_timer_create(const char *name, void (*timeout)(void *parameter),
|
|||
|
||||
return timer;
|
||||
}
|
||||
RTM_EXPORT(rt_timer_create);
|
||||
|
||||
/**
|
||||
* This function will delete a timer and release timer memory
|
||||
|
@ -205,6 +208,7 @@ rt_err_t rt_timer_delete(rt_timer_t timer)
|
|||
|
||||
return -RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_timer_delete);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -287,6 +291,7 @@ rt_err_t rt_timer_start(rt_timer_t timer)
|
|||
|
||||
return -RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_timer_start);
|
||||
|
||||
/**
|
||||
* This function will stop the timer
|
||||
|
@ -320,6 +325,7 @@ rt_err_t rt_timer_stop(rt_timer_t timer)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_timer_stop);
|
||||
|
||||
/**
|
||||
* This function will get or set some options of the timer
|
||||
|
@ -356,6 +362,7 @@ rt_err_t rt_timer_control(rt_timer_t timer, rt_uint8_t cmd, void *arg)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
RTM_EXPORT(rt_timer_control);
|
||||
|
||||
/**
|
||||
* This function will check timer list, if a timeout event happens, the
|
||||
|
|
Loading…
Reference in New Issue