OSDN Git Service

rename arm_v7m to cortex-m3
[hos/hos-v4a.git] / kernel / include / arch / proc / arm / cortex_m3 / proc.h
1 /** 
2  *  Hyper Operating System V4 Advance
3  *
4  * @file  proc.h
5  * @brief %jp{ARM Cortex-M3}%en{Cortex-M3}
6  *
7  * Copyright (C) 1998-2011 by Project HOS
8  * http://sourceforge.jp/projects/hos/
9  */
10
11
12 #ifndef _KERNEL__arch__proc__arm__cortex_m3__proc_h__
13 #define _KERNEL__arch__proc__arm__cortex_m3__proc_h__
14
15
16
17 #define _KERNEL_IMSK_F          0x40            /**< %jp{FIQ割込みマスクビット} */
18 #define _KERNEL_IMSK_I          0x80            /**< %jp{IRQ割込みマスクビット} */
19
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(すべて許可)} */
23
24
25
26 /** %jp{コンテキスト制御ブロック} */
27 typedef struct _kernel_t_ctxcb
28 {
29         VP      sp;
30 } _KERNEL_T_CTXCB;
31
32 /** %jp{割込みコンテキスト制御ブロック} */
33 typedef struct _kernel_t_ictxcb
34 {
35         UB  imsk;
36         UB      intcnt;
37         VP      isp;
38 } _KERNEL_T_ICTXCB;
39
40
41 extern _KERNEL_T_ICTXCB _kernel_ictxcb;         /**< %jp{割込みコンテキスト制御ブロック} */
42
43
44
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48
49 void    _kernel_reset_handler(void);
50 void    _kernel_nmi_handler();
51 void    _kernel_hw_fault_handler();
52
53 void    _kernel_ena_int(void);                                                                                                                                          /**< %jp{割込み許可} */
54 void    _kernel_dis_int(void);                                                                                                                                          /**< %jp{割込み禁止} */
55 void    _kernel_wai_int(void);                                                                                                                                          /**< %jp{割込み待ち(アイドル時の処理)} */
56
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{実行コンテキストの切替} */
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66
67
68 #define _KERNEL_INI_PRC()                       do {} while (0)                                                                                                 /**< %jp{プロセッサ固有の初期化} */
69
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{割込み待ち(アイドル時の処理)} */
74
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{実行コンテキストの切替} */
83
84
85 #endif  /* _KERNEL__arch__proc__arm__cortex_m3__proc_h__ */
86
87
88
89 /* end of file */