2 * Hyper Operating System V4 Advance
5 * @brief %jp{ARMv7-M}%en{ARMv7-M}
7 * Copyright (C) 1998-2011 by Project HOS
8 * http://sourceforge.jp/projects/hos/
12 #ifndef _KERNEL__arch__proc__arm__arm_v7m__proc_h__
13 #define _KERNEL__arch__proc__arm__arm_v7m__proc_h__
15 #define _KERNEL_REG_INT_CONTROL ((volatile UW *)0xE000ED04) /**< %jp{割り込み制御状態レジスタ}%en{Interrupt Control State Register} */
17 #define _KERNEL_REG_INT_SETENA_BASE ((volatile UW *)0xE000E100) /**< %jp{割り込みイネーブルセットレジスタ} */
18 #define _KERNEL_REG_INT_CLRENA_BASE ((volatile UW *)0xE000E180) /**< %jp{割り込みイネーブルクリアレジスタ} */
19 #define _KERNEL_REG_INT_SETPEND_BASE ((volatile UW *)0xE000E200) /**< %jp{割り込み保留セットレジスタ} */
20 #define _KERNEL_REG_INT_CLRPEND_BASE ((volatile UW *)0xE000E280) /**< %jp{割り込み保留クリアレジスタ} */
23 /** %jp{コンテキスト制御ブロック} */
24 typedef struct _kernel_t_ctxcb
35 void _kernel_reset_handler(void);
36 void _kernel_nmi_handler(void);
37 void _kernel_hw_fault_handler(void);
38 void _kernel_pendsv_handler(void);
40 int _kernel_ref_cpu_control(void); /**< %jp{CONTROLレジスタの取得} */
43 void _kernel_ena_int(void); /**< %jp{割込み許可} */
44 void _kernel_dis_int(void); /**< %jp{割込み禁止} */
45 void _kernel_wai_int(void); /**< %jp{割込み待ち(アイドル時の処理)} */
47 void _kernel_cre_ctx(_KERNEL_T_CTXCB *pk_ctxcb, VP isp, FP entry, VP_INT par1, VP_INT par2); /**< %jp{実行コンテキストの作成} */
48 void _kernel_rst_ctx(VP_INT par1, VP_INT par2, FP entry, VP isp); /**< %jp{実行コンテキストのリスタート} */
49 void _kernel_sta_ctx(_KERNEL_T_CTXCB *pk_ctxcb); /**< %jp{実行コンテキストの開始} */
50 void _kernel_swi_ctx(_KERNEL_T_CTXCB *pk_ctxinf_nxt, _KERNEL_T_CTXCB *pk_ctxcb_now); /**< %jp{実行コンテキストの切替} */
58 #define _KERNEL_INI_PRC() do {} while (0) /**< %jp{プロセッサ固有の初期化} */
60 #define _KERNEL_INI_INT(stksz, stk) do {} while (0) /**< %jp{割込み初期化} */
61 #define _KERNEL_ENA_INT() _kernel_ena_int() /**< %jp{割込み許可} */
62 #define _KERNEL_DIS_INT() _kernel_dis_int() /**< %jp{割込み禁止} */
63 #define _KERNEL_WAI_INT() _kernel_wai_int() /**< %jp{割込み待ち(アイドル時の処理)} */
65 #define _KERNEL_CRE_CTX(pk_ctxcb, stksz, stk, isp, entry, exinf1, exinf2) \
66 _kernel_cre_ctx((pk_ctxcb), (isp), (entry), (exinf1), (exinf2)) /**< %jp{実行コンテキストの作成} */
67 #define _KERNEL_DEL_CTX(pk_ctxcb) do {} while (0) /**< %jp{実行コンテキストの削除} */
68 #define _KERNEL_RST_CTX(pk_ctxcb, stksz, stk, isp, entry, exinf1, exinf2) \
69 _kernel_rst_ctx((exinf1), (exinf2), (entry), (isp)) /**< %jp{実行コンテキストのリスタート} */
70 #define _KERNEL_STA_CTX(pk_ctxcb) _kernel_sta_ctx(pk_ctxcb)
71 #define _KERNEL_SWI_CTX(pk_ctxcb_now, pk_ctxinf_nxt) \
72 _kernel_swi_ctx((pk_ctxinf_nxt), (pk_ctxcb_now)) /**< %jp{実行コンテキストの切替} */
75 #define _KERNEL_PROC_SET_CTX() do { } while (0)
76 #define _KERNEL_PROC_CLR_CTX() do { } while (0)
77 #define _KERNEL_PROC_SNS_CTX() ((_kernel_ref_cpu_control() & 0x00000002) == 0)
79 #define _KERNEL_PROC_SET_DLY() do { *_KERNEL_REG_INT_CONTROL |= 0x10000000; } while (0)
80 #define _KERNEL_PROC_CLR_DLY() do { *_KERNEL_REG_INT_CONTROL |= 0x08000000; } while (0)
81 #define _KERNEL_PROC_SNS_DLY() ((*_KERNEL_REG_INT_CONTROL & 0x10000000) != 0)
84 #endif /* _KERNEL__arch__proc__arm__arm_v7m__proc_h__ */