prc_config.h

#include "prc_insn.h"

ソースコードを見る。

データ構造

struct  task_context_block
struct  exc_vector_entry

マクロ定義

#define EXT_IPM(iipm)   (-CAST(PRI, (iipm) >> 8))
#define INT_IPM(ipm)   (CAST(uint16_t, -(ipm)) << 8)
#define IIPM_LOCK   INT_IPM(TIPM_LOCK)
#define IIPM_ENAALL   INT_IPM(TIPM_ENAALL)
#define t_lock_cpu()   x_lock_cpu()
#define i_lock_cpu()   x_lock_cpu()
#define t_unlock_cpu()   x_unlock_cpu()
#define i_unlock_cpu()   x_unlock_cpu()
#define t_sense_lock()   x_sense_lock()
#define i_sense_lock()   x_sense_lock()
#define VALID_INTPRI_CHGIPM(intpri)   ((-6 <= (intpri) && (intpri) <= TIPM_ENAALL))
#define t_set_ipm(intpri)   x_set_ipm(intpri)
#define i_set_ipm(intpri)   x_set_ipm(intpri)
#define t_get_ipm()   x_get_ipm()
#define i_get_ipm()   x_get_ipm()
#define activate_context(p_tcb)
#define OMIT_CALLTEX
#define VALID_INHNO_DEFINH(inhno)
#define VALID_EXCNO_DEFEXC(excno)
#define INT_ENTRY(inhno, inthdr)   _kernel_##inthdr##_##inhno
#define CALL_LOG_INH_ENTER(inhno_num)
#define INTHDR_ENTRY(inhno, inhno_num, inthdr)
#define EXC_ENTRY(excno, exchdr)   _kernel_##exchdr##_##excno
#define CALL_LOG_EXC_ENTER(excno_num)
#define EXCHDR_ENTRY(excno, excno_num, exchdr)

型定義

typedef struct task_context_block CTXB
typedef struct exc_vector_entry EXCVE

関数

Inline uint16_t current_iipm (void)
Inline void set_iipm (uint16_t iipm)
Inline bool_t sense_context (void)
Inline void x_lock_cpu (void)
Inline void x_unlock_cpu (void)
Inline bool_t x_sense_lock (void)
Inline void x_set_ipm (PRI intpri)
Inline PRI x_get_ipm (void)
void dispatch (void)
void start_dispatch (void) NoReturn
void exit_and_dispatch (void) NoReturn
void call_exit_kernel (void) NoReturn
void start_r (void)
Inline void x_define_inh (INHNO inhno, FP int_entry)
Inline void x_define_exc (EXCNO excno, FP exc_entry)
Inline bool_t exc_sense_context (void *p_excinf)
Inline uint16_t exc_get_iipm (void *p_excinf)
Inline bool_t exc_sense_intmask (void *p_excinf)
Inline bool_t exc_sense_unlock (void *p_excinf)
void prc_initialize (void)
void prc_terminate (void)
Inline void call_atexit (void)

変数

volatile bool_t lock_flag
volatile uint16_t saved_iipm


マクロ定義

#define activate_context ( p_tcb   ) 

値:

{                                                                       \
    (p_tcb)->tskctxb.msp = (void *)((char *)((p_tcb)->p_tinib->stk)     \
                                        + (p_tcb)->p_tinib->stksz);     \
    (p_tcb)->tskctxb.pc = (void *) start_r;                             \
}

prc_config.h371 行で定義されています。

参照元 make_active().

#define CALL_LOG_EXC_ENTER ( excno_num   ) 

prc_config.h546 行で定義されています。

#define CALL_LOG_INH_ENTER ( inhno_num   ) 

prc_config.h470 行で定義されています。

#define EXC_ENTRY ( excno,
exchdr   )     _kernel_##exchdr##_##excno

prc_config.h531 行で定義されています。

#define EXCHDR_ENTRY ( excno,
excno_num,
exchdr   ) 

値:

