2 * Hyper Operating System V4 Advance
5 * @brief %jp{ARM Cortex-M3}%en{Cortex-M3}
7 * Copyright (C) 1998-2011 by Project HOS
8 * http://sourceforge.jp/projects/hos/
12 #ifndef _KERNEL__arch__proc__arm__cortex_m3__proc_h__
13 #define _KERNEL__arch__proc__arm__cortex_m3__proc_h__
17 #define _KERNEL_IMSK_F 0x40 /**< %jp{FIQ割込みマスクビット} */
18 #define _KERNEL_IMSK_I 0x80 /**< %jp{IRQ割込みマスクビット} */
20 #define _KERNEL_IMSK_LV0 0xc0 /**< %jp{割込みマスクレベル0(すべてマスク)} */
21 #define _KERNEL_IMSK_LV1 0x80 /**< %jp{割込みマスクレベル1(FIQのみ許可)} */
22 #define _KERNEL_IMSK_LV2 0x00 /**< %jp{割込みマスクレベル2(すべて許可)} */
26 /** %jp{コンテキスト制御ブロック} */
27 typedef struct _kernel_t_ctxcb
32 /** %jp{割込みコンテキスト制御ブロック} */
33 typedef struct _kernel_t_ictxcb
41 extern _KERNEL_T_ICTXCB _kernel_ictxcb; /**< %jp{割込みコンテキスト制御ブロック} */
49 void _kernel_reset_handler(void);
50 void _kernel_nmi_handler();
51 void _kernel_hw_fault_handler();
53 void _kernel_ena_int(void); /**< %jp{割込み許可} */
54 void _kernel_dis_int(void); /**< %jp{割込み禁止} */
55 void _kernel_wai_int(void); /**< %jp{割込み待ち(アイドル時の処理)} */
57 void _kernel_cre_ctx(_KERNEL_T_CTXCB *pk_ctxcb, VP isp, FP entry, VP_INT par1, VP_INT par2); /**< %jp{実行コンテキストの作成} */
58 void _kernel_rst_ctx(VP_INT par1, VP_INT par2, FP entry, VP isp); /**< %jp{実行コンテキストのリスタート} */
59 void _kernel_sta_ctx(_KERNEL_T_CTXCB *pk_ctxcb); /**< %jp{実行コンテキストの開始} */
60 void _kernel_swi_ctx(_KERNEL_T_CTXCB *pk_ctxinf_nxt, _KERNEL_T_CTXCB *pk_ctxcb_now); /**< %jp{実行コンテキストの切替} */
68 #define _KERNEL_INI_PRC() do {} while (0) /**< %jp{プロセッサ固有の初期化} */
70 #define _KERNEL_INI_INT(stksz, stk) do { _kernel_ictxcb.isp = (VB *)(stk) + (stksz); } while (0) /**< %jp{割込み初期化} */
71 #define _KERNEL_ENA_INT() _kernel_ena_int() /**< %jp{割込み許可} */
72 #define _KERNEL_DIS_INT() _kernel_dis_int() /**< %jp{割込み禁止} */
73 #define _KERNEL_WAI_INT() _kernel_wai_int() /**< %jp{割込み待ち(アイドル時の処理)} */
75 #define _KERNEL_CRE_CTX(pk_ctxcb, stksz, stk, isp, entry, exinf1, exinf2) \
76 _kernel_cre_ctx((pk_ctxcb), (isp), (entry), (exinf1), (exinf2)) /**< %jp{実行コンテキストの作成} */
77 #define _KERNEL_DEL_CTX(pk_ctxcb) do {} while (0) /**< %jp{実行コンテキストの削除} */
78 #define _KERNEL_RST_CTX(pk_ctxcb, stksz, stk, isp, entry, exinf1, exinf2) \
79 _kernel_rst_ctx((exinf1), (exinf2), (entry), (isp)) /**< %jp{実行コンテキストのリスタート} */
80 #define _KERNEL_STA_CTX(pk_ctxcb) _kernel_sta_ctx(pk_ctxcb)
81 #define _KERNEL_SWI_CTX(pk_ctxcb_now, pk_ctxinf_nxt) \
82 _kernel_swi_ctx((pk_ctxinf_nxt), (pk_ctxcb_now)) /**< %jp{実行コンテキストの切替} */
85 #endif /* _KERNEL__arch__proc__arm__cortex_m3__proc_h__ */