[363] | 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.4 2007/01/05 02:10:17 honda Exp $
|
---|
| 52 | */
|
---|
| 53 |
|
---|
| 54 | /*
|
---|
| 55 | * ã¿ã¼ã²ããã·ã¹ãã ä¾åã¢ã¸ã¥ã¼ã« ã¢ã»ã³ããªè¨èªé¨ï¼TK-850ES/KJ1+ç¨ï¼
|
---|
| 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 | /* ä¿è·ãããç¹å®ã¬ã¸ã¹ã¿ã¸ã®ã¢ã¯ã»ã¹
|
---|
| 77 | ããã»ããµã¯ããã¯ã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼ã¡ã¤ã³ã¯ããã¯ã®fxxåºå(PCC=0) */
|
---|
| 78 | lea PRCMD, r6
|
---|
| 79 | lea PCC, r7
|
---|
| 80 | st.b r0, 0[r6]
|
---|
| 81 | st.b r0, 0[r7]
|
---|
| 82 | nop
|
---|
| 83 | nop
|
---|
| 84 | nop
|
---|
| 85 | nop
|
---|
| 86 | nop
|
---|
| 87 | Set(PLLCTL,0x03, h) /* PLLã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼PLLåä½ */
|
---|
| 88 | Set(WDTM2, 0x07, b) /* WDTM2 stop */
|
---|
| 89 | #if 0
|
---|
| 90 | /* å¤é¨ãã¹ã®è¨å®ï¼
|
---|
| 91 | CS0ã«å¤é¨SRAMãå¢è¨ããå ´åã®åèãããã§ã¯ãã¹ã¯ã»ãã¬ã¼ããã¹ã§ã
|
---|
| 92 | 12nsåã®SRAMã§0waitã§åä½ãããã¨ãä»®å®ããè¨å®ã
|
---|
| 93 | */
|
---|
| 94 | Set(EXIMC, 0x01, b) /* å¤é¨ãã¹ã¤ã³ã¿ã¼ãã§ã¤ã¹ã¢ã¼ãã¬ã¸ã¹ã¿ï¼ã»ãã¬ã¼ããã¹ */
|
---|
| 95 | Set(PMC9, 0xFFFF, h) /* P9ã¢ã¼ãã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼A0-A15åºå */
|
---|
| 96 | Set(PMCCS, 0x01, b) /* PCSã¢ã¼ãã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼C0åºå */
|
---|
| 97 | Set(PMCCT, 0x53, b) /* PCTã¢ã¼ãã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼RD/WR/ASTBåºå */
|
---|
| 98 | Set(PMCDH, 0xFF, b) /* PDHã¢ã¼ãã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼A16-A23åºå */
|
---|
| 99 | Set(PMCDL, 0xFFFF, h) /* PDLã¢ã¼ãã³ã³ããã¼ã«ã¬ã¸ã¹ã¿ï¼AD0-AD15åºå */
|
---|
| 100 | Set(DWC0, 0x7770, h) /* ãã¼ã¿ã¦ã§ã¤ãå¶å¾¡ã¬ã¸ã¹ã¿ï¼CS0wait=0 */
|
---|
| 101 | Set(AWC, 0xFFFC, h) /* ã¢ãã¬ã¹ã¦ã§ã¤ãå¶å¾¡ã¬ã¸ã¹ã¿ï¼CS0wait=0 */
|
---|
| 102 | Set(BCC, 0xAAA8, h) /* ãã¹ãµã¤ã¯ã«å¶å¾¡ã¬ã¸ã¹ã¿ï¼CS0wait=0 */
|
---|
| 103 | #endif
|
---|
| 104 |
|
---|
| 105 | jmp r31
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 |
|
---|
| 109 | /* æ¨æºå²è¾¼ã¿å¦çã¨ã¹ãºã¼ãµã¼ */
|
---|
| 110 | .macro StandardInterruptEntry name
|
---|
| 111 | .globl \name
|
---|
| 112 | \name:
|
---|
| 113 | jr vector_handler
|
---|
| 114 | nop;nop;nop;nop;nop;nop
|
---|
| 115 | .endm
|
---|
| 116 |
|
---|
| 117 | .macro ReservedInterruptEntry
|
---|
| 118 | nop;nop;nop;nop;nop;nop;nop;nop
|
---|
| 119 | .endm
|
---|
| 120 |
|
---|
| 121 | /*
|
---|
| 122 | * å²è¾¼ã¿ãã³ãã©é¨åã®å®ç¾©
|
---|
| 123 | * ã¨ããããä¸ç®æã«éããã
|
---|
| 124 | */
|
---|
| 125 |
|
---|
| 126 | .section ".vectors","ax"
|
---|
| 127 | .align 4
|
---|
| 128 | .globl __reset
|
---|
| 129 | __reset:
|
---|
| 130 | jr start
|
---|
| 131 | nop;nop;nop;nop;nop;nop
|
---|
| 132 |
|
---|
| 133 | StandardInterruptEntry NMI
|
---|
| 134 | StandardInterruptEntry INTWDT1
|
---|
| 135 | StandardInterruptEntry INTWDT2
|
---|
| 136 | StandardInterruptEntry TRAP0
|
---|
| 137 | StandardInterruptEntry TRAP1
|
---|
| 138 | StandardInterruptEntry DBG
|
---|
| 139 | /*#-------------------------------------------------------------------
|
---|
| 140 | # SECURITY_ID
|
---|
| 141 | #-------------------------------------------------------------------*/
|
---|
| 142 | /* .section "SECURITY_ID" */
|
---|
| 143 | .word 0xffffffff /* --0-3 byte code,Address is 0x70-0x73 */
|
---|
| 144 | .word 0xffffffff /* --4-7 byte code,Address is 0x74-0x77 */
|
---|
| 145 | .hword 0xffff /* --8-9 byte code,Address is 0x78-0x79 */
|
---|
| 146 | /*#-------------------------------------------------------------------
|
---|
| 147 | # OPTION_BYTES
|
---|
| 148 | #-------------------------------------------------------------------*/
|
---|
| 149 | /* .section "OPTION_BYTES" */
|
---|
| 150 | .hword 0x0000 /* --0-1 byte code,Address is 0x7a-0x7b */
|
---|
| 151 | .hword 0x0000 /* --2-3 byte code,Address is 0x7c-0x7d */
|
---|
| 152 | .hword 0x0000 /* --4-5 byte code,Address is 0x7e-0x7f */
|
---|
| 153 |
|
---|
| 154 | StandardInterruptEntry INTWDTM1
|
---|
| 155 | StandardInterruptEntry INTP0
|
---|
| 156 | StandardInterruptEntry INTP1
|
---|
| 157 | StandardInterruptEntry INTP2
|
---|
| 158 | StandardInterruptEntry INTP3
|
---|
| 159 | StandardInterruptEntry INTP4
|
---|
| 160 | StandardInterruptEntry INTP5
|
---|
| 161 | StandardInterruptEntry INTP6
|
---|
| 162 | StandardInterruptEntry INTTM000
|
---|
| 163 | StandardInterruptEntry INTTM001
|
---|
| 164 | StandardInterruptEntry INTTM010
|
---|
| 165 | StandardInterruptEntry INTTM011
|
---|
| 166 | StandardInterruptEntry INTTM50
|
---|
| 167 | StandardInterruptEntry INTTM51
|
---|
| 168 | StandardInterruptEntry INTCSI00
|
---|
| 169 | StandardInterruptEntry INTCSI01
|
---|
| 170 | StandardInterruptEntry INTSRE0
|
---|
| 171 | StandardInterruptEntry INTSR0
|
---|
| 172 | StandardInterruptEntry INTST0
|
---|
| 173 | StandardInterruptEntry INTSRE1
|
---|
| 174 | StandardInterruptEntry INTSR1
|
---|
| 175 | StandardInterruptEntry INTST1
|
---|
| 176 | StandardInterruptEntry INTTMH0
|
---|
| 177 | StandardInterruptEntry INTTMH1
|
---|
| 178 | StandardInterruptEntry INTCSIA0
|
---|
| 179 | StandardInterruptEntry INTIIC0
|
---|
| 180 | StandardInterruptEntry INTAD
|
---|
| 181 | StandardInterruptEntry INTKR
|
---|
| 182 | StandardInterruptEntry INTWTI
|
---|
| 183 | StandardInterruptEntry INTWT
|
---|
| 184 | StandardInterruptEntry INTBRG
|
---|
| 185 | StandardInterruptEntry INTTM020
|
---|
| 186 | StandardInterruptEntry INTTM021
|
---|
| 187 | StandardInterruptEntry INTTM030
|
---|
| 188 | StandardInterruptEntry INTTM031
|
---|
| 189 | StandardInterruptEntry INTCSIA1
|
---|
| 190 | StandardInterruptEntry INTTM040
|
---|
| 191 | StandardInterruptEntry INTTM041
|
---|
| 192 | StandardInterruptEntry INTTM050
|
---|
| 193 | StandardInterruptEntry INTTM051
|
---|
| 194 | StandardInterruptEntry INTCSI02
|
---|
| 195 | StandardInterruptEntry INTSRE2
|
---|
| 196 | StandardInterruptEntry INTSR2
|
---|
| 197 | StandardInterruptEntry INTST2
|
---|
| 198 | StandardInterruptEntry INTIIC1
|
---|
| 199 | ReservedInterruptEntry
|
---|
| 200 | ReservedInterruptEntry
|
---|
| 201 | ReservedInterruptEntry
|
---|
| 202 | ReservedInterruptEntry
|
---|
| 203 | ReservedInterruptEntry
|
---|
| 204 | StandardInterruptEntry INTTP0OV
|
---|
| 205 | StandardInterruptEntry INTTP0CC0
|
---|
| 206 | StandardInterruptEntry INTTP0CC1
|
---|
| 207 |
|
---|
| 208 | /*
|
---|
| 209 | * è©ä¾¡ç¨é«æ§è½?ã¿ã¤ã
|
---|
| 210 | * (ä»åã¯è©ä¾¡ç¨ããªã¼ã©ã³ãã³ã°ã¿ã¤ããä½ããã«ç´æ¥ã¿ã¤ãã«ã¦ã³ã¿ãã®ãã)
|
---|
| 211 | */
|
---|
| 212 | Function _vxget_tim
|
---|
| 213 | Lea TM00, r7
|
---|
| 214 | ld.h 0[r7], r8
|
---|
| 215 | st.w r8, 0[r6]
|
---|
| 216 | mov r0, r10
|
---|
| 217 | jmp r31
|
---|