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

📄 hal_if.h

📁 eCos/RedBoot for勤研ARM AnywhereII(4510) 含全部源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
    _ENTER_MONITOR();                                           \    res = ((_t_)(t[CYGNUM_COMM_##_n_]))(dp, _p1_, _p2_);        \    _EXIT_MONITOR();                                            \    return res;                                                 \}

#define __call_voidCOMM2(_n_,_rt_,_t_,_t1_,_t2_)                \static __inline__ _rt_                                          \__call_COMM_##_n_(hal_virtual_comm_table_t t, _t1_ _p1_, _t2_ _p2_)        \{                                                               \    void *dp = (__comm_if_ch_data_t)t[CYGNUM_COMM_IF_CH_DATA];  \    _ENTER_MONITOR();                                           \    ((_t_)(t[CYGNUM_COMM_##_n_]))(dp, _p1_, _p2_);              \    _EXIT_MONITOR();                                            \}

#define __call_COMM3(_n_,_rt_,_t_,_t1_,_t2_,_t3_)               \static __inline__ _rt_                                          \__call_COMM_##_n_(hal_virtual_comm_table_t t, _t1_ _p1_, _t2_ _p2_, _t3_ _p3_)        \{                                                               \    _rt_ res;                                                   \    void *dp = (__comm_if_ch_data_t)t[CYGNUM_COMM_IF_CH_DATA];  \    _ENTER_MONITOR();                                           \    res = ((_t_)(t[CYGNUM_COMM_##_n_]))(dp, _p1_, _p2_, _p3_);              \    _EXIT_MONITOR();                                            \    return res;                                                 \}

#define __call_voidCOMM3(_n_,_rt_,_t_,_t1_,_t2_,_t3_)           \static __inline__ _rt_                                          \__call_COMM_##_n_(hal_virtual_comm_table_t t, _t1_ _p1_, _t2_ _p2_, _t3_ _p3_)        \{                                                               \    void *dp = (__comm_if_ch_data_t)t[CYGNUM_COMM_IF_CH_DATA];  \    _ENTER_MONITOR();                                           \    ((_t_)(t[CYGNUM_COMM_##_n_]))(dp, _p1_, _p2_, _p3_);        \    _EXIT_MONITOR();                                            \}

#ifndef CYGACC_COMM_IF_DEFINED

#define CYGACC_COMM_IF_CH_DATA(_t_) \ ((__comm_if_ch_data_t)((_t_)[CYGNUM_COMM_IF_CH_DATA]))
#define CYGACC_COMM_IF_CH_DATA_SET(_t_, _x_) \ (_t_)[CYGNUM_COMM_IF_CH_DATA]=(CYG_ADDRWORD)(_x_)

__call_voidCOMM2(IF_WRITE, void, __comm_if_write_t, const cyg_uint8 *, cyg_uint32)
#define CYGACC_COMM_IF_WRITE(_t_, _b_, _l_) \ __call_COMM_IF_WRITE(_t_, _b_, _l_)
#define CYGACC_COMM_IF_WRITE_SET(_t_, _x_) \ (_t_)[CYGNUM_COMM_IF_WRITE]=(CYG_ADDRWORD)(_x_)

__call_voidCOMM2(IF_READ, void, __comm_if_read_t, cyg_uint8 *, cyg_uint32)
#define CYGACC_COMM_IF_READ(_t_, _b_, _l_) \ __call_COMM_IF_READ(_t_, _b_, _l_)
#define CYGACC_COMM_IF_READ_SET(_t_, _x_) \ (_t_)[CYGNUM_COMM_IF_READ]=(CYG_ADDRWORD)(_x_)

__call_voidCOMM1(IF_PUTC, void, __comm_if_putc_t, cyg_uint8)
#define CYGACC_COMM_IF_PUTC(_t_, _c_) \ __call_COMM_IF_PUTC(_t_,_c_)
#define CYGACC_COMM_IF_PUTC_SET(_t_, _x_) \ (_t_)[CYGNUM_COMM_IF_PUTC]=(CYG_ADDRWORD)(_x_)

__call_COMM0(IF_GETC, cyg_uint8, __comm_if_getc_t)
#define CYGACC_COMM_IF_GETC(_t_) \ __call_COMM_IF_GETC(_t_)
#define CYGACC_COMM_IF_GETC_SET(_t_, _x_) \ (_t_)[CYGNUM_COMM_IF_GETC]=(CYG_ADDRWORD)(_x_)

// This macro has not been changed to use inline functions like the
// others, simply because it uses variable arguments, and the change
// would break binary compatibility.
#define CYGACC_COMM_IF_CONTROL(_t_, args...)                                                            \ ({ int res;                                                                                            \    _ENTER_MONITOR();                                                                                   \    res = ((__comm_if_control_t)((_t_)[CYGNUM_COMM_IF_CONTROL]))(CYGACC_COMM_IF_CH_DATA(_t_), args);    \    _EXIT_MONITOR();                                                                                    \    res;})
#define CYGACC_COMM_IF_CONTROL_SET(_t_, _x_) \ (_t_)[CYGNUM_COMM_IF_CONTROL]=(CYG_ADDRWORD)(_x_)

__call_COMM3(IF_DBG_ISR, int, __comm_if_dbg_isr_t, int *, CYG_ADDRWORD, CYG_ADDRWORD)
#define CYGACC_COMM_IF_DBG_ISR(_t_, _c_, _v_, _d_) \ __call_COMM_IF_DBG_ISR(_t_, _c_, _v_, _d_)
#define CYGACC_COMM_IF_DBG_ISR_SET(_t_, _x_) \ (_t_)[CYGNUM_COMM_IF_DBG_ISR]=(CYG_ADDRWORD)(_x_)

__call_COMM1(IF_GETC_TIMEOUT, cyg_bool, __comm_if_getc_timeout_t, cyg_uint8 *)
#define CYGACC_COMM_IF_GETC_TIMEOUT(_t_, _c_) \ __call_COMM_IF_GETC_TIMEOUT(_t_, _c_)
#define CYGACC_COMM_IF_GETC_TIMEOUT_SET(_t_, _x_) \ (_t_)[CYGNUM_COMM_IF_GETC_TIMEOUT]=(CYG_ADDRWORD)(_x_)

#endif // CYGACC_COMM_IF_DEFINED

//--------------------------------------------------------------------------
// Main calling interface table. Will be assigned a location by the 
// linker script. Both ROM and RAM startup applications will know about
// the location.
#define CYGNUM_CALL_IF_VERSION                    0
#define CYGNUM_CALL_IF_available_1                1
#define CYGNUM_CALL_IF_available_2                2
#define CYGNUM_CALL_IF_available_3                3
#define CYGNUM_CALL_IF_KILL_VECTOR                4
#define CYGNUM_CALL_IF_CONSOLE_PROCS              5
#define CYGNUM_CALL_IF_DEBUG_PROCS                6
#define CYGNUM_CALL_IF_FLUSH_DCACHE               7
#define CYGNUM_CALL_IF_FLUSH_ICACHE               8
#define CYGNUM_CALL_IF_available_9                9
#define CYGNUM_CALL_IF_available_10               10
#define CYGNUM_CALL_IF_available_11               11
#define CYGNUM_CALL_IF_SET_DEBUG_COMM             12
#define CYGNUM_CALL_IF_SET_CONSOLE_COMM           13
#define CYGNUM_CALL_IF_MONITOR_VERSION            14
#define CYGNUM_CALL_IF_DBG_SYSCALL                15
#define CYGNUM_CALL_IF_RESET                      16
#define CYGNUM_CALL_IF_CONSOLE_INTERRUPT_FLAG     17
#define CYGNUM_CALL_IF_DELAY_US                   18
#define CYGNUM_CALL_IF_DBG_DATA                   19
#define CYGNUM_CALL_IF_FLASH_CFG_OP               20
#define CYGNUM_CALL_IF_MONITOR_RETURN             21
#define CYGNUM_CALL_IF_FLASH_FIS_OP               22

#define CYGNUM_CALL_IF_LAST_ENTRY                 CYGNUM_CALL_IF_FLASH_FIS_OP

#define CYGNUM_CALL_IF_INSTALL_BPT_FN             35

#define CYGNUM_CALL_IF_TABLE_SIZE                 64

externC volatile CYG_ADDRWORD hal_virtual_vector_table[CYGNUM_CALL_IF_TABLE_SIZE];

// Table version contains version information for both the CALL table
// itself (the number of the last active entry in the table), and the
// COMM table (the size of the table).
#define CYGNUM_CALL_IF_TABLE_VERSION_CALL         CYGNUM_CALL_IF_LAST_ENTRY
#define CYGNUM_CALL_IF_TABLE_VERSION_CALL_HACK    (CYGNUM_CALL_IF_TABLE_SIZE+1)
#define CYGNUM_CALL_IF_TABLE_VERSION_CALL_MAX     CYGNUM_CALL_IF_TABLE_SIZE
#define CYGNUM_CALL_IF_TABLE_VERSION_COMM         CYGNUM_COMM_IF_TABLE_SIZE
#define CYGNUM_CALL_IF_TABLE_VERSION_CALL_MASK    0x0000ffff
#define CYGNUM_CALL_IF_TABLE_VERSION_COMM_MASK    0xffff0000
#define CYGNUM_CALL_IF_TABLE_VERSION_COMM_shift   16


// These are special debug/console procs IDs
// QUERY_CURRENT will cause the ID of the currently selected proc ID to be
//               returned.
// EMPTY         this is the ID used for an empty procs table (i.e, NULL
//               pointer)
// MANGLER       selects the procs space reserved for the console mangler
//               allowing the application to temporarily disable mangling
//               or temporarily switch in different console procs.
#define CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT -1
#define CYGNUM_CALL_IF_SET_COMM_ID_EMPTY         -2
#define CYGNUM_CALL_IF_SET_COMM_ID_MANGLER       -3

// The below is a (messy) attempt at adding some type safety to the
// above array. At the same time, the accessors allow the
// implementation to be easily changed in the future (both tag->data
// table and structure implementations have been suggested).

typedef int __call_if_version_t;
typedef void* __call_if_ictrl_table_t;
typedef void* __call_if_exc_table_t;
typedef bsp_handler_t *__call_if_dbg_vector_t;
typedef bsp_handler_t __call_if_kill_vector_t;
typedef hal_virtual_comm_table_t *__call_if_console_procs_t;
typedef hal_virtual_comm_table_t *__call_if_debug_procs_t;
typedef void (__call_if_flush_dcache_t)(void *__p, int __nbytes);
typedef void (__call_if_flush_icache_t)(void *__p, int __nbytes);
typedef int (__call_if_set_debug_comm_t)(int __comm_id);
typedef int (__call_if_set_console_comm_t)(int __comm_id);
typedef void* __call_if_dbg_data_t;
typedef int (__call_if_dbg_syscall_t) (enum dbg_syscall_ids id,
                                        union dbg_thread_syscall_parms  *p );
typedef void (__call_if_reset_t)(void);
typedef int __call_if_console_interrupt_flag_t;
typedef void (__call_if_delay_us_t)(cyg_int32 usecs);
typedef void (__call_if_install_bpt_fn_t)(void *__epc);
typedef char *__call_if_monitor_version_t;
typedef void (__call_if_monitor_return_t)(int status);
typedef cyg_bool (__call_if_flash_fis_op_fn_t)(int __oper, char *__name, void *__val);
//
// This structure is used to pass parameters to/from the fconfig routines.
// This allows a single virtual vector interface, with widely varying functionality
//
struct cyg_fconfig {
    char *key;      // Datum 'key'
    int   keylen;   // Length of key
    void *val;      // Pointer to data
    int   type;     // Type of datum
    int   offset;   // Offset within data (used by _NEXT)
};
typedef cyg_bool (__call_if_flash_cfg_op_fn_t)(int __oper, struct cyg_fconfig *__data);

#ifndef CYGACC_CALL_IF_DEFINED

#define __data_VV(_n_,_tt_)                             \static __inline__ _tt_                                  \__call_vv_##_n_(void)                                   \{                                                       \    return ((_tt_)hal_virtual_vector_table[_n_]);       \}

#define __call_VV0(_n_,_tt_,_rt_)                                       \static __inline__ _rt_                                                  \__call_vv_##_n_(void)                                                   \{                                                                       \    _rt_ res;                                                           \    _ENTER_MONITOR();                                                   \    res = ((_tt_ *)hal_virtual_vector_table[_n_])();                    \    _EXIT_MONITOR();                                                    \    return res;                                                         \}

#define __call_voidVV0(_n_,_tt_,_rt_)                                   \static __inline__ _rt_                                                  \__call_vv_##_n_(void)                                                   \{                                                                       \    _ENTER_MONITOR();                                                   \    ((_tt_ *)hal_virtual_vector_table[_n_])();                          \    _EXIT_MONITOR();                                                    \}

#define __call_VV1(_n_,_tt_,_rt_,_t1_)                                  \static __inline__ _rt_                                                  \__call_vv_##_n_(_t1_ _p1_)                                              \{                                                                       \    _rt_ res;                                                           \    _ENTER_MONITOR();                                                   \    res = ((_tt_ *)hal_virtual_vector_table[_n_])(_p1_);                \    _EXIT_MONITOR();                                                    \    return res;                                                         \}

#define __call_voidVV1(_n_,_tt_,_rt_,_t1_)                              \static __inline__ _rt_                                                  \__call_vv_##_n_(_t1_ _p1_)                                              \{                                                                       \    _ENTER_MONITOR();                                                   \    ((_tt_ *)hal_virtual_vector_table[_n_])(_p1_);                      \    _EXIT_MONITOR();                                                    \}

#define __call_VV2(_n_,_tt_,_rt_,_t1_,_t2_)                             \static __inline__ _rt_                                                  \__call_vv_##_n_(_t1_ _p1_, _t2_ _p2_)                                   \{                                                                       \

⌨️ 快捷键说明

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