OSDN Git Service

add cortex-a9 base
[hos/hos-v4a.git] / kernel / include / arch / proc / arm / arm_v7a / proc.h
1 /** 
2  *  Hyper Operating System V4 Advance
3  *
4  * @file  proc.h
5  * @brief %jp{コンテキスト制御}%en{context control}
6  *
7  * Copyright (C) 1998-2014 by Project HOS
8  * http://sourceforge.jp/projects/hos/
9  */
10
11
12 #ifndef _KERNEL__arch__proc__arm__arm_v7a__proc_h__
13 #define _KERNEL__arch__proc__arm__arm_v7a__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_ena_int(void);                                                                                                                                          /**< %jp{割込み許可} */
50 void    _kernel_dis_int(void);                                                                                                                                          /**< %jp{割込み禁止} */
51 void    _kernel_wai_int(void);                                                                                                                                          /**< %jp{割込み待ち(アイドル時の処理)} */
52
53 void    _kernel_cre_ctx(_KERNEL_T_CTXCB *pk_ctxcb, VP isp, FP entry, VP_INT par1, VP_INT par2);         /**< %jp{実行コンテキストの作成} */
54 void    _kernel_rst_ctx(VP_INT par1, VP_INT par2, FP entry, VP isp);                                                            /**< %jp{実行コンテキストのリスタート} */
55 void    _kernel_sta_ctx(_KERNEL_T_CTXCB *pk_ctxcb);                                                                                                     /**< %jp{実行コンテキストの開始} */
56 void    _kernel_swi_ctx(_KERNEL_T_CTXCB *pk_ctxinf_nxt, _KERNEL_T_CTXCB *pk_ctxcb_now);                         /**< %jp{実行コンテキストの切替} */
57
58 #ifdef __cplusplus
59 }
60 #endif
61
62
63
64 #define _KERNEL_INI_PRC()                       do {} while (0)                                                                                                 /**< %jp{プロセッサ固有の初期化} */
65
66 #define _KERNEL_INI_INT(stksz, stk)     do { _kernel_ictxcb.isp = (VB *)(stk) + (stksz); } while (0)    /**< %jp{割込み初期化} */
67 #define _KERNEL_ENA_INT()                       _kernel_ena_int()                                                                                               /**< %jp{割込み許可} */
68 #define _KERNEL_DIS_INT()                       _kernel_dis_int()                                                                                               /**< %jp{割込み禁止} */
69 #define _KERNEL_WAI_INT()                       _kernel_wai_int()                                                                                               /**< %jp{割込み待ち(アイドル時の処理)} */
70
71 #define _KERNEL_CRE_CTX(pk_ctxcb, stksz, stk, isp, entry, exinf1, exinf2)               \
72                                                                         _kernel_cre_ctx((pk_ctxcb), (isp), (entry), (exinf1), (exinf2)) /**< %jp{実行コンテキストの作成} */  
73 #define _KERNEL_DEL_CTX(pk_ctxcb)       do {} while (0)                                                                                                 /**< %jp{実行コンテキストの削除} */
74 #define _KERNEL_RST_CTX(pk_ctxcb, stksz, stk, isp, entry, exinf1, exinf2)               \
75                                                                         _kernel_rst_ctx((exinf1), (exinf2), (entry), (isp))                             /**< %jp{実行コンテキストのリスタート} */
76 #define _KERNEL_STA_CTX(pk_ctxcb)       _kernel_sta_ctx(pk_ctxcb)
77 #define _KERNEL_SWI_CTX(pk_ctxcb_now, pk_ctxinf_nxt)                                                    \
78                                                                         _kernel_swi_ctx((pk_ctxinf_nxt), (pk_ctxcb_now))                                /**< %jp{実行コンテキストの切替} */
79
80
81 #endif  /* _KERNEL__arch__proc__arm__arm_v7a__proc_h__ */
82
83
84
85 /* end of file */