reconstruct module
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@809 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
f24c52e1b0
commit
5b0e4dc40a
|
@ -27,11 +27,8 @@ if 'RT_USING_MODBUS' in dir(rtconfig) and rtconfig.RT_USING_MODBUS:
|
||||||
if 'RT_USING_RTGUI' in dir(rtconfig) and rtconfig.RT_USING_RTGUI:
|
if 'RT_USING_RTGUI' in dir(rtconfig) and rtconfig.RT_USING_RTGUI:
|
||||||
objs = objs + SConscript('rtgui/SConscript')
|
objs = objs + SConscript('rtgui/SConscript')
|
||||||
|
|
||||||
if 'RT_USING_MODULE' in dir(rtconfig) and rtconfig.RT_USING_MODULE:
|
|
||||||
objs = objs + SConscript('module/interface/SConscript')
|
|
||||||
|
|
||||||
# build each modules
|
# build each modules
|
||||||
if rtconfig.CROSS_TOOL == 'gcc':
|
if rtconfig.CROSS_TOOL == 'gcc':
|
||||||
SConscript('module/examples/application/basicapp/SConscript')
|
SConscript('module/basicapp/SConscript')
|
||||||
|
|
||||||
Return('objs')
|
Return('objs')
|
||||||
|
|
|
@ -8,7 +8,7 @@ group = {}
|
||||||
group['name'] = 'examples'
|
group['name'] = 'examples'
|
||||||
group['src'] = Glob('*.c')
|
group['src'] = Glob('*.c')
|
||||||
group['CCFLAGS'] = ''
|
group['CCFLAGS'] = ''
|
||||||
group['CPPPATH'] = [RTT_ROOT + '/components/module/interface']
|
group['CPPPATH'] = ['']
|
||||||
group['CPPDEFINES'] = ''
|
group['CPPDEFINES'] = ''
|
||||||
|
|
||||||
target = 'basicapp.mo'
|
target = 'basicapp.mo'
|
||||||
|
@ -20,7 +20,9 @@ env.Append(CCFLAGS = group['CCFLAGS'])
|
||||||
env.Append(CPPPATH = group['CPPPATH'])
|
env.Append(CPPPATH = group['CPPPATH'])
|
||||||
env.Append(CPPDEFINES = group['CPPDEFINES'])
|
env.Append(CPPDEFINES = group['CPPDEFINES'])
|
||||||
module_env = env.Clone(CPPDEFINE = 'RT_MODULE')
|
module_env = env.Clone(CPPDEFINE = 'RT_MODULE')
|
||||||
module_env.Replace(LINKFLAGS = ' -mcpu=arm920t -r -d -e rt_module_entry -nostdlib -s')
|
module_env = env.Clone(CCFLAGS = ' -mcpu=arm920t -O0 -fPIC')
|
||||||
|
module_env.Replace(LINK = 'arm-none-eabi-ld')
|
||||||
|
module_env.Replace(LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e rt_application_entry -nostdlib -s')
|
||||||
|
|
||||||
src_local = Glob('*.c')
|
src_local = Glob('*.c')
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include <interface_help.h>
|
|
||||||
|
|
||||||
int a = 0;
|
int a = 0;
|
||||||
int b = 1000000;
|
int b = 1000000;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
void function(int count1, int count2, int count3)
|
static void function(int count1, int count2, int count3)
|
||||||
{
|
{
|
||||||
rt_kprintf("Hello RT-Thread %d %d\n", count1, count2, count3);
|
rt_kprintf("Hello RT-Thread %d %d\n", count1, count2, count3);
|
||||||
}
|
}
|
||||||
|
@ -13,12 +12,13 @@ void function(int count1, int count2, int count3)
|
||||||
int rt_application_entry(void)
|
int rt_application_entry(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<1000; i++)
|
rt_kprintf("application entry\n");
|
||||||
|
for(i=0; i<100; i++)
|
||||||
{
|
{
|
||||||
a++;
|
a++;
|
||||||
b--;
|
b--;
|
||||||
c++;
|
c++;
|
||||||
function(a, b, c);
|
function(a, c, b );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
|
@ -1,24 +0,0 @@
|
||||||
#include <rtthread.h>
|
|
||||||
#include <interface_help.h>
|
|
||||||
|
|
||||||
extern int rt_application_entry(void);
|
|
||||||
rt_shell_t ishell = RT_NULL;
|
|
||||||
|
|
||||||
int rt_module_entry(const void* shell, void** object_info)
|
|
||||||
{
|
|
||||||
/* init shell */
|
|
||||||
ishell = (rt_shell_t)shell;
|
|
||||||
|
|
||||||
rt_kprintf("module entry\n");
|
|
||||||
struct rt_module_info *info = (struct rt_module_info*)
|
|
||||||
rt_malloc(sizeof(struct rt_module_info));
|
|
||||||
|
|
||||||
info->module_refs = 0;
|
|
||||||
info->module_type = RT_Module_Class_APP;
|
|
||||||
info->module_guid = 0xdead;
|
|
||||||
info->exec_entry = (void *)rt_application_entry;
|
|
||||||
info->module_interface = RT_NULL;
|
|
||||||
|
|
||||||
*object_info = info;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
Import('env')
|
|
||||||
Import('projects')
|
|
||||||
Import('RTT_ROOT')
|
|
||||||
Import('rtconfig')
|
|
||||||
|
|
||||||
# group definitions
|
|
||||||
group = {}
|
|
||||||
group['name'] = 'module'
|
|
||||||
group['src'] = Glob('src/*.c')
|
|
||||||
group['CCFLAGS'] = ''
|
|
||||||
group['CPPPATH'] = [RTT_ROOT + '/components/module/interface/include']
|
|
||||||
group['CPPDEFINES'] = ''
|
|
||||||
|
|
||||||
# add group to project list
|
|
||||||
projects.append(group)
|
|
||||||
|
|
||||||
env.Append(CCFLAGS = group['CCFLAGS'])
|
|
||||||
env.Append(CPPPATH = group['CPPPATH'])
|
|
||||||
env.Append(CPPDEFINES = group['CPPDEFINES'])
|
|
||||||
|
|
||||||
objs = env.Object(group['src'])
|
|
||||||
|
|
||||||
Return('objs')
|
|
|
@ -1,124 +0,0 @@
|
||||||
#include <rtdef.h>
|
|
||||||
#include <interface_kernel.h>
|
|
||||||
|
|
||||||
extern rt_shell_t ishell;
|
|
||||||
#define SHELL() ishell
|
|
||||||
|
|
||||||
#define IKSERVICE() (SHELL()->i_kservice)
|
|
||||||
#define ITHREAD() (SHELL()->i_thread)
|
|
||||||
#define ISEM() (SHELL()->i_sem)
|
|
||||||
#define IMUTEX() (SHELL()->i_mutex)
|
|
||||||
#define IEVENT() (SHELL()->i_event)
|
|
||||||
#define IMB() (SHELL()->i_mb)
|
|
||||||
#define IMQ() (SHELL()->i_mq)
|
|
||||||
#define IMP() (SHELL()->i_mp)
|
|
||||||
#define IHEAP() (SHELL()->i_heap)
|
|
||||||
#define IDEVICE() (SHELL()->i_device)
|
|
||||||
#define ITIMER() (SHELL()->i_timer)
|
|
||||||
|
|
||||||
/* kernel service */
|
|
||||||
#define rt_kprintf IKSERVICE()->rt_kprintf
|
|
||||||
|
|
||||||
/* thread */
|
|
||||||
#define rt_thread_init ITHREAD()->rt_thread_init
|
|
||||||
#define rt_thread_create ITHREAD()->rt_thread_create
|
|
||||||
#define rt_thread_detach ITHREAD()->rt_thread_detach
|
|
||||||
#define rt_thread_find ITHREAD()->rt_thread_find
|
|
||||||
#define rt_thread_self ITHREAD()->rt_thread_self
|
|
||||||
#define rt_thread_startup ITHREAD()->rt_thread_startup
|
|
||||||
#define rt_thread_delete ITHREAD()->rt_thread_delete
|
|
||||||
#define rt_thread_yield ITHREAD()->rt_thread_yield
|
|
||||||
#define rt_thread_delay ITHREAD()->rt_thread_delay
|
|
||||||
#define rt_thread_control ITHREAD()->rt_thread_control
|
|
||||||
#define rt_thread_suspend ITHREAD()->rt_thread_suspend
|
|
||||||
#define rt_thread_resume ITHREAD()->rt_thread_resume
|
|
||||||
#define rt_thread_timeout ITHREAD()->rt_thread_timeout
|
|
||||||
|
|
||||||
/* semaphore */
|
|
||||||
#define rt_sem_init ISEM()->rt_sem_init
|
|
||||||
#define rt_sem_detach ISEM()->rt_sem_detach
|
|
||||||
#define rt_sem_create ISEM()->rt_sem_create
|
|
||||||
#define rt_sem_delete ISEM()->rt_sem_delete
|
|
||||||
#define rt_sem_take ISEM()->rt_sem_take
|
|
||||||
#define rt_sem_trytake ISEM()->rt_sem_trytake
|
|
||||||
#define rt_sem_release ISEM()->rt_sem_release
|
|
||||||
#define rt_sem_control ISEM()->rt_sem_control
|
|
||||||
|
|
||||||
/* mutex */
|
|
||||||
#define rt_mutex_init IMUTEX()->rt_mutex_init
|
|
||||||
#define rt_mutex_detach IMUTEX()->rt_mutex_detach
|
|
||||||
#define rt_mutex_create IMUTEX()->rt_mutex_create
|
|
||||||
#define rt_mutex_delete IMUTEX()->rt_mutex_delete
|
|
||||||
#define rt_mutex_take IMUTEX()->rt_mutex_take
|
|
||||||
#define rt_mutex_trytake IMUTEX()->rt_mutex_trytake
|
|
||||||
#define rt_mutex_release IMUTEX()->rt_mutex_release
|
|
||||||
#define rt_mutex_control IMUTEX()->rt_mutex_control
|
|
||||||
|
|
||||||
/* event */
|
|
||||||
#define rt_event_init IEVENT()->rt_event_init
|
|
||||||
#define rt_event_detach IEVENT()->rt_event_detach
|
|
||||||
#define rt_event_create IEVENT()->rt_event_create
|
|
||||||
#define rt_event_delete IEVENT()->rt_event_delete
|
|
||||||
#define rt_event_send IEVENT()->rt_event_send
|
|
||||||
#define rt_event_recv IEVENT()->rt_event_recv
|
|
||||||
#define rt_event_control IEVENT()->rt_event_control
|
|
||||||
|
|
||||||
/* mailbox */
|
|
||||||
#define rt_mb_init IMB()->rt_mb_init
|
|
||||||
#define rt_mb_detach IMB()->rt_mb_detach
|
|
||||||
#define rt_mb_create IMB()->rt_mb_create
|
|
||||||
#define rt_mb_delete IMB()->rt_mb_delete
|
|
||||||
#define rt_mb_send IMB()->rt_mb_send
|
|
||||||
#define rt_mb_recv IMB()->rt_mb_recv
|
|
||||||
#define rt_mb_control IMB()->rt_mb_control
|
|
||||||
|
|
||||||
/* message queue interface */
|
|
||||||
#define rt_mq_init IMQ()->rt_mq_init
|
|
||||||
#define rt_mq_detach IMQ()->rt_mq_detach
|
|
||||||
#define rt_mq_create IMQ()->rt_mq_create
|
|
||||||
#define rt_mq_delete IMQ()->rt_mq_delete
|
|
||||||
#define rt_mq_send IMQ()->rt_mq_send
|
|
||||||
#define rt_mq_urgent IMQ()->rt_mq_urgent
|
|
||||||
#define rt_mq_recv IMQ()->rt_mq_recv
|
|
||||||
#define rt_mq_control IMQ()->rt_mq_control
|
|
||||||
|
|
||||||
/* memory pool */
|
|
||||||
#define rt_mp_init IMP()->rt_mp_init
|
|
||||||
#define rt_mp_detach IMP()->rt_mp_detach
|
|
||||||
#define rt_mp_create IMP()->rt_mp_create
|
|
||||||
#define rt_mp_delete IMP()->rt_mp_delete
|
|
||||||
#define rt_mp_alloc IMP()->rt_mp_alloc
|
|
||||||
#define rt_mp_free IMP()->rt_mp_free
|
|
||||||
|
|
||||||
/* heap memory */
|
|
||||||
#define rt_malloc IHEAP()->rt_malloc
|
|
||||||
#define rt_free IHEAP()->rt_free
|
|
||||||
#define rt_realloc IHEAP()->rt_realloc
|
|
||||||
#define rt_calloc IHEAP()->rt_calloc
|
|
||||||
|
|
||||||
/* device */
|
|
||||||
#define rt_device_register IDEVICE()->rt_device_register
|
|
||||||
#define rt_device_unregister IDEVICE()->rt_device_unregister
|
|
||||||
#define rt_device_init_all IDEVICE()->rt_device_init_all
|
|
||||||
#define rt_device_find IDEVICE()->rt_device_find
|
|
||||||
#define rt_device_init IDEVICE()->rt_device_init
|
|
||||||
#define rt_device_open IDEVICE()->rt_device_open
|
|
||||||
#define rt_device_close IDEVICE()->rt_device_close
|
|
||||||
#define rt_device_read IDEVICE()->rt_device_read
|
|
||||||
#define rt_device_write IDEVICE()->rt_device_write
|
|
||||||
#define rt_device_control IDEVICE()->rt_device_control
|
|
||||||
#define rt_device_set_rx_indicate IDEVICE()->rt_device_set_rx_indicate
|
|
||||||
#define rt_device_set_tx_complete IDEVICE()->rt_device_set_tx_complete
|
|
||||||
|
|
||||||
/* timer */
|
|
||||||
#define rt_tick_get ITIMER()->rt_tick_get
|
|
||||||
#define rt_system_timer_init ITIMER()->rt_system_timer_init
|
|
||||||
#define rt_timer_init ITIMER()->rt_timer_init
|
|
||||||
#define rt_timer_detach ITIMER()->rt_timer_detach
|
|
||||||
#define rt_timer_create ITIMER()->rt_timer_create
|
|
||||||
#define rt_timer_delete ITIMER()->rt_timer_delete
|
|
||||||
#define rt_timer_start ITIMER()->rt_timer_start
|
|
||||||
#define rt_timer_stop ITIMER()->rt_timer_stop
|
|
||||||
#define rt_timer_control ITIMER()->rt_timer_control
|
|
||||||
#define rt_tick_from_millisecond ITIMER()->rt_tick_from_millisecond
|
|
||||||
#define rt_system_timer_thread_init ITIMER()->rt_system_timer_thread_init
|
|
|
@ -1,244 +0,0 @@
|
||||||
#include <rtdef.h>
|
|
||||||
#include <rtthread.h>
|
|
||||||
|
|
||||||
/* RT-Thread kernel component guid */
|
|
||||||
#define RTTHREAD_GUID_KERNEL 1000
|
|
||||||
#define RTTHREAD_GUID_KSERVICE RTTHREAD_GUID_KERNEL
|
|
||||||
#define RTTHREAD_GUID_THREAD (RTTHREAD_GUID_KERNEL + 1)
|
|
||||||
#define RTTHREAD_GUID_SEMAPHORE (RTTHREAD_GUID_KERNEL + 2)
|
|
||||||
#define RTTHREAD_GUID_MUTEX (RTTHREAD_GUID_KERNEL + 3)
|
|
||||||
#define RTTHREAD_GUID_MAILBOX (RTTHREAD_GUID_KERNEL + 4)
|
|
||||||
#define RTTHREAD_GUID_MESSAGEQUEUE (RTTHREAD_GUID_KERNEL + 5)
|
|
||||||
#define RTTHREAD_GUID_MEMPOOL (RTTHREAD_GUID_KERNEL + 6)
|
|
||||||
#define RTTHREAD_GUID_DEVICE (RTTHREAD_GUID_KERNEL + 7)
|
|
||||||
#define RTTHREAD_GUID_TIMER (RTTHREAD_GUID_KERNEL + 8)
|
|
||||||
|
|
||||||
/* file system component guid */
|
|
||||||
#define RTTHREAD_GUID_FILESYSTEM 2000
|
|
||||||
/* net component guid */
|
|
||||||
#define RTTHREAD_GUID_NET 3000
|
|
||||||
/* gui component guid */
|
|
||||||
#define RTTHREAD_GUID_GUI 4000
|
|
||||||
/* application guid */
|
|
||||||
#define RTTHREAD_GUID_APP_START 10000
|
|
||||||
/* service guid */
|
|
||||||
#define RTTHREAD_GUID_SEVICE_START 20000
|
|
||||||
|
|
||||||
/*
|
|
||||||
* kservice interface
|
|
||||||
*/
|
|
||||||
struct rt_kservice_interface
|
|
||||||
{
|
|
||||||
void (*rt_kprintf)(const char *fmt, ...);
|
|
||||||
};
|
|
||||||
typedef struct rt_kservice_interface* rt_kservice_interface_t;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* thread interface
|
|
||||||
*/
|
|
||||||
struct rt_thread_interface
|
|
||||||
{
|
|
||||||
rt_err_t (*rt_thread_init)(struct rt_thread* thread,
|
|
||||||
const char* name,
|
|
||||||
void (*entry)(void* parameter), void* parameter,
|
|
||||||
void* stack_start, rt_uint32_t stack_size,
|
|
||||||
rt_uint8_t priority, rt_uint32_t tick);
|
|
||||||
rt_err_t (*rt_thread_detach)(rt_thread_t thread);
|
|
||||||
rt_thread_t (*rt_thread_create)(const char* name,
|
|
||||||
void (*entry)(void* parameter), void* parameter,
|
|
||||||
rt_uint32_t stack_size,
|
|
||||||
rt_uint8_t priority,
|
|
||||||
rt_uint32_t tick);
|
|
||||||
rt_thread_t (*rt_thread_self)(void);
|
|
||||||
rt_thread_t (*rt_thread_find)(char* name);
|
|
||||||
rt_err_t (*rt_thread_startup)(rt_thread_t thread);
|
|
||||||
rt_err_t (*rt_thread_delete)(rt_thread_t thread);
|
|
||||||
rt_err_t (*rt_thread_yield)(void);
|
|
||||||
rt_err_t (*rt_thread_delay)(rt_tick_t tick);
|
|
||||||
rt_err_t (*rt_thread_control)(rt_thread_t thread, rt_uint8_t cmd, void* arg);
|
|
||||||
rt_err_t (*rt_thread_suspend)(rt_thread_t thread);
|
|
||||||
rt_err_t (*rt_thread_resume)(rt_thread_t thread);
|
|
||||||
void (*rt_thread_timeout)(void* parameter);
|
|
||||||
};
|
|
||||||
typedef struct rt_thread_interface* rt_thread_interface_t;
|
|
||||||
|
|
||||||
#ifdef RT_USING_SEMAPHORE
|
|
||||||
/*
|
|
||||||
* semaphore interface
|
|
||||||
*/
|
|
||||||
struct rt_sem_interface
|
|
||||||
{
|
|
||||||
rt_err_t (*rt_sem_init)(rt_sem_t sem, const char* name, rt_uint32_t value, rt_uint8_t flag);
|
|
||||||
rt_err_t (*rt_sem_detach)(rt_sem_t sem);
|
|
||||||
rt_sem_t (*rt_sem_create)(const char* name, rt_uint32_t value, rt_uint8_t flag);
|
|
||||||
rt_err_t (*rt_sem_delete)(rt_sem_t sem);
|
|
||||||
rt_err_t (*rt_sem_take)(rt_sem_t sem, rt_int32_t time);
|
|
||||||
rt_err_t (*rt_sem_trytake)(rt_sem_t sem);
|
|
||||||
rt_err_t (*rt_sem_release)(rt_sem_t sem);
|
|
||||||
rt_err_t (*rt_sem_control)(rt_sem_t sem, rt_uint8_t cmd, void* arg);
|
|
||||||
};
|
|
||||||
typedef struct rt_sem_interface* rt_sem_interface_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_MUTEX
|
|
||||||
/*
|
|
||||||
* mutex interface
|
|
||||||
*/
|
|
||||||
struct rt_mutex_interface
|
|
||||||
{
|
|
||||||
rt_err_t (*rt_mutex_init) (rt_mutex_t mutex, const char* name, rt_uint8_t flag);
|
|
||||||
rt_err_t (*rt_mutex_detach)(rt_mutex_t mutex);
|
|
||||||
rt_mutex_t (*rt_mutex_create)(const char* name, rt_uint8_t flag);
|
|
||||||
rt_err_t (*rt_mutex_delete)(rt_mutex_t mutex);
|
|
||||||
rt_err_t (*rt_mutex_take)(rt_mutex_t mutex, rt_int32_t time);
|
|
||||||
rt_err_t (*rt_mutex_release)(rt_mutex_t mutex);
|
|
||||||
rt_err_t (*rt_mutex_control)(rt_mutex_t mutex, rt_uint8_t cmd, void* arg);
|
|
||||||
};
|
|
||||||
typedef struct rt_mutex_interface* rt_mutex_interface_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_EVENT
|
|
||||||
/*
|
|
||||||
* event interface
|
|
||||||
*/
|
|
||||||
struct rt_event_interface
|
|
||||||
{
|
|
||||||
rt_err_t (*rt_event_init)(rt_event_t event, const char* name, rt_uint8_t flag);
|
|
||||||
rt_err_t (*rt_event_detach)(rt_event_t event);
|
|
||||||
rt_event_t (*rt_event_create)(const char* name, rt_uint8_t flag);
|
|
||||||
rt_err_t (*rt_event_delete)(rt_event_t event);
|
|
||||||
rt_err_t (*rt_event_send)(rt_event_t event, rt_uint32_t set);
|
|
||||||
rt_err_t (*rt_event_recv)(rt_event_t event, rt_uint32_t set, rt_uint8_t option, rt_int32_t timeout, rt_uint32_t* recved);
|
|
||||||
rt_err_t (*rt_event_control)(rt_event_t event, rt_uint8_t cmd, void* arg);
|
|
||||||
};
|
|
||||||
typedef struct rt_event_interface* rt_event_interface_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_MAILBOX
|
|
||||||
/*
|
|
||||||
* mailbox interface
|
|
||||||
*/
|
|
||||||
struct rt_mb_interface
|
|
||||||
{
|
|
||||||
rt_err_t (*rt_mb_init)(rt_mailbox_t mb, const char* name, void* msgpool, rt_size_t size, rt_uint8_t flag);
|
|
||||||
rt_err_t (*rt_mb_detach)(rt_mailbox_t mb);
|
|
||||||
rt_mailbox_t (*rt_mb_create)(const char* name, rt_size_t size, rt_uint8_t flag);
|
|
||||||
rt_err_t (*rt_mb_delete)(rt_mailbox_t mb);
|
|
||||||
rt_err_t (*rt_mb_send)(rt_mailbox_t mb, rt_uint32_t value);
|
|
||||||
rt_err_t (*rt_mb_recv)(rt_mailbox_t mb, rt_uint32_t* value, rt_int32_t timeout);
|
|
||||||
rt_err_t (*rt_mb_control)(rt_mailbox_t mb, rt_uint8_t cmd, void* arg);
|
|
||||||
};
|
|
||||||
typedef struct rt_mb_interface* rt_mb_interface_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_MESSAGEQUEUE
|
|
||||||
/*
|
|
||||||
* message queue interface
|
|
||||||
*/
|
|
||||||
struct rt_mq_interface
|
|
||||||
{
|
|
||||||
rt_err_t (*rt_mq_init)(rt_mq_t mq, const char* name, void *msgpool, rt_size_t msg_size, rt_size_t pool_size, rt_uint8_t flag);
|
|
||||||
rt_err_t (*rt_mq_detach)(rt_mq_t mq);
|
|
||||||
rt_mq_t (*rt_mq_create)(const char* name, rt_size_t msg_size, rt_size_t max_msgs, rt_uint8_t flag);
|
|
||||||
rt_err_t (*rt_mq_delete)(rt_mq_t mq);
|
|
||||||
rt_err_t (*rt_mq_send)(rt_mq_t mq, void* buffer, rt_size_t size);
|
|
||||||
rt_err_t (*rt_mq_urgent)(rt_mq_t mq, void* buffer, rt_size_t size);
|
|
||||||
rt_err_t (*rt_mq_recv)(rt_mq_t mq, void* buffer, rt_size_t size, rt_int32_t timeout);
|
|
||||||
rt_err_t (*rt_mq_control)(rt_mq_t mq, rt_uint8_t cmd, void* arg);
|
|
||||||
};
|
|
||||||
typedef struct rt_mq_interface* rt_mq_interface_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_MEMPOOL
|
|
||||||
/*
|
|
||||||
* memory pool interface
|
|
||||||
*/
|
|
||||||
struct rt_mp_interface
|
|
||||||
{
|
|
||||||
rt_err_t (*rt_mp_init)(struct rt_mempool* mp, const char* name, void *start, rt_size_t size, rt_size_t block_size);
|
|
||||||
rt_err_t (*rt_mp_detach)(struct rt_mempool* mp);
|
|
||||||
rt_mp_t (*rt_mp_create)(const char* name, rt_size_t block_count, rt_size_t block_size);
|
|
||||||
rt_err_t (*rt_mp_delete)(rt_mp_t mp);
|
|
||||||
void* (*rt_mp_alloc)(rt_mp_t mp, rt_int32_t time);
|
|
||||||
void (*rt_mp_free)(void *block);
|
|
||||||
};
|
|
||||||
typedef struct rt_mp_interface* rt_mp_interface_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_HEAP
|
|
||||||
/*
|
|
||||||
* heap memory interface
|
|
||||||
*/
|
|
||||||
struct rt_heap_interface
|
|
||||||
{
|
|
||||||
void* (*rt_malloc)(rt_size_t size);
|
|
||||||
void (*rt_free)(void *ptr);
|
|
||||||
void* (*rt_realloc)(void *ptr, rt_size_t size);
|
|
||||||
void* (*rt_calloc)(rt_size_t count, rt_size_t size);
|
|
||||||
};
|
|
||||||
typedef struct rt_heap_interface* rt_heap_interface_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_DEVICE
|
|
||||||
/*
|
|
||||||
* device interface
|
|
||||||
*/
|
|
||||||
struct rt_device_interface
|
|
||||||
{
|
|
||||||
rt_err_t (*rt_device_register)(rt_device_t dev, const char* name, rt_uint16_t flags);
|
|
||||||
rt_err_t (*rt_device_unregister)(rt_device_t dev);
|
|
||||||
rt_err_t (*rt_device_init_all)(void);
|
|
||||||
rt_device_t (*rt_device_find)(const char* name);
|
|
||||||
rt_err_t (*rt_device_init)(rt_device_t dev);
|
|
||||||
rt_err_t (*rt_device_open)(rt_device_t dev, rt_uint16_t oflag);
|
|
||||||
rt_err_t (*rt_device_close)(rt_device_t dev);
|
|
||||||
rt_size_t (*rt_device_read)(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size);
|
|
||||||
rt_size_t (*rt_device_write)(rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size);
|
|
||||||
rt_err_t (*rt_device_control)(rt_device_t dev, rt_uint8_t cmd, void* arg);
|
|
||||||
rt_err_t (*rt_device_set_rx_indicate)(rt_device_t dev, rt_err_t (*rx_ind )(rt_device_t dev, rt_size_t size));
|
|
||||||
rt_err_t (*rt_device_set_tx_complete)(rt_device_t dev, rt_err_t (*tx_done)(rt_device_t dev, void *buffer));
|
|
||||||
};
|
|
||||||
typedef struct rt_device_interface* rt_device_interface_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* clock & timer interface
|
|
||||||
*/
|
|
||||||
struct rt_timer_interface
|
|
||||||
{
|
|
||||||
rt_tick_t (*rt_tick_get)(void);
|
|
||||||
rt_tick_t (*rt_tick_from_millisecond)(rt_uint32_t ms);
|
|
||||||
void (*rt_system_timer_init)(void);
|
|
||||||
void (*rt_system_timer_thread_init)(void);
|
|
||||||
void (*rt_timer_init)(rt_timer_t timer,
|
|
||||||
const char* name,
|
|
||||||
void (*timeout)(void* parameter), void* parameter,
|
|
||||||
rt_tick_t time, rt_uint8_t flag);
|
|
||||||
rt_err_t (*rt_timer_detach)(rt_timer_t timer);
|
|
||||||
rt_timer_t (*rt_timer_create)(const char* name, void (*timeout)(void* parameter), void* parameter, rt_tick_t time, rt_uint8_t flag);
|
|
||||||
rt_err_t (*rt_timer_delete)(rt_timer_t timer);
|
|
||||||
rt_err_t (*rt_timer_start)(rt_timer_t timer);
|
|
||||||
rt_err_t (*rt_timer_stop)(rt_timer_t timer);
|
|
||||||
rt_err_t (*rt_timer_control)(rt_timer_t timer, rt_uint8_t cmd, void* arg);
|
|
||||||
};
|
|
||||||
typedef struct rt_timer_interface* rt_timer_interface_t;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* kernel interface
|
|
||||||
*/
|
|
||||||
struct rt_shell
|
|
||||||
{
|
|
||||||
const rt_kservice_interface_t i_kservice;
|
|
||||||
const rt_thread_interface_t i_thread;
|
|
||||||
const rt_sem_interface_t i_sem;
|
|
||||||
const rt_mutex_interface_t i_mutex;
|
|
||||||
const rt_event_interface_t i_event;
|
|
||||||
const rt_mb_interface_t i_mb;
|
|
||||||
const rt_mq_interface_t i_mq;
|
|
||||||
const rt_mp_interface_t i_mp;
|
|
||||||
const rt_heap_interface_t i_heap;
|
|
||||||
const rt_device_interface_t i_device;
|
|
||||||
const rt_timer_interface_t i_timer;
|
|
||||||
};
|
|
||||||
typedef struct rt_shell* rt_shell_t;
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Imodule
|
|
|
@ -1,195 +0,0 @@
|
||||||
#include <interface_kernel.h>
|
|
||||||
|
|
||||||
const struct rt_kservice_interface ikservice =
|
|
||||||
{
|
|
||||||
rt_kprintf
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* thread interface
|
|
||||||
*/
|
|
||||||
const struct rt_thread_interface ithread =
|
|
||||||
{
|
|
||||||
rt_thread_init,
|
|
||||||
rt_thread_detach,
|
|
||||||
rt_thread_create,
|
|
||||||
rt_thread_self,
|
|
||||||
rt_thread_find,
|
|
||||||
rt_thread_startup,
|
|
||||||
rt_thread_delete,
|
|
||||||
rt_thread_yield,
|
|
||||||
rt_thread_delay,
|
|
||||||
rt_thread_control,
|
|
||||||
rt_thread_suspend,
|
|
||||||
rt_thread_resume,
|
|
||||||
rt_thread_timeout
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef RT_USING_SEMAPHORE
|
|
||||||
/*
|
|
||||||
* semaphore interface
|
|
||||||
*/
|
|
||||||
const struct rt_sem_interface isem =
|
|
||||||
{
|
|
||||||
rt_sem_init,
|
|
||||||
rt_sem_detach,
|
|
||||||
rt_sem_create,
|
|
||||||
rt_sem_delete,
|
|
||||||
rt_sem_take,
|
|
||||||
rt_sem_trytake,
|
|
||||||
rt_sem_release,
|
|
||||||
rt_sem_control
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_MUTEX
|
|
||||||
/*
|
|
||||||
* mutex interface
|
|
||||||
*/
|
|
||||||
const struct rt_mutex_interface imutex =
|
|
||||||
{
|
|
||||||
rt_mutex_init,
|
|
||||||
rt_mutex_detach,
|
|
||||||
rt_mutex_create,
|
|
||||||
rt_mutex_delete,
|
|
||||||
rt_mutex_take,
|
|
||||||
rt_mutex_release,
|
|
||||||
rt_mutex_control
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_EVENT
|
|
||||||
/*
|
|
||||||
* event interface
|
|
||||||
*/
|
|
||||||
const struct rt_event_interface ievent =
|
|
||||||
{
|
|
||||||
rt_event_init,
|
|
||||||
rt_event_detach,
|
|
||||||
rt_event_create,
|
|
||||||
rt_event_delete,
|
|
||||||
rt_event_send,
|
|
||||||
rt_event_recv,
|
|
||||||
rt_event_control
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_MAILBOX
|
|
||||||
/*
|
|
||||||
* mailbox interface
|
|
||||||
*/
|
|
||||||
const struct rt_mb_interface imb =
|
|
||||||
{
|
|
||||||
rt_mb_init,
|
|
||||||
rt_mb_detach,
|
|
||||||
rt_mb_create,
|
|
||||||
rt_mb_delete,
|
|
||||||
rt_mb_send,
|
|
||||||
rt_mb_recv,
|
|
||||||
rt_mb_control
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_MESSAGEQUEUE
|
|
||||||
/*
|
|
||||||
* message queue interface
|
|
||||||
*/
|
|
||||||
const struct rt_mq_interface imq =
|
|
||||||
{
|
|
||||||
rt_mq_init,
|
|
||||||
rt_mq_detach,
|
|
||||||
rt_mq_create,
|
|
||||||
rt_mq_delete,
|
|
||||||
rt_mq_send,
|
|
||||||
rt_mq_urgent,
|
|
||||||
rt_mq_recv,
|
|
||||||
rt_mq_control
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_MEMPOOL
|
|
||||||
/*
|
|
||||||
* memory pool interface
|
|
||||||
*/
|
|
||||||
const struct rt_mp_interface imp =
|
|
||||||
{
|
|
||||||
rt_mp_init,
|
|
||||||
rt_mp_detach,
|
|
||||||
rt_mp_create,
|
|
||||||
rt_mp_delete,
|
|
||||||
rt_mp_alloc,
|
|
||||||
rt_mp_free
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_HEAP
|
|
||||||
/*
|
|
||||||
* heap memory interface
|
|
||||||
*/
|
|
||||||
const struct rt_heap_interface iheap =
|
|
||||||
{
|
|
||||||
rt_malloc,
|
|
||||||
rt_free,
|
|
||||||
rt_realloc,
|
|
||||||
rt_calloc
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RT_USING_DEVICE
|
|
||||||
/*
|
|
||||||
* device interface
|
|
||||||
*/
|
|
||||||
const struct rt_device_interface idevice =
|
|
||||||
{
|
|
||||||
rt_device_register,
|
|
||||||
rt_device_unregister,
|
|
||||||
rt_device_init_all,
|
|
||||||
rt_device_find,
|
|
||||||
rt_device_init,
|
|
||||||
rt_device_open,
|
|
||||||
rt_device_close,
|
|
||||||
rt_device_read,
|
|
||||||
rt_device_write,
|
|
||||||
rt_device_control,
|
|
||||||
rt_device_set_rx_indicate,
|
|
||||||
rt_device_set_tx_complete
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* clock & timer interface
|
|
||||||
*/
|
|
||||||
const struct rt_timer_interface itimer =
|
|
||||||
{
|
|
||||||
rt_tick_get,
|
|
||||||
rt_tick_from_millisecond,
|
|
||||||
rt_system_timer_init,
|
|
||||||
rt_system_timer_thread_init,
|
|
||||||
rt_timer_init,
|
|
||||||
rt_timer_detach,
|
|
||||||
rt_timer_create,
|
|
||||||
rt_timer_delete,
|
|
||||||
rt_timer_start,
|
|
||||||
rt_timer_stop,
|
|
||||||
rt_timer_control
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* kernel interface
|
|
||||||
*/
|
|
||||||
const struct rt_shell ishell =
|
|
||||||
{
|
|
||||||
(const rt_kservice_interface_t )&ikservice,
|
|
||||||
(const rt_thread_interface_t )&ithread,
|
|
||||||
(const rt_sem_interface_t )&isem,
|
|
||||||
(const rt_mutex_interface_t )&imutex,
|
|
||||||
(const rt_event_interface_t )&ievent,
|
|
||||||
(const rt_mb_interface_t )&imb,
|
|
||||||
(const rt_mq_interface_t )&imq,
|
|
||||||
(const rt_mp_interface_t )&imp,
|
|
||||||
(const rt_heap_interface_t )&iheap,
|
|
||||||
(const rt_device_interface_t )&idevice,
|
|
||||||
(const rt_timer_interface_t )&itimer,
|
|
||||||
};
|
|
||||||
|
|
Loading…
Reference in New Issue