extern void _kernel_##exchdr##_##excno(void *sp); \
asm(".text                          \n" \
"_kernel_" #exchdr "_" #excno ":    \n" \
"   movem.l %d0-%d1/%a0-%a1, -(%sp) \n"  /* å쥸¸ */ \
"   lea.l 16(%sp), %a0              \n"  /* 㳰ե졼ƬA0 */ \
"   move.w %sr, %d0                 \n"  /* SRD0 */ \
"   and.w #~0x1000, %sr             \n"  /* ߥ⡼ɡʥåڴ*/ \
"   move.l %d0, -(%sp)              \n"  /* SR򥹥å¸ */ \
"   move.l _kernel_lock_flag, %d0   \n"  /* lock_flag򥹥å¸ */ \
"   move.l %d0, -(%sp)              \n" \
"   move.l %a0, -(%sp)              \n"  /* A0ѥ᡼ȤϤ */ \
    CALL_LOG_EXC_ENTER(excno_num) \
"   move.l #_kernel_ret_exc, -(%sp) \n"  /* Ϥ򥹥åѤ */ \
"   jmp " #exchdr "                 \n");

prc_config.h590 行で定義されています。

#define EXT_IPM ( iipm   )     (-CAST(PRI, (iipm) >> 8))

prc_config.h86 行で定義されています。

参照元 x_get_ipm().

 
#define i_get_ipm (  )     x_get_ipm()

prc_config.h321 行で定義されています。

参照元 call_almhdr(), と call_cychdr().

 
#define i_lock_cpu (  )     x_lock_cpu()

 
#define i_sense_lock (  )     x_sense_lock()

prc_config.h257 行で定義されています。

参照元 call_almhdr(), call_cychdr(), iloc_cpu(), iunl_cpu(), と signal_time().

#define i_set_ipm ( intpri   )     x_set_ipm(intpri)

prc_config.h298 行で定義されています。

参照元 call_almhdr(), と call_cychdr().

 
#define i_unlock_cpu (  )     x_unlock_cpu()

#define IIPM_ENAALL   INT_IPM(TIPM_ENAALL)

prc_config.h173 行で定義されています。

参照元 exc_sense_intmask(), と prc_initialize().

#define IIPM_LOCK   INT_IPM(TIPM_LOCK)

prc_config.h168 行で定義されています。

参照元 exc_sense_unlock(), x_lock_cpu(), と x_set_ipm().

#define INT_ENTRY ( inhno,
inthdr   )     _kernel_##inthdr##_##inhno

prc_config.h455 行で定義されています。

#define INT_IPM ( ipm   )     (CAST(uint16_t, -(ipm)) << 8)

prc_config.h87 行で定義されています。

参照元 x_set_ipm().

#define INTHDR_ENTRY ( inhno,
inhno_num,
inthdr   ) 

値:

