[4] | 1 | /*
|
---|
| 2 | * TOPPERS/OSEK Kernel
|
---|
| 3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
| 4 | * OSEK Kernel
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
|
---|
| 7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
| 8 | * Copyright (C) 2001-2003 by Industrial Technology Institute,
|
---|
| 9 | * Miyagi Prefectural Government, JAPAN
|
---|
| 10 | * Copyright (C) 2006 by Witz Corporation, JAPAN
|
---|
| 11 | *
|
---|
| 12 | * ãLì ÒÍCÈºÌ (1)`(4) Ìð©CFree Software Foundation
|
---|
| 13 | * ÉæÁÄö\³êÄ¢é GNU General Public License Ì Version 2 ÉL
|
---|
| 14 | * q³êÄ¢éðð½·êÉÀèC{\tgEFAi{\tgEFA
|
---|
| 15 | * ðüϵ½àÌðÜÞDȺ¯¶jðgpE¡»EüÏEÄzziȺC
|
---|
| 16 | * pÆÄÔj·é±Æð³Åø·éD
|
---|
| 17 | * (1) {\tgEFAð\[XR[hÌ`Åp·éêÉÍCãLÌì
|
---|
| 18 | * \¦C±Ìpð¨æѺL̳ÛØKèªC»ÌÜÜÌ`Å\[
|
---|
| 19 | * XR[hÉÜÜêÄ¢é±ÆD
|
---|
| 20 | * (2) {\tgEFAðCCu`®ÈÇC¼Ì\tgEFAJÉg
|
---|
| 21 | * pÅ«é`ÅÄzz·éêÉÍCÄzzɺ¤hL
|
---|
| 22 | gip
|
---|
| 23 | * Ò}j
|
---|
| 24 | AÈÇjÉCãLÌì \¦C±Ìpð¨æѺL
|
---|
| 25 | * ̳ÛØKèðfÚ·é±ÆD
|
---|
| 26 | * (3) {\tgEFAðC@íÉgÝÞÈÇC¼Ì\tgEFAJÉg
|
---|
| 27 | * pÅ«È¢`ÅÄzz·éêÉÍCÌ¢¸ê©Ìðð½·±
|
---|
| 28 | * ÆD
|
---|
| 29 | * (a) Äzzɺ¤hL
|
---|
| 30 | gipÒ}j
|
---|
| 31 | AÈÇjÉCãLÌ
|
---|
| 32 | * ì \¦C±Ìpð¨æѺL̳ÛØKèðfÚ·é±ÆD
|
---|
| 33 | * (b) ÄzzÌ`ÔðCÊÉèßéû@ÉæÁÄCTOPPERSvWFNgÉ
|
---|
| 34 | * ñ·é±ÆD
|
---|
| 35 | * (4) {\tgEFAÌpÉæè¼ÚIܽÍÔÚIɶ¶é¢©Èé¹
|
---|
| 36 | * Q©çàCãLì Ò¨æÑTOPPERSvWFNgðÆÓ·é±ÆD
|
---|
| 37 | *
|
---|
| 38 | * {\tgEFAÍC³ÛØÅñ³êÄ¢éàÌÅ éDãLì Ò¨
|
---|
| 39 | * æÑTOPPERSvWFNgÍC{\tgEFAÉÖµÄC»ÌKpÂ\«à
|
---|
| 40 | * ÜßÄC¢©ÈéÛØàsíÈ¢DܽC{\tgEFAÌpÉæè¼
|
---|
| 41 | * ÚIܽÍÔÚIɶ¶½¢©Èé¹QÉÖµÄàC»ÌÓCðíÈ¢D
|
---|
| 42 | *
|
---|
| 43 | */
|
---|
| 44 |
|
---|
| 45 | /*
|
---|
| 46 | * áxvZbTì[`(SH2p)
|
---|
| 47 | */
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | #ifndef _CPU_INSN_H_
|
---|
| 51 | #define _CPU_INSN_H_
|
---|
| 52 |
|
---|
| 53 | /*
|
---|
| 54 | * InlineÖvg^Cvé¾
|
---|
| 55 | */
|
---|
| 56 | Inline void disable_int(void);
|
---|
| 57 | Inline void enable_int(void);
|
---|
| 58 | Inline void nop(void);
|
---|
| 59 | Inline void set_sr(UINT32 sr);
|
---|
| 60 | Inline UINT32 current_sr(void);
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | extern UINT32 lock_flag;
|
---|
| 64 | extern UINT32 intmask;
|
---|
| 65 |
|
---|
| 66 | /*
|
---|
| 67 | * Xe[^XWX^iSRjÌ»ÝlÌÏX
|
---|
| 68 | */
|
---|
| 69 | Inline void
|
---|
| 70 | set_sr(UINT32 sr)
|
---|
| 71 | {
|
---|
| 72 | Asm("ldc %0, sr" : : "r"(sr) );
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | /*
|
---|
| 76 | * Xe[^XWX^iSRjÌ»ÝlÌÇoµ
|
---|
| 77 | */
|
---|
| 78 | Inline UINT32
|
---|
| 79 | current_sr(void)
|
---|
| 80 | {
|
---|
| 81 | UINT32 sr;
|
---|
| 82 | Asm("stc sr,%0" : "=r"(sr));
|
---|
| 83 | return(sr);
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | /*
|
---|
| 88 | * OÝSÖ~
|
---|
| 89 | */
|
---|
| 90 | Inline void
|
---|
| 91 | disable_int(void)
|
---|
| 92 | {
|
---|
| 93 | volatile UINT32 intmask_temp;
|
---|
| 94 |
|
---|
| 95 | /*
|
---|
| 96 | * ±±Å[JÏÉSRWX^ÌlðÛ¶µÄ¢éÌÍA
|
---|
| 97 | * SRWX^ÌÇÝoµÆÀÛÉÝÖ~ÌÔÉèݪüÁ½êÉA
|
---|
| 98 | * èÝnhàÅèÝÖ~ðÀs·éÆintmasklª
|
---|
| 99 | * «·íÁĵܤ½ßÅ é
|
---|
| 100 | */
|
---|
| 101 |
|
---|
| 102 | intmask_temp = current_sr() & 0x000000f0u;
|
---|
| 103 | set_sr((current_sr() & ~0x000000f0u) | (MAX_IPM << 4) );
|
---|
| 104 | intmask = intmask_temp;
|
---|
| 105 | lock_flag = 1;
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 |
|
---|
| 109 | /*
|
---|
| 110 | * OÝSÖ~ð
|
---|
| 111 | */
|
---|
| 112 | Inline void
|
---|
| 113 | enable_int(void)
|
---|
| 114 | {
|
---|
| 115 | lock_flag = 0;
|
---|
| 116 | set_sr((current_sr() & ~0x000000f0u) | intmask);
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 |
|
---|
| 120 | /*
|
---|
| 121 | * nop ½ßÌÀs
|
---|
| 122 | */
|
---|
| 123 | Inline void
|
---|
| 124 | nop(void)
|
---|
| 125 | {
|
---|
| 126 | asm(" nop");
|
---|
| 127 | }
|
---|
| 128 |
|
---|
| 129 | #endif /* _CPU_INSN_H_ */
|
---|