[26] | 1 | /*
|
---|
| 2 | * TOPPERS/JSP Kernel
|
---|
| 3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
| 4 | * Just Standard Profile Kernel
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2000-2002 by Embedded and Real-Time Systems Laboratory
|
---|
| 7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
| 8 | * Copyright (C) 2005 by Freelines CO.,Ltd
|
---|
| 9 | *
|
---|
| 10 | * ä¸è¨èä½æ¨©è
|
---|
| 11 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
| 12 | * ã«ãã£ã¦å
|
---|
| 13 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
| 14 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
| 15 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
| 16 | å¸ï¼ä»¥ä¸ï¼
|
---|
| 17 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 18 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 19 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 20 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 21 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 22 | * ç¨ã§ããå½¢ã§åé
|
---|
| 23 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 24 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 25 | * è
|
---|
| 26 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 27 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 28 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 29 | * ç¨ã§ããªãå½¢ã§åé
|
---|
| 30 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
| 31 | * ã¨ï¼
|
---|
| 32 | * (a) åé
|
---|
| 33 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 34 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 35 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 36 | * (b) åé
|
---|
| 37 | å¸ã®å½¢æ
|
---|
| 38 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
| 39 | * å ±åãããã¨ï¼
|
---|
| 40 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 41 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 42 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 43 | 責ãããã¨ï¼
|
---|
| 44 | *
|
---|
| 45 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 46 | ã
|
---|
| 47 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
| 48 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
| 49 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
| 50 | *
|
---|
| 51 | * @(#) $Id: sys_support.S,v 1.2 2007/01/05 02:10:17 honda Exp $
|
---|
| 52 | */
|
---|
| 53 |
|
---|
| 54 | /*
|
---|
| 55 | * ã¿ã¼ã²ããã·ã¹ãã ä¾åã¢ã¸ã¥ã¼ã« ã¢ã»ã³ããªè¨èªé¨ï¼TK-850ES/SG2ç¨ï¼
|
---|
| 56 | */
|
---|
| 57 |
|
---|
| 58 | #define _MACRO_ONLY
|
---|
| 59 | #include "jsp_kernel.h"
|
---|
| 60 | #include "v850asm.inc"
|
---|
| 61 |
|
---|
| 62 | #define Set(x,y,z) Lea x, r6; Lea y, r7; st.##z r7, 0[r6]
|
---|
| 63 |
|
---|
| 64 | /*
|
---|
| 65 | * ä½ã¬ãã«ã®ã¿ã¼ã²ããã·ã¹ãã ä¾åã®åæå
|
---|
| 66 | *
|
---|
| 67 | * ã¹ã¿ã¼ãã¢ããã¢ã¸ã¥ã¼ã«ã®ä¸ã§ï¼ã¡ã¢ãªã®åæåã®åã«å¼ã³åºãããï¼
|
---|
| 68 | */
|
---|
| 69 |
|
---|
| 70 | .text
|
---|
| 71 | .globl hardware_init_hook
|
---|
| 72 | hardware_init_hook:
|
---|
| 73 |
|
---|
| 74 | /* ã·ã¹ãã ã¦ã§ã¤ãã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼5MHzÃ4=20MHzæ */
|
---|
| 75 | Set(VSWC, 0x01, b)
|
---|
| 76 | nop
|
---|
| 77 | /* ä¿è·ãããç¹å®ã¬ã¸ã¹ã¿ã¸ã®ã¢ã¯ã»ã¹
|
---|
| 78 | ããã»ããµã¯ããã¯ã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼ã¡ã¤ã³ã¯ããã¯ã®fxxåºå(PCC=0) */
|
---|
| 79 | lea PRCMD, r6
|
---|
| 80 | lea PCC, r7
|
---|
| 81 | st.b r0, 0[r6]
|
---|
| 82 | st.b r0, 0[r7]
|
---|
| 83 | nop
|
---|
| 84 | nop
|
---|
| 85 | nop
|
---|
| 86 | nop
|
---|
| 87 | nop
|
---|
| 88 | Set(PLLCTL,0x03, b) /* PLLã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼PLLåä½ */
|
---|
| 89 | Set(WDTM2, 0x07, b) /* WDTM2 stop */
|
---|
| 90 | /* å¤é¨ãã¹ã®è¨å® */
|
---|
| 91 | Set(EXIMC, 0x01, b) /* å¤é¨ãã¹ã¤ã³ã¿ã¼ãã§ã¤ã¹ã¢ã¼ãã¬ã¸ã¹ã¿ï¼ã»ãã¬ã¼ããã¹ */
|
---|
| 92 | Set(PMC9, 0xFFFF, h) /* P9ã¢ã¼ãã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼A0-A15åºå */
|
---|
| 93 | Set(PMCCM, 0x02, b) /* PCMã¢ã¼ãã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼Clock Outåºå */
|
---|
| 94 | Set(PMCCT, 0x11, b) /* PCTã¢ã¼ãã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼RD/WR0åºå */
|
---|
| 95 | Set(PMCDL, 0xFFFF, h) /* PDLã¢ã¼ãã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼AD0-AD15åºå */
|
---|
| 96 | Set(BSC, 0x5555, h) /* ãã¹ãµã¤ãºã¬ã¸ã¹ã¿ï¼All 16bit */
|
---|
| 97 | Set(DWC0, 0x0000, h) /* ãã¼ã¿ã¦ã§ã¤ãå¶å¾¡ã¬ã¸ã¹ã¿ï¼wait=0 */
|
---|
| 98 | Set(AWC, 0xFF00, h) /* ã¢ãã¬ã¹ã¦ã§ã¤ãå¶å¾¡ã¬ã¸ã¹ã¿ï¼wait=0 */
|
---|
| 99 | Set(BCC, 0xAA00, h) /* ãã¹ãµã¤ã¯ã«å¶å¾¡ã¬ã¸ã¹ã¿ï¼wait=0 */
|
---|
| 100 | /* NICè¨å® */
|
---|
| 101 | Set(PMC0, 0x10, b) /* P04=INTP1 */
|
---|
| 102 | Set(PMCT, 0xBF, b) /* ASTB=out(LAN CS) */
|
---|
| 103 | Set(PCT, 0x00, b) /* ASTB=Low out */
|
---|
| 104 | Set(PM5, 0xFD, b) /* LAN Reset out */
|
---|
| 105 | Set(P5 , 0x00, b) /* LAN Reset out */
|
---|
| 106 |
|
---|
| 107 | jmp r31
|
---|
| 108 |
|
---|
| 109 |
|
---|
| 110 |
|
---|
| 111 | /* æ¨æºå²è¾¼ã¿å¦çã¨ã¹ãºã¼ãµã¼ */
|
---|
| 112 | .macro StandardInterruptEntry name
|
---|
| 113 | .globl \name
|
---|
| 114 | \name:
|
---|
| 115 | jr vector_handler
|
---|
| 116 | nop;nop;nop;nop;nop;nop
|
---|
| 117 | .endm
|
---|
| 118 |
|
---|
| 119 | .macro ReservedInterruptEntry
|
---|
| 120 | nop;nop;nop;nop;nop;nop;nop;nop
|
---|
| 121 | .endm
|
---|
| 122 |
|
---|
| 123 | /*
|
---|
| 124 | * å²è¾¼ã¿ãã³ãã©é¨åã®å®ç¾©
|
---|
| 125 | * ã¨ããããä¸ç®æã«éããã
|
---|
| 126 | */
|
---|
| 127 |
|
---|
| 128 | .section ".vectors","ax"
|
---|
| 129 | .align 4
|
---|
| 130 | .globl __reset
|
---|
| 131 | __reset:
|
---|
| 132 | jr start
|
---|
| 133 | nop;nop;nop;nop;nop;nop
|
---|
| 134 |
|
---|
| 135 | StandardInterruptEntry NMI
|
---|
| 136 | StandardInterruptEntry INTWDT2
|
---|
| 137 | ReservedInterruptEntry
|
---|
| 138 | StandardInterruptEntry TRAP0
|
---|
| 139 | StandardInterruptEntry TRAP1
|
---|
| 140 | StandardInterruptEntry DBG
|
---|
| 141 | /*#-------------------------------------------------------------------
|
---|
| 142 | # SECURITY_ID
|
---|
| 143 | #-------------------------------------------------------------------*/
|
---|
| 144 | /* .section "SECURITY_ID" */
|
---|
| 145 | .word 0xffffffff /* --0-3 byte code,Address is 0x70-0x73 */
|
---|
| 146 | .word 0xffffffff /* --4-7 byte code,Address is 0x74-0x77 */
|
---|
| 147 | .hword 0xffff /* --8-9 byte code,Address is 0x78-0x79 */
|
---|
| 148 | /*#-------------------------------------------------------------------
|
---|
| 149 | # OPTION_BYTES
|
---|
| 150 | #-------------------------------------------------------------------*/
|
---|
| 151 | /* .section "OPTION_BYTES" */
|
---|
| 152 | .hword 0x0000 /* --0-1 byte code,Address is 0x7a-0x7b */
|
---|
| 153 | .hword 0x0000 /* --2-3 byte code,Address is 0x7c-0x7d */
|
---|
| 154 | .hword 0x0000 /* --4-5 byte code,Address is 0x7e-0x7f */
|
---|
| 155 |
|
---|
| 156 | StandardInterruptEntry INTLVI
|
---|
| 157 | StandardInterruptEntry INTP0
|
---|
| 158 | StandardInterruptEntry INTP1
|
---|
| 159 | StandardInterruptEntry INTP2
|
---|
| 160 | StandardInterruptEntry INTP3
|
---|
| 161 | StandardInterruptEntry INTP4
|
---|
| 162 | StandardInterruptEntry INTP5
|
---|
| 163 | StandardInterruptEntry INTP6
|
---|
| 164 | StandardInterruptEntry INTP7
|
---|
| 165 | StandardInterruptEntry INTTQ0OV
|
---|
| 166 | StandardInterruptEntry INTTQ0CC0
|
---|
| 167 | StandardInterruptEntry INTTQ0CC1
|
---|
| 168 | StandardInterruptEntry INTTQ0CC2
|
---|
| 169 | StandardInterruptEntry INTTQ0CC3
|
---|
| 170 | StandardInterruptEntry INTTP0OV
|
---|
| 171 | StandardInterruptEntry INTTP0CC0
|
---|
| 172 | StandardInterruptEntry INTTP0CC1
|
---|
| 173 | StandardInterruptEntry INTTP1OV
|
---|
| 174 | StandardInterruptEntry INTTP1CC0
|
---|
| 175 | StandardInterruptEntry INTTP1CC1
|
---|
| 176 | StandardInterruptEntry INTTP2OV
|
---|
| 177 | StandardInterruptEntry INTTP2CC0
|
---|
| 178 | StandardInterruptEntry INTTP2CC1
|
---|
| 179 | StandardInterruptEntry INTTP3OV
|
---|
| 180 | StandardInterruptEntry INTTP3CC0
|
---|
| 181 | StandardInterruptEntry INTTP3CC1
|
---|
| 182 | StandardInterruptEntry INTTP4OV
|
---|
| 183 | StandardInterruptEntry INTTP4CC0
|
---|
| 184 | StandardInterruptEntry INTTP4CC1
|
---|
| 185 | StandardInterruptEntry INTTP5OV
|
---|
| 186 | StandardInterruptEntry INTTP5CC0
|
---|
| 187 | StandardInterruptEntry INTTP5CC1
|
---|
| 188 | StandardInterruptEntry INTTM0EQ0
|
---|
| 189 | StandardInterruptEntry INTCB0R
|
---|
| 190 | StandardInterruptEntry INTCB0T
|
---|
| 191 | StandardInterruptEntry INTCB1R
|
---|
| 192 | StandardInterruptEntry INTCB1T
|
---|
| 193 | StandardInterruptEntry INTCB2R
|
---|
| 194 | StandardInterruptEntry INTCB2T
|
---|
| 195 | StandardInterruptEntry INTCB3R
|
---|
| 196 | StandardInterruptEntry INTCB3T
|
---|
| 197 | StandardInterruptEntry INTUA0R
|
---|
| 198 | StandardInterruptEntry INTUA0T
|
---|
| 199 | StandardInterruptEntry INTUA1R
|
---|
| 200 | StandardInterruptEntry INTUA1T
|
---|
| 201 | StandardInterruptEntry INTUA2R
|
---|
| 202 | StandardInterruptEntry INTUA2T
|
---|
| 203 | StandardInterruptEntry INTAD
|
---|
| 204 | StandardInterruptEntry INTDMA0
|
---|
| 205 | StandardInterruptEntry INTDMA1
|
---|
| 206 | StandardInterruptEntry INTDMA2
|
---|
| 207 | StandardInterruptEntry INTDMA3
|
---|
| 208 | StandardInterruptEntry INTKR
|
---|
| 209 | StandardInterruptEntry INTWTI
|
---|
| 210 | StandardInterruptEntry INTWT
|
---|
| 211 | StandardInterruptEntry INTC0ERR
|
---|
| 212 | StandardInterruptEntry INTC0WUP
|
---|
| 213 | StandardInterruptEntry INTC0REC
|
---|
| 214 | StandardInterruptEntry INTC0TRX
|
---|
| 215 |
|
---|
| 216 | /*
|
---|
| 217 | * è©ä¾¡ç¨é«æ§è½?ã¿ã¤ã
|
---|
| 218 | * (ä»åã¯è©ä¾¡ç¨ããªã¼ã©ã³ãã³ã°ã¿ã¤ããä½ããã«ç´æ¥ã¿ã¤ãã«ã¦ã³ã¿ãã®ãã)
|
---|
| 219 | */
|
---|
| 220 | Function _vxget_tim
|
---|
| 221 | Lea TP0CNT, r7
|
---|
| 222 | ld.h 0[r7], r8
|
---|
| 223 | st.w r8, 0[r6]
|
---|
| 224 | mov r0, r10
|
---|
| 225 | jmp r31
|
---|