extern void _kernel_##inthdr##_##inhno(void); \
asm(".text                          \n" \
"_kernel_" #inthdr "_" #inhno ":    \n" \
"   movem.l %d0-%d1/%a0-%a1, -(%sp) \n"  /* å쥸¸ */ \
    CALL_LOG_INH_ENTER(inhno_num) \
"   move.l #_kernel_ret_int, -(%sp) \n"  /* Ϥ򥹥åѤ */ \
"   jmp " #inthdr "                 \n");

prc_config.h507 行で定義されています。

#define OMIT_CALLTEX

prc_config.h381 行で定義されています。

 
#define t_get_ipm (  )     x_get_ipm()

prc_config.h320 行で定義されています。

参照元 call_texrtn(), ena_dsp(), ext_tsk(), と get_ipm().

 
#define t_lock_cpu (  )     x_lock_cpu()

 
#define t_sense_lock (  )     x_sense_lock()

prc_config.h256 行で定義されています。

参照元 call_texrtn(), chg_ipm(), ext_tsk(), get_ipm(), loc_cpu(), sns_dpn(), と unl_cpu().

#define t_set_ipm ( intpri   )     x_set_ipm(intpri)

prc_config.h297 行で定義されています。

参照元 call_texrtn(), chg_ipm(), と ext_tsk().

 
#define t_unlock_cpu (  )     x_unlock_cpu()

#define VALID_EXCNO_DEFEXC ( excno   ) 

値:

((0x02U <= (excno) && (excno) <= 0x0fU) \
                                    || (0x20U <= (excno) && (excno) <= 0x3fU))

prc_config.h395 行で定義されています。

参照元 x_define_exc().

#define VALID_INHNO_DEFINH ( inhno   ) 

値:

((0x10U <= (inhno) && (inhno) <= 0x1fU) \
                                    || (0x40U <= (inhno) && (inhno) <= 0xffU))

prc_config.h393 行で定義されています。

参照元 x_define_inh().

#define VALID_INTPRI_CHGIPM ( intpri   )     ((-6 <= (intpri) && (intpri) <= TIPM_ENAALL))

prc_config.h265 行で定義されています。


型定義

typedef struct task_context_block CTXB

typedef struct exc_vector_entry EXCVE


関数

Inline void call_atexit ( void   ) 

prc_config.h691 行で定義されています。

参照元 exit_kernel().

00692 {
00693     extern void software_term_hook(void);
00694     void (*volatile fp)(void) = software_term_hook;
00695 
00696     /*
00697      *  software_term_hookへのポインタを,一旦volatile指定のあるfpに代
00698      *  入してから使うのは,0との比較が最適化で削除されないようにするた
00699      *  めである.
00700      */
00701     if (fp != 0) {
00702         (*fp)();
00703     }
00704 }

void call_exit_kernel ( void   ) 

Inline uint16_t current_iipm ( void   ) 

prc_config.h95 行で定義されています。

参照先 current_sr().

参照元 x_get_ipm(), と x_lock_cpu().

00096 {
00097     return(current_sr() & 0x0700U);
00098 }

void dispatch ( void   ) 

Inline uint16_t exc_get_iipm ( void *  p_excinf  ) 

prc_config.h625 行で定義されています。

参照元 exc_sense_intmask(), と exc_sense_unlock().

00626 {
00627     return(*((uint16_t *) p_excinf) & 0x0700U);
00628 }

Inline bool_t exc_sense_context ( void *  p_excinf  ) 

prc_config.h615 行で定義されています。

参照元 exc_sense_intmask(), と exc_sense_unlock().

00616 {
00617     return((*((uint16_t *) p_excinf) & 0x1000U) == 0U);
00618 }

Inline bool_t exc_sense_intmask ( void *  p_excinf  ) 

prc_config.h647 行で定義されています。

参照先 exc_get_iipm(), exc_sense_context(), と IIPM_ENAALL.

参照元 xsns_dpn().

00648 {
00649     return(!exc_sense_context(p_excinf)
00650                     && exc_get_iipm(p_excinf) == IIPM_ENAALL);
00651 }

Inline bool_t exc_sense_unlock ( void *  p_excinf  ) 

prc_config.h671 行で定義されています。

参照先 exc_get_iipm(), exc_sense_context(), と IIPM_LOCK.

参照元 xsns_xpn().

00672 {
00673     return(!exc_sense_context(p_excinf)
00674                     && exc_get_iipm(p_excinf) < IIPM_LOCK);
00675 }

void exit_and_dispatch ( void   ) 

void prc_initialize ( void   ) 

prc_config.c61 行で定義されています。

参照先 IIPM_ENAALL, lock_flag, saved_iipm, と set_vbr().

00062 {
00063     /*
00064      *  CPUロックフラグ実現のための変数の初期化
00065      */
00066     lock_flag = true;
00067     saved_iipm = IIPM_ENAALL;
00068 
00069     /*
00070      *  例外ベクタテーブルの初期化
00071      */
00072 #ifdef EXCVT_KERNEL
00073     memcpy(EXCVT_KERNEL, EXCVT_ORIG, EXCVT_LEN);
00074     set_vbr(EXCVT_KERNEL);
00075 #endif /* EXCVT_KERNEL */
00076 }

void prc_terminate ( void   ) 

prc_config.c82 行で定義されています。

参照先 set_vbr().

00083 {
00084 #ifdef EXCVT_KERNEL
00085     set_vbr(EXCVT_ORIG);
00086 #endif /* EXCVT_KERNEL */
00087 }

Inline bool_t sense_context ( void   ) 

prc_config.h141 行で定義されています。

参照先 current_sr().

参照元 signal_time(), sns_ctx(), と sns_dpn().

00142 {
00143     return((current_sr() & 0x1000U) == 0U);
00144 }

Inline void set_iipm ( uint16_t  iipm  ) 

prc_config.h104 行で定義されています。

参照先 current_sr(), と set_sr().

参照元 x_lock_cpu(), x_set_ipm(), と x_unlock_cpu().

00105 {
00106     set_sr((current_sr() & ~0x0700U) | iipm);
00107 }

void start_dispatch ( void   ) 

void start_r ( void   ) 

Inline void x_define_exc ( EXCNO  excno,
FP  exc_entry 
)

prc_config.h430 行で定義されています。

参照先 assert, current_vbr(), exc_vector_entry::exc_handler, と VALID_EXCNO_DEFEXC.

参照元 initialize_exception().

00431 {
00432     EXCVE   *excvt;
00433 
00434     assert(VALID_EXCNO_DEFEXC(excno));
00435 
00436 #ifdef EXCVT_KERNEL
00437     /*
00438      *  EXCVT_KERNELが定義されている時は,初期化処理の中でVBRを
00439      *  EXCVT_KERNELに設定するので,EXCVT_KERNELを使う.
00440      */
00441     excvt = (EXCVE *) EXCVT_KERNEL;
00442 #else /* EXCVT_KERNEL */
00443     excvt = (EXCVE *) current_vbr();
00444 #endif /* EXCVT_KERNEL */
00445     excvt[excno].exc_handler = exc_entry;
00446 }

Inline void x_define_inh ( INHNO  inhno,
FP  int_entry 
)

prc_config.h405 行で定義されています。

参照先 assert, current_vbr(), exc_vector_entry::exc_handler, と VALID_INHNO_DEFINH.

参照元 initialize_interrupt().

00406 {
00407     EXCVE   *excvt;
00408 
00409     assert(VALID_INHNO_DEFINH(inhno));
00410 
00411 #ifdef EXCVT_KERNEL
00412     /*
00413      *  EXCVT_KERNELが定義されている時は,初期化処理の中でVBRを
00414      *  EXCVT_KERNELに設定するので,EXCVT_KERNELを使う.
00415      */
00416     excvt = (EXCVE *) EXCVT_KERNEL;
00417 #else /* EXCVT_KERNEL */
00418     excvt = (EXCVE *) current_vbr();
00419 #endif /* EXCVT_KERNEL */
00420     excvt[inhno].exc_handler = int_entry;
00421 }

Inline PRI x_get_ipm ( void   ) 

prc_config.h307 行で定義されています。

参照先 current_iipm(), EXT_IPM, lock_flag, と saved_iipm.

00308 {
00309     uint16_t    iipm;
00310 
00311     if (!lock_flag) {
00312         iipm = current_iipm();
00313     }
00314     else {
00315         iipm = saved_iipm;
00316     }
00317     return(EXT_IPM(iipm));
00318 }

Inline void x_lock_cpu ( void   ) 

prc_config.h201 行で定義されています。

参照先 Asm, current_iipm(), disint(), IIPM_LOCK, lock_flag, saved_iipm, と set_iipm().

00202 {
00203     uint16_t    iipm;
00204 
00205     /*
00206      *  current_iipm()の返り値を直接saved_iipmに保存せず,一時変数iipm
00207      *  を用いているのは,current_iipm()を呼んだ直後に割込みが発生し,
00208      *  起動された割込み処理でsaved_iipmが変更される可能性があるためで
00209      *  ある.
00210      */
00211     iipm = current_iipm();
00212 #if TIPM_LOCK == -7
00213     disint();
00214 #else /* TIPM_LOCK == -7 */
00215     if (IIPM_LOCK > iipm) {
00216         set_iipm(IIPM_LOCK);
00217     }
00218 #endif /* TIPM_LOCK == -7 */
00219     saved_iipm = iipm;
00220     lock_flag = true;
00221     Asm("":::"memory");
00222 }

Inline bool_t x_sense_lock ( void   ) 

prc_config.h251 行で定義されています。

参照先 lock_flag.

参照元 sns_loc().

00252 {
00253     return(lock_flag);
00254 }

Inline void x_set_ipm ( PRI  intpri  ) 

prc_config.h277 行で定義されています。

参照先 IIPM_LOCK, INT_IPM, lock_flag, saved_iipm, と set_iipm().

00278 {
00279     uint16_t    iipm = INT_IPM(intpri);
00280 
00281     if (!lock_flag) {
00282         set_iipm(iipm);
00283     }
00284     else {
00285         saved_iipm = iipm;
00286 #if TIPM_LOCK == -7
00287         /*
00288          *  TIPM_LOCKが-7の場合には,この時点でハードウェアの割込み優先
00289          *  度マスクが必ず7に設定されているため,設定しなおす必要がない.
00290          */
00291 #else /* TIPM_LOCK == -7 */
00292         set_iipm(iipm > IIPM_LOCK ? iipm : IIPM_LOCK);
00293 #endif /* TIPM_LOCK == -7 */
00294     }
00295 }

Inline void x_unlock_cpu ( void   ) 

prc_config.h237 行で定義されています。

参照先 Asm, lock_flag, saved_iipm, と set_iipm().

00238 {
00239     Asm("":::"memory");
00240     lock_flag = false;
00241     set_iipm(saved_iipm);
00242 }


変数

volatile bool_t lock_flag

prc_config.c54 行で定義されています。

volatile uint16_t saved_iipm

prc_config.c55 行で定義されています。


Copyright © 2008 by Kijineko Inc.

ホームページ制作