⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 redboot.h

📁 eCos操作系统源码
💻 H
📖 第 1 页 / 共 2 页
字号:
cmd_fun _f_;                                                      \struct cmd _cmd_tab_##_f_ CYG_HAL_TABLE_QUALIFIED_ENTRY(_n_,_f_) = {_s_, _h_, _u_, _f_, _subs_, _sube_};#define cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_)                                   \extern _cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_)#define local_cmd_entry(_s_,_h_,_u_,_f_,_n_)                             \static _cmd_entry(_s_,_h_,_u_,_f_,0,0,_n_)// Initialization functions#define RedBoot_INIT_FIRST  0000#define RedBoot_INIT_SECOND 0100// Specify a 3 digit numeric value for proper prioritizing#define RedBoot_INIT_PRIO(_n_) 1##_n_#define RedBoot_INIT_LAST  9999typedef void void_fun(void);typedef void_fun *void_fun_ptr;struct init_tab_entry {    void_fun_ptr fun;} CYG_HAL_TABLE_TYPE;#define _RedBoot_init(_f_,_p_)                                          \struct init_tab_entry _init_tab_##_p_##_f_                              \  CYG_HAL_TABLE_QUALIFIED_ENTRY(RedBoot_inits,_p_##_f_) = { _f_ }; #define RedBoot_init(_f_,_p_) _RedBoot_init(_f_,_p_)// Main loop [idle] call-back functions#define RedBoot_IDLE_FIRST          0000#define RedBoot_IDLE_BEFORE_NETIO   3000#define RedBoot_IDLE_NETIO          5000#define RedBoot_IDLE_AFTER_NETIO    7000#define RedBoot_IDLE_LAST           9999typedef void idle_fun(bool);typedef idle_fun *idle_fun_ptr;struct idle_tab_entry {    idle_fun_ptr fun;} CYG_HAL_TABLE_TYPE;#define _RedBoot_idle(_f_,_p_)                                          \struct idle_tab_entry _idle_tab_##_p_##_f_                              \   CYG_HAL_TABLE_QUALIFIED_ENTRY(RedBoot_idle,_p_##_f_) = { _f_ }; #define RedBoot_idle(_f_,_p_) _RedBoot_idle(_f_,_p_)// This function called when changing idle/not - mostly used by I/O// to support idle when timeout, etc.void do_idle(bool state);// Option processing supportstruct option_info {    char flag;    bool takes_arg;    int  arg_type;    void *arg;    bool *arg_set;    char *name;};#define NUM_ELEMS(s) (sizeof(s)/sizeof(s[0]))#define OPTION_ARG_TYPE_NUM 0    // Numeric data#define OPTION_ARG_TYPE_STR 1    // Generic string#define OPTION_ARG_TYPE_FLG 2    // Flag only// Command line parsingexternC struct cmd *parse(char **line, int *argc, char **argv);externC void init_opts(struct option_info *opts, char flag, bool takes_arg,                        int arg_type, void *arg, bool *arg_set, char *name);externC bool scan_opts(int argc, char *argv[], int first,                        struct option_info *opts, int num_opts,                        void *def_arg, int def_arg_type, char *def_descr);#ifdef CYGNUM_HAL_VIRTUAL_VECTOR_AUX_CHANNELS#define CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS \  (CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS+CYGNUM_HAL_VIRTUAL_VECTOR_AUX_CHANNELS)#else#define CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS \  CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS#endif#ifdef CYGPKG_REDBOOT_NETWORKING//-----------------------------------------------------------------------------// DNS wrapper#ifdef CYGPKG_REDBOOT_NETWORKING_DNS// I would really like if we could just pull in cyg/ns/dns/dns.h, but// that would require adding dummy <network.h> and <netinet/in.h> files.// Host name / IP mappingstruct hostent {    char    *h_name;        /* official name of host */    char    **h_aliases;    /* alias list */    int     h_addrtype;     /* host address type */    int     h_length;       /* length of address */    char    **h_addr_list;  /* list of addresses */};#define h_addr  h_addr_list[0]  /* for backward compatibility */externC int redboot_dns_res_init(void);externC void set_dns(char* new_ip);externC void show_dns(void);externC struct hostent *gethostbyname(const char *host);// Error reportingexternC int h_errno;#define DNS_SUCCESS  0#define HOST_NOT_FOUND 1#define TRY_AGAIN      2#define NO_RECOVERY    3#define NO_DATA        4static inline bool_gethostbyname(const char* name, in_addr_t* host){     struct hostent* hent = gethostbyname(name);    if (hent) {        memcpy(host, hent->h_addr_list[0], sizeof(in_addr_t));        return true;    }    // Fall back to inet_aton - gethostbyname may already have tried    // it, but we can't know for sure (the DNS IP may not have been    // valid, preventing the inet_aton).    return inet_aton(name, host);}#elsestatic inline bool_gethostbyname(const char* name, in_addr_t* host){     return inet_aton(name, host);}#endif // CYGPKG_REDBOOT_NETWORKING_DNS#endif // CYGPKG_REDBOOT_NETWORKING//-----------------------------------------------------------------------------// String functions. Some of these are duplicates of the same functions in// the I18N package.// Validate a hex character__inline__ static bool_is_hex(char c){    return (((c >= '0') && (c <= '9')) ||            ((c >= 'A') && (c <= 'F')) ||                        ((c >= 'a') && (c <= 'f')));}// Convert a single hex nibble__inline__ static int_from_hex(char c) {    int ret = 0;    if ((c >= '0') && (c <= '9')) {        ret = (c - '0');    } else if ((c >= 'a') && (c <= 'f')) {        ret = (c - 'a' + 0x0a);    } else if ((c >= 'A') && (c <= 'F')) {        ret = (c - 'A' + 0x0A);    }    return ret;}// Convert a character to lower case__inline__ static char_tolower(char c){    if ((c >= 'A') && (c <= 'Z')) {        c = (c - 'A') + 'a';    }    return c;}// Validate alpha__inline__ static boolisalpha(int c){    return (((c >= 'a') && (c <= 'z')) ||             ((c >= 'A') && (c <= 'Z')));}// Validate digit__inline__ static boolisdigit(int c){    return ((c >= '0') && (c <= '9'));}// Validate alphanum__inline__ static boolisalnum(int c){    return (isalpha(c) || isdigit(c));}//----------------------------------------------------------------------------// syscall values#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS)// These are required by the ANSI C part of newlib (excluding system() of// course).#define SYS_exit         1#define SYS_open         2#define SYS_close        3#define SYS_read         4#define SYS_write        5#define SYS_lseek        6#define SYS_unlink       7#define SYS_getpid       8#define SYS_kill         9#define SYS_fstat        10//#define SYS_sbrk       11 - not currently a system call, but reserved.// ARGV support.#define SYS_argvlen      12#define SYS_argv         13// These are extras added for one reason or another.#define SYS_chdir        14#define SYS_stat         15#define SYS_chmod        16#define SYS_utime        17#define SYS_time         18#define SYS_gettimeofday 19#define SYS_times        20#define SYS_interrupt   1000#define SYS_meminfo     1001#define __GET_SHARED  0xbaad // 47789 decimal#ifdef CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF#define SYS_timer_call_back 2001#define SYS_timer_frequency 2002#define SYS_timer_reset     2003#endif // CYGSEM_REDBOOT_BSP_SYSCALLS_GPROF#define SYS_rename          3001#define SYS_isatty          3002#define SYS_system          3003#endif // CYGSEM_REDBOOT_BSP_SYSCALLS#endif // _REDBOOT_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -