change the wrong end of line (all of them shall be UNIX end of line).

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1445 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2011-06-02 04:42:57 +00:00
parent c2276d1719
commit 3ea3d509ef
5 changed files with 488 additions and 488 deletions

View File

@ -1,8 +1,8 @@
Import('RTT_ROOT')
from building import *
src = Glob('*.c')
CPPPATH = [RTT_ROOT + '/include']
group = DefineGroup('Kernel', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
Import('RTT_ROOT')
from building import *
src = Glob('*.c')
CPPPATH = [RTT_ROOT + '/include']
group = DefineGroup('Kernel', src, depend = [''], CPPPATH = CPPPATH)
Return('group')

View File

@ -453,10 +453,10 @@ rt_err_t rt_sem_control(rt_sem_t sem, rt_uint8_t cmd, void* arg)
RT_ASSERT(sem != RT_NULL);
if (cmd == RT_IPC_CMD_RESET)
{
rt_uint32_t value;
/* get value */
{
rt_uint32_t value;
/* get value */
value = (rt_uint32_t)arg;
/* disable interrupt */
level = rt_hw_interrupt_disable();

View File

@ -1,216 +1,216 @@
#ifndef __MODULE_H__
#define __MODULE_H__
#include <rtdef.h>
typedef rt_uint8_t Elf_Byte;
typedef rt_uint32_t Elf32_Addr; /* Unsigned program address */
typedef rt_uint32_t Elf32_Off; /* Unsigned file offset */
typedef rt_int32_t Elf32_Sword; /* Signed large integer */
typedef rt_uint32_t Elf32_Word; /* Unsigned large integer */
typedef rt_uint16_t Elf32_Half; /* Unsigned medium integer */
/* e_ident[] magic number */
#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */
#define ELFMAG1 'E' /* e_ident[EI_MAG1] */
#define ELFMAG2 'L' /* e_ident[EI_MAG2] */
#define ELFMAG3 'F' /* e_ident[EI_MAG3] */
#define RTMMAG "\177RTM" /* magic */
#define ELFMAG "\177ELF" /* magic */
#define SELFMAG 4 /* size of magic */
#define EI_CLASS 4 /* file class */
#define EI_NIDENT 16 /* Size of e_ident[] */
/* e_ident[] file class */
#define ELFCLASSNONE 0 /* invalid */
#define ELFCLASS32 1 /* 32-bit objs */
#define ELFCLASS64 2 /* 64-bit objs */
#define ELFCLASSNUM 3 /* number of classes */
/* e_ident[] data encoding */
#define ELFDATANONE 0 /* invalid */
#define ELFDATA2LSB 1 /* Little-Endian */
#define ELFDATA2MSB 2 /* Big-Endian */
#define ELFDATANUM 3 /* number of data encode defines */
/* e_ident */
#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
(ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
(ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
(ehdr).e_ident[EI_MAG3] == ELFMAG3)
/* ELF Header */
typedef struct elfhdr {
unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
Elf32_Half e_type; /* object file type */
Elf32_Half e_machine; /* machine */
Elf32_Word e_version; /* object file version */
Elf32_Addr e_entry; /* virtual entry point */
Elf32_Off e_phoff; /* program header table offset */
Elf32_Off e_shoff; /* section header table offset */
Elf32_Word e_flags; /* processor-specific flags */
Elf32_Half e_ehsize; /* ELF header size */
Elf32_Half e_phentsize; /* program header entry size */
Elf32_Half e_phnum; /* number of program header entries */
Elf32_Half e_shentsize; /* section header entry size */
Elf32_Half e_shnum; /* number of section header entries */
Elf32_Half e_shstrndx; /* section header table's "section
header string table" entry offset */
} Elf32_Ehdr;
/* Section Header */
typedef struct {
Elf32_Word sh_name; /* name - index into section header
string table section */
Elf32_Word sh_type; /* type */
Elf32_Word sh_flags; /* flags */
Elf32_Addr sh_addr; /* address */
Elf32_Off sh_offset; /* file offset */
Elf32_Word sh_size; /* section size */
Elf32_Word sh_link; /* section header table index link */
Elf32_Word sh_info; /* extra information */
Elf32_Word sh_addralign; /* address alignment */
Elf32_Word sh_entsize; /* section entry size */
} Elf32_Shdr;
/* Section names */
#define ELF_BSS ".bss" /* uninitialized data */
#define ELF_DATA ".data" /* initialized data */
#define ELF_DEBUG ".debug" /* debug */
#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */
#define ELF_DYNSTR ".dynstr" /* dynamic string table */
#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */
#define ELF_FINI ".fini" /* termination code */
#define ELF_GOT ".got" /* global offset table */
#define ELF_HASH ".hash" /* symbol hash table */
#define ELF_INIT ".init" /* initialization code */
#define ELF_REL_DATA ".rel.data" /* relocation data */
#define ELF_REL_FINI ".rel.fini" /* relocation termination code */
#define ELF_REL_INIT ".rel.init" /* relocation initialization code */
#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */
#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */
#define ELF_REL_TEXT ".rel.text" /* relocation code */
#define ELF_RODATA ".rodata" /* read-only data */
#define ELF_SHSTRTAB ".shstrtab" /* section header string table */
#define ELF_STRTAB ".strtab" /* string table */
#define ELF_SYMTAB ".symtab" /* symbol table */
#define ELF_TEXT ".text" /* code */
#define ELF_RTMSYMTAB "RTMSymTab"
/* Symbol Table Entry */
typedef struct elf32_sym {
Elf32_Word st_name; /* name - index into string table */
Elf32_Addr st_value; /* symbol value */
Elf32_Word st_size; /* symbol size */
unsigned char st_info; /* type and binding */
unsigned char st_other; /* 0 - no defined meaning */
Elf32_Half st_shndx; /* section header index */
} Elf32_Sym;
#define STB_LOCAL 0 /* BIND */
#define STB_GLOBAL 1
#define STB_WEAK 2
#define STB_NUM 3
#define STB_LOPROC 13 /* processor specific range */
#define STB_HIPROC 15
#define STT_NOTYPE 0 /* symbol type is unspecified */
#define STT_OBJECT 1 /* data object */
#define STT_FUNC 2 /* code object */
#define STT_SECTION 3 /* symbol identifies an ELF section */
#define STT_FILE 4 /* symbol's name is file name */
#define STT_COMMON 5 /* common data object */
#define STT_TLS 6 /* thread-local data object */
#define STT_NUM 7 /* # defined types in generic range */
#define STT_LOOS 10 /* OS specific range */
#define STT_HIOS 12
#define STT_LOPROC 13 /* processor specific range */
#define STT_HIPROC 15
#define ELF_ST_BIND(info) ((info) >> 4)
#define ELF_ST_TYPE(info) ((info) & 0xf)
#define ELF_ST_INFO(bind, type) (((bind)<<4)+((type)&0xf))
/* Relocation entry with implicit addend */
typedef struct {
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
} Elf32_Rel;
/* Relocation entry with explicit addend */
typedef struct {
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
Elf32_Sword r_addend;
} Elf32_Rela;
/* Extract relocation info - r_info */
#define ELF32_R_SYM(i) ((i) >> 8)
#define ELF32_R_TYPE(i) ((unsigned char) (i))
#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t))
/*
* Relocation type for arm
*/
#define R_ARM_NONE 0
#define R_ARM_PC24 1
#define R_ARM_ABS32 2
#define R_ARM_GLOB_DAT 21
#define R_ARM_JUMP_SLOT 22
#define R_ARM_RELATIVE 23
#define R_ARM_PLT32 27
#define R_ARM_CALL 28
#define R_ARM_JUMP24 29
#define R_ARM_V4BX 40
/* Program Header */
typedef struct {
Elf32_Word p_type; /* segment type */
Elf32_Off p_offset; /* segment offset */
Elf32_Addr p_vaddr; /* virtual address of segment */
Elf32_Addr p_paddr; /* physical address - ignored? */
Elf32_Word p_filesz; /* number of bytes in file for seg. */
Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
Elf32_Word p_flags; /* flags */
Elf32_Word p_align; /* memory alignment */
} Elf32_Phdr;
/* p_type */
#define PT_LOAD 1
/* p_flags */
#define PF_X 1
#define PF_W 2
#define PF_R 4
/* sh_type */
#define SHT_NULL 0 /* inactive */
#define SHT_PROGBITS 1 /* program defined information */
#define SHT_SYMTAB 2 /* symbol table section */
#define SHT_STRTAB 3 /* string table section */
#define SHT_RELA 4 /* relocation section with addends*/
#define SHT_HASH 5 /* symbol hash table section */
#define SHT_DYNAMIC 6 /* dynamic section */
#define SHT_NOTE 7 /* note section */
#define SHT_NOBITS 8 /* no space section */
#define SHT_REL 9 /* relation section without addends */
#define SHT_SHLIB 10 /* reserved - purpose unknown */
#define SHT_DYNSYM 11 /* dynamic symbol table section */
#define SHT_NUM 12 /* number of section types */
#define SHT_LOPROC 0x70000000 /* reserved range for processor */
#define SHT_HIPROC 0x7fffffff /* specific section header types */
#define SHT_LOUSER 0x80000000 /* reserved range for application */
#define SHT_HIUSER 0xffffffff /* specific indexes */
/* Section Attribute Flags - sh_flags */
#define SHF_WRITE 0x1 /* Writable */
#define SHF_ALLOC 0x2 /* occupies memory */
#define SHF_EXECINSTR 0x4 /* executable */
#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */
/* specific section attributes */
#endif
#ifndef __MODULE_H__
#define __MODULE_H__
#include <rtdef.h>
typedef rt_uint8_t Elf_Byte;
typedef rt_uint32_t Elf32_Addr; /* Unsigned program address */
typedef rt_uint32_t Elf32_Off; /* Unsigned file offset */
typedef rt_int32_t Elf32_Sword; /* Signed large integer */
typedef rt_uint32_t Elf32_Word; /* Unsigned large integer */
typedef rt_uint16_t Elf32_Half; /* Unsigned medium integer */
/* e_ident[] magic number */
#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */
#define ELFMAG1 'E' /* e_ident[EI_MAG1] */
#define ELFMAG2 'L' /* e_ident[EI_MAG2] */
#define ELFMAG3 'F' /* e_ident[EI_MAG3] */
#define RTMMAG "\177RTM" /* magic */
#define ELFMAG "\177ELF" /* magic */
#define SELFMAG 4 /* size of magic */
#define EI_CLASS 4 /* file class */
#define EI_NIDENT 16 /* Size of e_ident[] */
/* e_ident[] file class */
#define ELFCLASSNONE 0 /* invalid */
#define ELFCLASS32 1 /* 32-bit objs */
#define ELFCLASS64 2 /* 64-bit objs */
#define ELFCLASSNUM 3 /* number of classes */
/* e_ident[] data encoding */
#define ELFDATANONE 0 /* invalid */
#define ELFDATA2LSB 1 /* Little-Endian */
#define ELFDATA2MSB 2 /* Big-Endian */
#define ELFDATANUM 3 /* number of data encode defines */
/* e_ident */
#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
(ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
(ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
(ehdr).e_ident[EI_MAG3] == ELFMAG3)
/* ELF Header */
typedef struct elfhdr {
unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
Elf32_Half e_type; /* object file type */
Elf32_Half e_machine; /* machine */
Elf32_Word e_version; /* object file version */
Elf32_Addr e_entry; /* virtual entry point */
Elf32_Off e_phoff; /* program header table offset */
Elf32_Off e_shoff; /* section header table offset */
Elf32_Word e_flags; /* processor-specific flags */
Elf32_Half e_ehsize; /* ELF header size */
Elf32_Half e_phentsize; /* program header entry size */
Elf32_Half e_phnum; /* number of program header entries */
Elf32_Half e_shentsize; /* section header entry size */
Elf32_Half e_shnum; /* number of section header entries */
Elf32_Half e_shstrndx; /* section header table's "section
header string table" entry offset */
} Elf32_Ehdr;
/* Section Header */
typedef struct {
Elf32_Word sh_name; /* name - index into section header
string table section */
Elf32_Word sh_type; /* type */
Elf32_Word sh_flags; /* flags */
Elf32_Addr sh_addr; /* address */
Elf32_Off sh_offset; /* file offset */
Elf32_Word sh_size; /* section size */
Elf32_Word sh_link; /* section header table index link */
Elf32_Word sh_info; /* extra information */
Elf32_Word sh_addralign; /* address alignment */
Elf32_Word sh_entsize; /* section entry size */
} Elf32_Shdr;
/* Section names */
#define ELF_BSS ".bss" /* uninitialized data */
#define ELF_DATA ".data" /* initialized data */
#define ELF_DEBUG ".debug" /* debug */
#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */
#define ELF_DYNSTR ".dynstr" /* dynamic string table */
#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */
#define ELF_FINI ".fini" /* termination code */
#define ELF_GOT ".got" /* global offset table */
#define ELF_HASH ".hash" /* symbol hash table */
#define ELF_INIT ".init" /* initialization code */
#define ELF_REL_DATA ".rel.data" /* relocation data */
#define ELF_REL_FINI ".rel.fini" /* relocation termination code */
#define ELF_REL_INIT ".rel.init" /* relocation initialization code */
#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */
#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */
#define ELF_REL_TEXT ".rel.text" /* relocation code */
#define ELF_RODATA ".rodata" /* read-only data */
#define ELF_SHSTRTAB ".shstrtab" /* section header string table */
#define ELF_STRTAB ".strtab" /* string table */
#define ELF_SYMTAB ".symtab" /* symbol table */
#define ELF_TEXT ".text" /* code */
#define ELF_RTMSYMTAB "RTMSymTab"
/* Symbol Table Entry */
typedef struct elf32_sym {
Elf32_Word st_name; /* name - index into string table */
Elf32_Addr st_value; /* symbol value */
Elf32_Word st_size; /* symbol size */
unsigned char st_info; /* type and binding */
unsigned char st_other; /* 0 - no defined meaning */
Elf32_Half st_shndx; /* section header index */
} Elf32_Sym;
#define STB_LOCAL 0 /* BIND */
#define STB_GLOBAL 1
#define STB_WEAK 2
#define STB_NUM 3
#define STB_LOPROC 13 /* processor specific range */
#define STB_HIPROC 15
#define STT_NOTYPE 0 /* symbol type is unspecified */
#define STT_OBJECT 1 /* data object */
#define STT_FUNC 2 /* code object */
#define STT_SECTION 3 /* symbol identifies an ELF section */
#define STT_FILE 4 /* symbol's name is file name */
#define STT_COMMON 5 /* common data object */
#define STT_TLS 6 /* thread-local data object */
#define STT_NUM 7 /* # defined types in generic range */
#define STT_LOOS 10 /* OS specific range */
#define STT_HIOS 12
#define STT_LOPROC 13 /* processor specific range */
#define STT_HIPROC 15
#define ELF_ST_BIND(info) ((info) >> 4)
#define ELF_ST_TYPE(info) ((info) & 0xf)
#define ELF_ST_INFO(bind, type) (((bind)<<4)+((type)&0xf))
/* Relocation entry with implicit addend */
typedef struct {
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
} Elf32_Rel;
/* Relocation entry with explicit addend */
typedef struct {
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
Elf32_Sword r_addend;
} Elf32_Rela;
/* Extract relocation info - r_info */
#define ELF32_R_SYM(i) ((i) >> 8)
#define ELF32_R_TYPE(i) ((unsigned char) (i))
#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t))
/*
* Relocation type for arm
*/
#define R_ARM_NONE 0
#define R_ARM_PC24 1
#define R_ARM_ABS32 2
#define R_ARM_GLOB_DAT 21
#define R_ARM_JUMP_SLOT 22
#define R_ARM_RELATIVE 23
#define R_ARM_PLT32 27
#define R_ARM_CALL 28
#define R_ARM_JUMP24 29
#define R_ARM_V4BX 40
/* Program Header */
typedef struct {
Elf32_Word p_type; /* segment type */
Elf32_Off p_offset; /* segment offset */
Elf32_Addr p_vaddr; /* virtual address of segment */
Elf32_Addr p_paddr; /* physical address - ignored? */
Elf32_Word p_filesz; /* number of bytes in file for seg. */
Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
Elf32_Word p_flags; /* flags */
Elf32_Word p_align; /* memory alignment */
} Elf32_Phdr;
/* p_type */
#define PT_LOAD 1
/* p_flags */
#define PF_X 1
#define PF_W 2
#define PF_R 4
/* sh_type */
#define SHT_NULL 0 /* inactive */
#define SHT_PROGBITS 1 /* program defined information */
#define SHT_SYMTAB 2 /* symbol table section */
#define SHT_STRTAB 3 /* string table section */
#define SHT_RELA 4 /* relocation section with addends*/
#define SHT_HASH 5 /* symbol hash table section */
#define SHT_DYNAMIC 6 /* dynamic section */
#define SHT_NOTE 7 /* note section */
#define SHT_NOBITS 8 /* no space section */
#define SHT_REL 9 /* relation section without addends */
#define SHT_SHLIB 10 /* reserved - purpose unknown */
#define SHT_DYNSYM 11 /* dynamic symbol table section */
#define SHT_NUM 12 /* number of section types */
#define SHT_LOPROC 0x70000000 /* reserved range for processor */
#define SHT_HIPROC 0x7fffffff /* specific section header types */
#define SHT_LOUSER 0x80000000 /* reserved range for application */
#define SHT_HIUSER 0xffffffff /* specific indexes */
/* Section Attribute Flags - sh_flags */
#define SHF_WRITE 0x1 /* Writable */
#define SHF_ALLOC 0x2 /* occupies memory */
#define SHF_EXECINSTR 0x4 /* executable */
#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */
/* specific section attributes */
#endif

518
src/rtm.c
View File

@ -1,259 +1,259 @@
/*
* File : rtm.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2010, 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>
/*
* 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_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)
/*
* misc interface symbol
*/
extern int __aeabi_idiv;
extern int __aeabi_ddiv;
extern int __aeabi_dmul;
extern int __aeabi_i2d;
extern int __aeabi_uidiv;
extern int __aeabi_uidivmod;
extern int __aeabi_idivmod;
extern int __aeabi_d2iz;
RTM_EXPORT(__aeabi_ddiv)
RTM_EXPORT(__aeabi_dmul)
RTM_EXPORT(__aeabi_i2d)
RTM_EXPORT(__aeabi_uidiv)
RTM_EXPORT(__aeabi_idiv)
RTM_EXPORT(__aeabi_idivmod)
RTM_EXPORT(__aeabi_uidivmod)
RTM_EXPORT(__aeabi_d2iz)
RTM_EXPORT(strcmp)
RTM_EXPORT(strcpy)
RTM_EXPORT(strlen)
RTM_EXPORT(rand)
RTM_EXPORT(memset)
RTM_EXPORT(memcpy)
#ifdef RT_USING_NEWLIB
#include <unistd.h>
RTM_EXPORT(snprintf)
RTM_EXPORT(access)
RTM_EXPORT(__assert_func)
#include <time.h>
RTM_EXPORT(localtime)
RTM_EXPORT(time)
#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/view.h>
#include <rtgui/widgets/workbench.h>
#include <rtgui/widgets/widget.h>
#include <rtgui/widgets/button.h>
#include <rtgui/widgets/list_view.h>
#include <rtgui/widgets/filelist_view.h>
RTM_EXPORT(rtgui_view_show)
RTM_EXPORT(rtgui_view_create)
RTM_EXPORT(rtgui_view_destroy)
RTM_EXPORT(rtgui_view_event_handler)
RTM_EXPORT(rtgui_dc_draw_text)
RTM_EXPORT(rtgui_dc_begin_drawing)
RTM_EXPORT(rtgui_dc_end_drawing)
RTM_EXPORT(rtgui_workbench_event_loop)
RTM_EXPORT(rtgui_workbench_event_handler)
RTM_EXPORT(rtgui_workbench_add_view)
RTM_EXPORT(rtgui_workbench_create)
RTM_EXPORT(rtgui_workbench_destroy)
RTM_EXPORT(rtgui_workbench_close)
RTM_EXPORT(rtgui_timer_start)
RTM_EXPORT(rtgui_timer_create)
RTM_EXPORT(rtgui_timer_destory)
RTM_EXPORT(rtgui_timer_stop)
RTM_EXPORT(rtgui_thread_register)
RTM_EXPORT(rtgui_thread_deregister)
RTM_EXPORT(rtgui_widget_focus)
RTM_EXPORT(rtgui_widget_set_event_handler)
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_panel_register)
RTM_EXPORT(rtgui_panel_set_default_focused)
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)
#endif
#endif
/*
* File : rtm.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2010, 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>
/*
* 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_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)
/*
* misc interface symbol
*/
extern int __aeabi_idiv;
extern int __aeabi_ddiv;
extern int __aeabi_dmul;
extern int __aeabi_i2d;
extern int __aeabi_uidiv;
extern int __aeabi_uidivmod;
extern int __aeabi_idivmod;
extern int __aeabi_d2iz;
RTM_EXPORT(__aeabi_ddiv)
RTM_EXPORT(__aeabi_dmul)
RTM_EXPORT(__aeabi_i2d)
RTM_EXPORT(__aeabi_uidiv)
RTM_EXPORT(__aeabi_idiv)
RTM_EXPORT(__aeabi_idivmod)
RTM_EXPORT(__aeabi_uidivmod)
RTM_EXPORT(__aeabi_d2iz)
RTM_EXPORT(strcmp)
RTM_EXPORT(strcpy)
RTM_EXPORT(strlen)
RTM_EXPORT(rand)
RTM_EXPORT(memset)
RTM_EXPORT(memcpy)
#ifdef RT_USING_NEWLIB
#include <unistd.h>
RTM_EXPORT(snprintf)
RTM_EXPORT(access)
RTM_EXPORT(__assert_func)
#include <time.h>
RTM_EXPORT(localtime)
RTM_EXPORT(time)
#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/view.h>
#include <rtgui/widgets/workbench.h>
#include <rtgui/widgets/widget.h>
#include <rtgui/widgets/button.h>
#include <rtgui/widgets/list_view.h>
#include <rtgui/widgets/filelist_view.h>
RTM_EXPORT(rtgui_view_show)
RTM_EXPORT(rtgui_view_create)
RTM_EXPORT(rtgui_view_destroy)
RTM_EXPORT(rtgui_view_event_handler)
RTM_EXPORT(rtgui_dc_draw_text)
RTM_EXPORT(rtgui_dc_begin_drawing)
RTM_EXPORT(rtgui_dc_end_drawing)
RTM_EXPORT(rtgui_workbench_event_loop)
RTM_EXPORT(rtgui_workbench_event_handler)
RTM_EXPORT(rtgui_workbench_add_view)
RTM_EXPORT(rtgui_workbench_create)
RTM_EXPORT(rtgui_workbench_destroy)
RTM_EXPORT(rtgui_workbench_close)
RTM_EXPORT(rtgui_timer_start)
RTM_EXPORT(rtgui_timer_create)
RTM_EXPORT(rtgui_timer_destory)
RTM_EXPORT(rtgui_timer_stop)
RTM_EXPORT(rtgui_thread_register)
RTM_EXPORT(rtgui_thread_deregister)
RTM_EXPORT(rtgui_widget_focus)
RTM_EXPORT(rtgui_widget_set_event_handler)
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_panel_register)
RTM_EXPORT(rtgui_panel_set_default_focused)
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)
#endif
#endif

View File

@ -71,7 +71,7 @@ static rt_err_t _rt_thread_init(struct rt_thread* thread,
thread->error = RT_EOK;
thread->stat = RT_THREAD_INIT;
/* initialize cleanup function and user data */
/* initialize cleanup function and user data */
thread->cleanup = 0;
thread->user_data = 0;