以前 HOS V4 RX62Nを試したが
その時は http://sourceforge.jp/forum/message.php?msg_id=57491
のコード利用しました。
このコードは タスクスイッチのトリガーにRX62Nの SWINTR機能を使っています(Cortex-M3 PendSV命令相当)。
今回 http://sourceforge.jp/cvs/view/hos/hos/hos-v4/ の本家に RX600(RX621?)のコードが取り込まれたので、これを試します。 今回のコードでは RX621 の SWINTR機能は使われていません。
せっかくなので、 HEW環境で動作確認したい。
gcc版をのソースを修正しながら、組み込みます。
src/rx600/rxc/pacctx.src hew版
;/* ------------------------------------------------------------------------ */
;/* Hyper Operating System V4 μITRON4.0仕様 Real-Time OS */
;/* プロセッサ抽象化コンポーネント (Renesas RX用) */
;/* */
;/* Copyright (C) 1998-2012 by Project HOS */
;/* http://sourceforge.jp/projects/hos/ */
;/* ------------------------------------------------------------------------ */
.glb _hospac_ini_sys ;/* 初期化 */
.glb _hospac_dis_int ;/* 割り込み禁止 */
.glb _hospac_ena_int ;/* 割り込み許可 */
.glb _hospac_cre_ctx_asm ;/* 実行コンテキストの作成 */
.glb _hospac_swi_ctx ;/* 実行コンテキストの切替 */
.glb _hospac_sh_imsk
;/************************************************
; プロセッサ抽象化コンポーネントの初期化
; void hospac_ini_sys(void)
;************************************************/
.section P,CODE,ALIGN=4
.align 4
_hospac_ini_sys:
rts
;/************************************************
; 割り込み禁止
; void hospac_dis_int(void)
;************************************************/
;.text
.align 4
_hospac_dis_int:
;mvfc psw, r1
;bclr #16, r1 ;/* I bit clr 割り込みdisable */
;mvtc r1, psw
clrpsw i
rts
;/************************************************
; 割り込み許可
; void hospac_ena_int(void)
;************************************************/
;.text
.align 4
_hospac_ena_int:
mov.l #0f0ffffffh, r1 ;/* IPL[3:0]=0 */
mvfc psw, r2
and r1, r2 ;/* 割り込みマスク値以外を取得 */
mov.l #_hospac_sh_imsk, r1
mov.l [r1], r1
or r1, r2 ;/* 割り込みマスクの値を設定 */
mvtc r2, psw
setpsw i ;/* I bit set */
rts
;/************************************************
; 実行コンテキストエントリーアドレス
;************************************************/
;.text
.align 4
ctx_entry:
mov.l r7, r1 ;/* 実行時パラメータを第一引数に設定 !!!レジスタ確認*/
jmp r6 ;/* 実行アドレスにジャンプ !!!レジスタ確認*/
;/************************************************
; 実行コンテキストの作成
; void hospac_cre_ctx_asm(
; T_HOSPAC_CTXINF *pk_ctxinf, 作成するコンテキスト
; VP sp, スタックポインタ
; void (*task)(VP_INT), 実行アドレス
; VP_INT exinf) 実行時パラメータ
;************************************************/
;.text
.align 4
_hospac_cre_ctx_asm:
mov.l #ctx_entry, r5 ;/* 実行エントリポイントをコンテキストの */
mov.l r5, [-r2] ;/* スタックに保存 */
add #-28, r2 ;/* r8-14分コンテキストのstackを伸ばす */
mov.l r4, [-r2] ;/* 実行パラメータの格納(r7) */
mov.l r3, [-r2] ;/* 実行アドレスの格納(r6) */
mov.l r2, 0[r1] ;/* コンテキストのスタックポインタ保存 */
rts
;/************************************************
; 実行コンテキストの切替
; void hospac_swi_ctx(
; T_HOSPAC_CTXINF *pk_pre_ctxinf, 現在のコンテキストの保存先
; T_HOSPAC_CTXINF *pk_nxt_ctxinf) 切り替えるコンテキスト
;************************************************/
;.text
.align 4
_hospac_swi_ctx:
pushm r6-r14 ;/* r6-r14を退避 !!!使用レジスタが合っているか確認*/
mov.l r0, 0[r1] ;/* スタックポインタ保存 */
mov.l 0[r2], r0 ;/* スタックポインタ復帰 */
popm r6-r14 ;/* r6-r14を復帰 !!!使用レジスタが合っているか確認*/
rts
.end
;/* ------------------------------------------------------------------------ */
;/* Copyright (C) 1998-2012 by Project HOS */
;/* ------------------------------------------------------------------------ */
src/rx600/rxc/pacint.src hew版
;/* ------------------------------------------------------------------------ */
;/* Hyper Operating System V4 μITRON4.0仕様 Real-Time OS */
;/* プロセッサ抽象化コンポーネント (Renesas RX用) */
;/* 割り込みハンドラ */
;/* */
;/* Copyright (C) 1998-2012 by Project HOS */
;/* http://sourceforge.jp/projects/hos/ */
;/* ------------------------------------------------------------------------ */
.glb _hospac_sh_imsk
.glb _hospac_sh_imsk_base
.glb _kernel_int_cnt
.glb _kernel_exe_int
.glb _kernel_end_int
.glb _kernel_int_ssp
.glb _kernel_sta_int
.glb _hos_vecter000
.glb _hos_vecter001
.glb _hos_vecter002
.glb _hos_vecter003
.glb _hos_vecter004
.glb _hos_vecter005
.glb _hos_vecter006
.glb _hos_vecter007
.glb _hos_vecter008
.glb _hos_vecter009
.glb _hos_vecter010
.glb _hos_vecter011
.glb _hos_vecter012
.glb _hos_vecter013
.glb _hos_vecter014
.glb _hos_vecter015
.glb _hos_vecter016
.glb _hos_vecter017
.glb _hos_vecter018
.glb _hos_vecter019
.glb _hos_vecter020
.glb _hos_vecter021
.glb _hos_vecter022
.glb _hos_vecter023
.glb _hos_vecter024
.glb _hos_vecter025
.glb _hos_vecter026
.glb _hos_vecter027
.glb _hos_vecter028
.glb _hos_vecter029
.glb _hos_vecter030
.glb _hos_vecter031
.glb _hos_vecter032
.glb _hos_vecter033
.glb _hos_vecter034
.glb _hos_vecter035
.glb _hos_vecter036
.glb _hos_vecter037
.glb _hos_vecter038
.glb _hos_vecter039
.glb _hos_vecter040
.glb _hos_vecter041
.glb _hos_vecter042
.glb _hos_vecter043
.glb _hos_vecter044
.glb _hos_vecter045
.glb _hos_vecter046
.glb _hos_vecter047
.glb _hos_vecter048
.glb _hos_vecter049
.glb _hos_vecter050
.glb _hos_vecter051
.glb _hos_vecter052
.glb _hos_vecter053
.glb _hos_vecter054
.glb _hos_vecter055
.glb _hos_vecter056
.glb _hos_vecter057
.glb _hos_vecter058
.glb _hos_vecter059
.glb _hos_vecter060
.glb _hos_vecter061
.glb _hos_vecter062
.glb _hos_vecter063
.glb _hos_vecter064
.glb _hos_vecter065
.glb _hos_vecter066
.glb _hos_vecter067
.glb _hos_vecter068
.glb _hos_vecter069
.glb _hos_vecter070
.glb _hos_vecter071
.glb _hos_vecter072
.glb _hos_vecter073
.glb _hos_vecter074
.glb _hos_vecter075
.glb _hos_vecter076
.glb _hos_vecter077
.glb _hos_vecter078
.glb _hos_vecter079
.glb _hos_vecter080
.glb _hos_vecter081
.glb _hos_vecter082
.glb _hos_vecter083
.glb _hos_vecter084
.glb _hos_vecter085
.glb _hos_vecter086
.glb _hos_vecter087
.glb _hos_vecter088
.glb _hos_vecter089
.glb _hos_vecter090
.glb _hos_vecter091
.glb _hos_vecter092
.glb _hos_vecter093
.glb _hos_vecter094
.glb _hos_vecter095
.glb _hos_vecter096
.glb _hos_vecter097
.glb _hos_vecter098
.glb _hos_vecter099
.glb _hos_vecter100
.glb _hos_vecter101
.glb _hos_vecter102
.glb _hos_vecter103
.glb _hos_vecter104
.glb _hos_vecter105
.glb _hos_vecter106
.glb _hos_vecter107
.glb _hos_vecter108
.glb _hos_vecter109
.glb _hos_vecter110
.glb _hos_vecter111
.glb _hos_vecter112
.glb _hos_vecter113
.glb _hos_vecter114
.glb _hos_vecter115
.glb _hos_vecter116
.glb _hos_vecter117
.glb _hos_vecter118
.glb _hos_vecter119
.glb _hos_vecter120
.glb _hos_vecter121
.glb _hos_vecter122
.glb _hos_vecter123
.glb _hos_vecter124
.glb _hos_vecter125
.glb _hos_vecter126
.glb _hos_vecter127
.glb _hos_vecter128
.glb _hos_vecter129
.glb _hos_vecter130
.glb _hos_vecter131
.glb _hos_vecter132
.glb _hos_vecter133
.glb _hos_vecter134
.glb _hos_vecter135
.glb _hos_vecter136
.glb _hos_vecter137
.glb _hos_vecter138
.glb _hos_vecter139
.glb _hos_vecter140
.glb _hos_vecter141
.glb _hos_vecter142
.glb _hos_vecter143
.glb _hos_vecter144
.glb _hos_vecter145
.glb _hos_vecter146
.glb _hos_vecter147
.glb _hos_vecter148
.glb _hos_vecter149
.glb _hos_vecter150
.glb _hos_vecter151
.glb _hos_vecter152
.glb _hos_vecter153
.glb _hos_vecter154
.glb _hos_vecter155
.glb _hos_vecter156
.glb _hos_vecter157
.glb _hos_vecter158
.glb _hos_vecter159
.glb _hos_vecter160
.glb _hos_vecter161
.glb _hos_vecter162
.glb _hos_vecter163
.glb _hos_vecter164
.glb _hos_vecter165
.glb _hos_vecter166
.glb _hos_vecter167
.glb _hos_vecter168
.glb _hos_vecter169
.glb _hos_vecter170
.glb _hos_vecter171
.glb _hos_vecter172
.glb _hos_vecter173
.glb _hos_vecter174
.glb _hos_vecter175
.glb _hos_vecter176
.glb _hos_vecter177
.glb _hos_vecter178
.glb _hos_vecter179
.glb _hos_vecter180
.glb _hos_vecter181
.glb _hos_vecter182
.glb _hos_vecter183
.glb _hos_vecter184
.glb _hos_vecter185
.glb _hos_vecter186
.glb _hos_vecter187
.glb _hos_vecter188
.glb _hos_vecter189
.glb _hos_vecter190
.glb _hos_vecter191
.glb _hos_vecter192
.glb _hos_vecter193
.glb _hos_vecter194
.glb _hos_vecter195
.glb _hos_vecter196
.glb _hos_vecter197
.glb _hos_vecter198
.glb _hos_vecter199
.glb _hos_vecter200
.glb _hos_vecter201
.glb _hos_vecter202
.glb _hos_vecter203
.glb _hos_vecter204
.glb _hos_vecter205
.glb _hos_vecter206
.glb _hos_vecter207
.glb _hos_vecter208
.glb _hos_vecter209
.glb _hos_vecter210
.glb _hos_vecter211
.glb _hos_vecter212
.glb _hos_vecter213
.glb _hos_vecter214
.glb _hos_vecter215
.glb _hos_vecter216
.glb _hos_vecter217
.glb _hos_vecter218
.glb _hos_vecter219
.glb _hos_vecter220
.glb _hos_vecter221
.glb _hos_vecter222
.glb _hos_vecter223
.glb _hos_vecter224
.glb _hos_vecter225
.glb _hos_vecter226
.glb _hos_vecter227
.glb _hos_vecter228
.glb _hos_vecter229
.glb _hos_vecter230
.glb _hos_vecter231
.glb _hos_vecter232
.glb _hos_vecter233
.glb _hos_vecter234
.glb _hos_vecter235
.glb _hos_vecter236
.glb _hos_vecter237
.glb _hos_vecter238
.glb _hos_vecter239
.glb _hos_vecter240
.glb _hos_vecter241
.glb _hos_vecter242
.glb _hos_vecter243
.glb _hos_vecter244
.glb _hos_vecter245
.glb _hos_vecter246
.glb _hos_vecter247
.glb _hos_vecter248
.glb _hos_vecter249
.glb _hos_vecter250
.glb _hos_vecter251
.glb _hos_vecter252
.glb _hos_vecter253
.glb _hos_vecter254
.glb _hos_vecter255
.section P,CODE,ALIGN=4
;/************************************************
; 割り込みハンドラ
;************************************************/
_hos_vecter000: push.l r4
mov.l #0, R4
bra int_handler
_hos_vecter001: push.l r4
mov.l #1, R4
bra int_handler
_hos_vecter002: push.l r4
mov.l #2, R4
bra int_handler
_hos_vecter003: push.l r4
mov.l #3, R4
bra int_handler
_hos_vecter004: push.l r4
mov.l #4, R4
bra int_handler
_hos_vecter005: push.l r4
mov.l #5, r4
bra int_handler
_hos_vecter006: push.l r4
mov.l #6, r4
bra int_handler
_hos_vecter007: push.l r4
mov.l #7, r4
bra int_handler
_hos_vecter008: push.l r4
mov.l #8, r4
bra int_handler
_hos_vecter009: push.l r4
mov.l #9, r4
bra int_handler
_hos_vecter010: push.l r4
mov.l #10, r4
bra int_handler
_hos_vecter011: push.l r4
mov.l #11, r4
bra int_handler
_hos_vecter012: push.l r4
mov.l #12, r4
bra int_handler
_hos_vecter013: push.l r4
mov.l #13, r4
bra int_handler
_hos_vecter014: push.l r4
mov.l #14, r4
bra int_handler
_hos_vecter015: push.l r4
mov.l #15, r4
bra int_handler
_hos_vecter016: push.l r4
mov.l #16, r4
bra int_handler
_hos_vecter017: push.l r4
mov.l #17, r4
bra int_handler
_hos_vecter018: push.l r4
mov.l #18, r4
bra int_handler
_hos_vecter019: push.l r4
mov.l #19, r4
bra int_handler
_hos_vecter020: push.l r4
mov.l #20, r4
bra int_handler
_hos_vecter021: push.l r4
mov.l #21, r4
bra int_handler
_hos_vecter022: push.l r4
mov.l #22, r4
bra int_handler
_hos_vecter023: push.l r4
mov.l #23, r4
bra int_handler
_hos_vecter024: push.l r4
mov.l #24, r4
bra int_handler
_hos_vecter025: push.l r4
mov.l #25, r4
bra int_handler
_hos_vecter026: push.l r4
mov.l #26, r4
bra int_handler
_hos_vecter027: push.l r4
mov.l #27, r4
bra int_handler
_hos_vecter028: push.l r4
mov.l #28, r4
bra int_handler
_hos_vecter029: push.l r4
mov.l #29, r4
bra int_handler
_hos_vecter030: push.l r4
mov.l #30, r4
bra int_handler
_hos_vecter031: push.l r4
mov.l #31, r4
bra int_handler
_hos_vecter032: push.l r4
mov.l #32, r4
bra int_handler
_hos_vecter033: push.l r4
mov.l #33, r4
bra int_handler
_hos_vecter034: push.l r4
mov.l #34, r4
bra int_handler
_hos_vecter035: push.l r4
mov.l #35, r4
bra int_handler
_hos_vecter036: push.l r4
mov.l #36, r4
bra int_handler
_hos_vecter037: push.l r4
mov.l #37, r4
bra int_handler
_hos_vecter038: push.l r4
mov.l #38, r4
bra int_handler
_hos_vecter039: push.l r4
mov.l #39, r4
bra int_handler
_hos_vecter040: push.l r4
mov.l #40, r4
bra int_handler
_hos_vecter041: push.l r4
mov.l #41, r4
bra int_handler
_hos_vecter042: push.l r4
mov.l #42, r4
bra int_handler
_hos_vecter043: push.l r4
mov.l #43, r4
bra int_handler
_hos_vecter044: push.l r4
mov.l #44, r4
bra int_handler
_hos_vecter045: push.l r4
mov.l #45, r4
bra int_handler
_hos_vecter046: push.l r4
mov.l #46, r4
bra int_handler
_hos_vecter047: push.l r4
mov.l #47, r4
bra int_handler
_hos_vecter048: push.l r4
mov.l #48, r4
bra int_handler
_hos_vecter049: push.l r4
mov.l #49, r4
bra int_handler
_hos_vecter050: push.l r4
mov.l #50, r4
bra int_handler
_hos_vecter051: push.l r4
mov.l #51, r4
bra int_handler
_hos_vecter052: push.l r4
mov.l #52, r4
bra int_handler
_hos_vecter053: push.l r4
mov.l #53, r4
bra int_handler
_hos_vecter054: push.l r4
mov.l #54, r4
bra int_handler
_hos_vecter055: push.l r4
mov.l #55, r4
bra int_handler
_hos_vecter056: push.l r4
mov.l #56, r4
bra int_handler
_hos_vecter057: push.l r4
mov.l #57, r4
bra int_handler
_hos_vecter058: push.l r4
mov.l #58, r4
bra int_handler
_hos_vecter059: push.l r4
mov.l #59, r4
bra int_handler
_hos_vecter060: push.l r4
mov.l #60, r4
bra int_handler
_hos_vecter061: push.l r4
mov.l #61, r4
bra int_handler
_hos_vecter062: push.l r4
mov.l #62, r4
bra int_handler
_hos_vecter063: push.l r4
mov.l #63, r4
bra int_handler
_hos_vecter064: push.l r4
mov.l #64, r4
bra int_handler
_hos_vecter065: push.l r4
mov.l #65, r4
bra int_handler
_hos_vecter066: push.l r4
mov.l #66, r4
bra int_handler
_hos_vecter067: push.l r4
mov.l #67, r4
bra int_handler
_hos_vecter068: push.l r4
mov.l #68, r4
bra int_handler
_hos_vecter069: push.l r4
mov.l #69, r4
bra int_handler
_hos_vecter070: push.l r4
mov.l #70, r4
bra int_handler
_hos_vecter071: push.l r4
mov.l #71, r4
bra int_handler
_hos_vecter072: push.l r4
mov.l #72, r4
bra int_handler
_hos_vecter073: push.l r4
mov.l #73, r4
bra int_handler
_hos_vecter074: push.l r4
mov.l #74, r4
bra int_handler
_hos_vecter075: push.l r4
mov.l #75, r4
bra int_handler
_hos_vecter076: push.l r4
mov.l #76, r4
bra int_handler
_hos_vecter077: push.l r4
mov.l #77, r4
bra int_handler
_hos_vecter078: push.l r4
mov.l #78, r4
bra int_handler
_hos_vecter079: push.l r4
mov.l #79, r4
bra int_handler
_hos_vecter080: push.l r4
mov.l #80, r4
bra int_handler
_hos_vecter081: push.l r4
mov.l #81, r4
bra int_handler
_hos_vecter082: push.l r4
mov.l #82, r4
bra int_handler
_hos_vecter083: push.l r4
mov.l #83, r4
bra int_handler
_hos_vecter084: push.l r4
mov.l #84, r4
bra int_handler
_hos_vecter085: push.l r4
mov.l #85, r4
bra int_handler
_hos_vecter086: push.l r4
mov.l #86, r4
bra int_handler
_hos_vecter087: push.l r4
mov.l #87, r4
bra int_handler
_hos_vecter088: push.l r4
mov.l #88, r4
bra int_handler
_hos_vecter089: push.l r4
mov.l #89, r4
bra int_handler
_hos_vecter090: push.l r4
mov.l #90, r4
bra int_handler
_hos_vecter091: push.l r4
mov.l #91, r4
bra int_handler
_hos_vecter092: push.l r4
mov.l #92, r4
bra int_handler
_hos_vecter093: push.l r4
mov.l #93, r4
bra int_handler
_hos_vecter094: push.l r4
mov.l #94, r4
bra int_handler
_hos_vecter095: push.l r4
mov.l #95, r4
bra int_handler
_hos_vecter096: push.l r4
mov.l #96, r4
bra int_handler
_hos_vecter097: push.l r4
mov.l #97, r4
bra int_handler
_hos_vecter098: push.l r4
mov.l #98, r4
bra int_handler
_hos_vecter099: push.l r4
mov.l #99, r4
bra int_handler
_hos_vecter100: push.l r4
mov.l #100, r4
bra int_handler
_hos_vecter101: push.l r4
mov.l #101, r4
bra int_handler
_hos_vecter102: push.l r4
mov.l #102, r4
bra int_handler
_hos_vecter103: push.l r4
mov.l #103, r4
bra int_handler
_hos_vecter104: push.l r4
mov.l #104, r4
bra int_handler
_hos_vecter105: push.l r4
mov.l #105, r4
bra int_handler
_hos_vecter106: push.l r4
mov.l #106, r4
bra int_handler
_hos_vecter107: push.l r4
mov.l #107, r4
bra int_handler
_hos_vecter108: push.l r4
mov.l #108, r4
bra int_handler
_hos_vecter109: push.l r4
mov.l #109, r4
bra int_handler
_hos_vecter110: push.l r4
mov.l #110, r4
bra int_handler
_hos_vecter111: push.l r4
mov.l #111, r4
bra int_handler
_hos_vecter112: push.l r4
mov.l #112, r4
bra int_handler
_hos_vecter113: push.l r4
mov.l #113, r4
bra int_handler
_hos_vecter114: push.l r4
mov.l #114, r4
bra int_handler
_hos_vecter115: push.l r4
mov.l #115, r4
bra int_handler
_hos_vecter116: push.l r4
mov.l #116, r4
bra int_handler
_hos_vecter117: push.l r4
mov.l #117, r4
bra int_handler
_hos_vecter118: push.l r4
mov.l #118, r4
bra int_handler
_hos_vecter119: push.l r4
mov.l #119, r4
bra int_handler
_hos_vecter120: push.l r4
mov.l #120, r4
bra int_handler
_hos_vecter121: push.l r4
mov.l #121, r4
bra int_handler
_hos_vecter122: push.l r4
mov.l #122, r4
bra int_handler
_hos_vecter123: push.l r4
mov.l #123, r4
bra int_handler
_hos_vecter124: push.l r4
mov.l #124, r4
bra int_handler
_hos_vecter125: push.l r4
mov.l #125, r4
bra int_handler
_hos_vecter126: push.l r4
mov.l #126, r4
bra int_handler
_hos_vecter127: push.l r4
mov.l #127, r4
bra int_handler
_hos_vecter128: push.l r4
mov.l #128, r4
bra int_handler
_hos_vecter129: push.l r4
mov.l #129, r4
bra int_handler
_hos_vecter130: push.l r4
mov.l #130, r4
bra int_handler
_hos_vecter131: push.l r4
mov.l #131, r4
bra int_handler
_hos_vecter132: push.l r4
mov.l #132, r4
bra int_handler
_hos_vecter133: push.l r4
mov.l #133, r4
bra int_handler
_hos_vecter134: push.l r4
mov.l #134, r4
bra int_handler
_hos_vecter135: push.l r4
mov.l #135, r4
bra int_handler
_hos_vecter136: push.l r4
mov.l #136, r4
bra int_handler
_hos_vecter137: push.l r4
mov.l #137, r4
bra int_handler
_hos_vecter138: push.l r4
mov.l #138, r4
bra int_handler
_hos_vecter139: push.l r4
mov.l #139, r4
bra int_handler
_hos_vecter140: push.l r4
mov.l #140, r4
bra int_handler
_hos_vecter141: push.l r4
mov.l #141, r4
bra int_handler
_hos_vecter142: push.l r4
mov.l #142, r4
bra int_handler
_hos_vecter143: push.l r4
mov.l #143, r4
bra int_handler
_hos_vecter144: push.l r4
mov.l #144, r4
bra int_handler
_hos_vecter145: push.l r4
mov.l #145, r4
bra int_handler
_hos_vecter146: push.l r4
mov.l #146, r4
bra int_handler
_hos_vecter147: push.l r4
mov.l #147, r4
bra int_handler
_hos_vecter148: push.l r4
mov.l #148, r4
bra int_handler
_hos_vecter149: push.l r4
mov.l #149, r4
bra int_handler
_hos_vecter150: push.l r4
mov.l #150, r4
bra int_handler
_hos_vecter151: push.l r4
mov.l #151, r4
bra int_handler
_hos_vecter152: push.l r4
mov.l #152, r4
bra int_handler
_hos_vecter153: push.l r4
mov.l #153, r4
bra int_handler
_hos_vecter154: push.l r4
mov.l #154, r4
bra int_handler
_hos_vecter155: push.l r4
mov.l #155, r4
bra int_handler
_hos_vecter156: push.l r4
mov.l #156, r4
bra int_handler
_hos_vecter157: push.l r4
mov.l #157, r4
bra int_handler
_hos_vecter158: push.l r4
mov.l #158, r4
bra int_handler
_hos_vecter159: push.l r4
mov.l #159, r4
bra int_handler
_hos_vecter160: push.l r4
mov.l #160, r4
bra int_handler
_hos_vecter161: push.l r4
mov.l #161, r4
bra int_handler
_hos_vecter162: push.l r4
mov.l #162, r4
bra int_handler
_hos_vecter163: push.l r4
mov.l #163, r4
bra int_handler
_hos_vecter164: push.l r4
mov.l #164, r4
bra int_handler
_hos_vecter165: push.l r4
mov.l #165, r4
bra int_handler
_hos_vecter166: push.l r4
mov.l #166, r4
bra int_handler
_hos_vecter167: push.l r4
mov.l #167, r4
bra int_handler
_hos_vecter168: push.l r4
mov.l #168, r4
bra int_handler
_hos_vecter169: push.l r4
mov.l #169, r4
bra int_handler
_hos_vecter170: push.l r4
mov.l #170, r4
bra int_handler
_hos_vecter171: push.l r4
mov.l #171, r4
bra int_handler
_hos_vecter172: push.l r4
mov.l #172, r4
bra int_handler
_hos_vecter173: push.l r4
mov.l #173, r4
bra int_handler
_hos_vecter174: push.l r4
mov.l #174, r4
bra int_handler
_hos_vecter175: push.l r4
mov.l #175, r4
bra int_handler
_hos_vecter176: push.l r4
mov.l #176, r4
bra int_handler
_hos_vecter177: push.l r4
mov.l #177, r4
bra int_handler
_hos_vecter178: push.l r4
mov.l #178, r4
bra int_handler
_hos_vecter179: push.l r4
mov.l #179, r4
bra int_handler
_hos_vecter180: push.l r4
mov.l #180, r4
bra int_handler
_hos_vecter181: push.l r4
mov.l #181, r4
bra int_handler
_hos_vecter182: push.l r4
mov.l #182, r4
bra int_handler
_hos_vecter183: push.l r4
mov.l #183, r4
bra int_handler
_hos_vecter184: push.l r4
mov.l #184, r4
bra int_handler
_hos_vecter185: push.l r4
mov.l #185, r4
bra int_handler
_hos_vecter186: push.l r4
mov.l #186, r4
bra int_handler
_hos_vecter187: push.l r4
mov.l #187, r4
bra int_handler
_hos_vecter188: push.l r4
mov.l #188, r4
bra int_handler
_hos_vecter189: push.l r4
mov.l #189, r4
bra int_handler
_hos_vecter190: push.l r4
mov.l #190, r4
bra int_handler
_hos_vecter191: push.l r4
mov.l #191, r4
bra int_handler
_hos_vecter192: push.l r4
mov.l #192, r4
bra int_handler
_hos_vecter193: push.l r4
mov.l #193, r4
bra int_handler
_hos_vecter194: push.l r4
mov.l #194, r4
bra int_handler
_hos_vecter195: push.l r4
mov.l #195, r4
bra int_handler
_hos_vecter196: push.l r4
mov.l #196, r4
bra int_handler
_hos_vecter197: push.l r4
mov.l #197, r4
bra int_handler
_hos_vecter198: push.l r4
mov.l #198, r4
bra int_handler
_hos_vecter199: push.l r4
mov.l #199, r4
bra int_handler
_hos_vecter200: push.l r4
mov.l #200, r4
bra int_handler
_hos_vecter201: push.l r4
mov.l #201, r4
bra int_handler
_hos_vecter202: push.l r4
mov.l #202, r4
bra int_handler
_hos_vecter203: push.l r4
mov.l #203, r4
bra int_handler
_hos_vecter204: push.l r4
mov.l #204, r4
bra int_handler
_hos_vecter205: push.l r4
mov.l #205, r4
bra int_handler
_hos_vecter206: push.l r4
mov.l #206, r4
bra int_handler
_hos_vecter207: push.l r4
mov.l #207, r4
bra int_handler
_hos_vecter208: push.l r4
mov.l #208, r4
bra int_handler
_hos_vecter209: push.l r4
mov.l #209, r4
bra int_handler
_hos_vecter210: push.l r4
mov.l #210, r4
bra int_handler
_hos_vecter211: push.l r4
mov.l #211, r4
bra int_handler
_hos_vecter212: push.l r4
mov.l #212, r4
bra int_handler
_hos_vecter213: push.l r4
mov.l #213, r4
bra int_handler
_hos_vecter214: push.l r4
mov.l #214, r4
bra int_handler
_hos_vecter215: push.l r4
mov.l #215, r4
bra int_handler
_hos_vecter216: push.l r4
mov.l #216, r4
bra int_handler
_hos_vecter217: push.l r4
mov.l #217, r4
bra int_handler
_hos_vecter218: push.l r4
mov.l #218, r4
bra int_handler
_hos_vecter219: push.l r4
mov.l #219, r4
bra int_handler
_hos_vecter220: push.l r4
mov.l #220, r4
bra int_handler
_hos_vecter221: push.l r4
mov.l #221, r4
bra int_handler
_hos_vecter222: push.l r4
mov.l #222, r4
bra int_handler
_hos_vecter223: push.l r4
mov.l #223, r4
bra int_handler
_hos_vecter224: push.l r4
mov.l #224, r4
bra int_handler
_hos_vecter225: push.l r4
mov.l #225, r4
bra int_handler
_hos_vecter226: push.l r4
mov.l #226, r4
bra int_handler
_hos_vecter227: push.l r4
mov.l #227, r4
bra int_handler
_hos_vecter228: push.l r4
mov.l #228, r4
bra int_handler
_hos_vecter229: push.l r4
mov.l #229, r4
bra int_handler
_hos_vecter230: push.l r4
mov.l #230, r4
bra int_handler
_hos_vecter231: push.l r4
mov.l #231, r4
bra int_handler
_hos_vecter232: push.l r4
mov.l #232, r4
bra int_handler
_hos_vecter233: push.l r4
mov.l #233, r4
bra int_handler
_hos_vecter234: push.l r4
mov.l #234, r4
bra int_handler
_hos_vecter235: push.l r4
mov.l #235, r4
bra int_handler
_hos_vecter236: push.l r4
mov.l #236, r4
bra int_handler
_hos_vecter237: push.l r4
mov.l #237, r4
bra int_handler
_hos_vecter238: push.l r4
mov.l #238, r4
bra int_handler
_hos_vecter239: push.l r4
mov.l #239, r4
bra int_handler
_hos_vecter240: push.l r4
mov.l #240, r4
bra int_handler
_hos_vecter241: push.l r4
mov.l #241, r4
bra int_handler
_hos_vecter242: push.l r4
mov.l #242, r4
bra int_handler
_hos_vecter243: push.l r4
mov.l #243, r4
bra int_handler
_hos_vecter244: push.l r4
mov.l #244, r4
bra int_handler
_hos_vecter245: push.l r4
mov.l #245, r4
bra int_handler
_hos_vecter246: push.l r4
mov.l #246, r4
bra int_handler
_hos_vecter247: push.l r4
mov.l #247, r4
bra int_handler
_hos_vecter248: push.l r4
mov.l #248, r4
bra int_handler
_hos_vecter249: push.l r4
mov.l #249, r4
bra int_handler
_hos_vecter250: push.l r4
mov.l #250, r4
bra int_handler
_hos_vecter251: push.l r4
mov.l #251, r4
bra int_handler
_hos_vecter252: push.l r4
mov.l #252, r4
bra int_handler
_hos_vecter253: push.l r4
mov.l #253, r4
bra int_handler
_hos_vecter254: push.l r4
mov.l #254, r4
bra int_handler
_hos_vecter255: push.l r4
mov.l #255, r4
bra int_handler
;/************************************************
; 割り込みハンドラ
;
; r4をスタックに積んだ後、r4に割り込み番号を
; 格納してここに分岐するものとする
;************************************************/
.align 4
int_handler:
;/* レジスタ退避(r0-r2) */
pushm r1-r6
pushm r14-r15
;/* 割り込みマスク設定 */
mvfc psw, r1
;/* mov r1, r2 */
;/* or #0x0f000000, r1 */ /* 割り込み全マスク設定 */
;/* mvtc r1, psw */
;/* 割り込みマスクの保存 */
;/* mov r2, r1 */
and #0f000000h, r1
mov.l #_hospac_sh_imsk, r2
mov.l [r2], r6
mov.l r1, [r2]
;/* 割り込み番号の符号拡張をクリア */
;extu.b r4, r4
;/* レジスタ保存(r3-r7,mach,macl,pr) */
;pushm r4-r15
;/* 多重割り込み判定 */
mov.l #_kernel_int_cnt, r2
mov.l [r2], r1
add #1, r1
cmp #1, r1
bne int_multi
;/* 単独割り込み時 */
mov.l r1, [r2] ;/* 割り込みネスト値を設定 */
;/* スタック入れ替え */ /* U bit でできないか検討 */
;/* usp を利用しない場合1 begin */
; mov.l #_kernel_int_ssp, r1
; mov.l r0, [r1] ;/* 現在のスタックを退避 */
; mov.l #_kernel_int_sp, r1
; mov.l [r1], r0 ;/* 割り込み用スタックを設定 */
;/* usp利用しない場合1 end */
push.l r4 ;/* 割り込み番号を退避 */
;/* 割り込み開始処理呼び出し */
mov.l #_kernel_sta_int, r2 ;/* 状態変数を書き換え */
jsr r2
;/* 割り込み有効にする */
setpsw i
;/* 割り込み実行処理呼び出し */
mov.l #_kernel_exe_int, r2
mov.l [r0+], r4;/* pop.l */ /* 割り込み番号を引数とする */
mov.l r4, r1 ;r1がshでのr4かな
jsr r2
;/* uspを利用しない場合2 begin*/
;/* スタックの復帰 */
; mov.l #_kernel_int_ssp, r1
; mov.l [r1], r0
;/* uspを利用しない場合2 end */
;/* uspに変更 uspを利用する場合 */
;/* 割り込み無効にする */
clrpsw i
;/* レジスタ一旦復帰 */
popm r14-r15
popm r1-r6
;/* uspへデータ写し */
pushm r5-r6;r6 r5
mvfc usp, r6
mov.l 16[r0], r5;psw
mov.l r5, [-r6];psw
mov.l 12[r0], r5;pc
mov.l r5, [-r6];pc
mov.l 8[r0], r5;r4
mov.l r5, [-r6];r4
mov.l 4[r0], r5;r6
mov.l r5, [-r6];r6
mov.l 0[r0], r5;r5
mov.l r5, [-r6];r5
mvtc r6, usp
add #20, r0
setpsw u
;/* uspにレジスタ改めて退避 */
pushm r1-r4
pushm r14-r15
;/* uspに変更終わり */
;/* 割り込みカウンタのクリア */
mov.l #_kernel_int_cnt, r2
xor r1, r1
mov.l r1, [r2]
;/* ベースマスク値に戻す */
mov.l #_hospac_sh_imsk_base, r1
mov.l [r1], r2
mov.l #_hospac_sh_imsk, r1
mov.l r2, [r1]
;/* 割り込み終了処理呼び出し */
mov.l #_kernel_end_int, r2
jsr r2
;/* レジスタ復帰 */
popm r14-r15
popm r1-r6
push.l r1
;/* 復帰時割り込みマスクの設定 */ /* 復帰時マスク設定の必要性要確認 */
mov.l #_hospac_sh_imsk, r4
mov.l [r4], r4 ;/* マスク値取得 */
mov.l 12[r0], r1
or r4, r1
mov.l r1, 12[r0] ;/* 復帰時SRのマスク設定 */
mov.l [r0+], r1
mov.l [r0+], r4
rte
;/* 多重割り込み処理 */
int_multi:
mov.l r1, [r2] ;/* 割り込みネスト値を設定 */
;/* 割り込み有効にする */
setpsw i
;/* 割り込み実行処理呼び出し */
mov.l r4, r1
mov.l #_kernel_exe_int, r2
jsr r2 ;/* 割り込み番号を引数とする */
;/* 割り込みカウンタの減算 */
mov.l #_kernel_int_cnt, r2
mov.l [r2], r1
add #-1, r1
mov.l r1, [r2]
;/* 割り込み無効にする */
clrpsw i
;/* imask 復帰*/
mov.l #_hospac_sh_imsk, r2
mov.l r6, [r2]
;/* レジスタ復帰 */
popm r14-r15
popm r1-r6
mov.l [r0+], r4 ;/* pop.l */
rte
.end
;/* ------------------------------------------------------------------------ */
;/* Copyright (C) 1998-2012 by Project HOS */
;/* ------------------------------------------------------------------------ */
sample/rx600/system.cfg を修正します。
/* ------------------------------------------------------------------------ */
/* Hyper Operating System V4 μITRON4.0仕様 Real-Time OS */
/* コンフィギュレーションファイル */
/* */
/* Copyright (C) 1998-2002 by Project HOS */
/* http://sourceforge.jp/projects/hos/ */
/* ------------------------------------------------------------------------ */
/* RX63N */
#include "user_id.h"
/* HOS 独ゥの設定 */
HOS_KERNEL_HEAP(4096); /* カーネルヒープの設定(省略時 0) */
HOS_TIM_TIC(1, 1); /* タイムティックの設定(省略時 1/1 ) */
HOS_MAX_TPRI(8); /* 最大優先度(省略時 16) */
HOS_MIN_INTNO(0); /* 割り込み番号の最小値(省略時 0) */
HOS_MAX_INTNO(256); /* 割り込み番号の最大値(省略時 0) */
HOS_MAX_TSKID(16); /* 最大タスクID番号(省略時静的生成に必要なだけ) */
/* インクルードファイルの指定 */
INCLUDE("\"user_id.h\"");
INCLUDE("\"sample.h\"");
INCLUDE("\"iodefine.h\"");
INCLUDE("\"ostimer.h\"");
INCLUDE("\"sci.h\"");
/* OSタイマ用 */
ATT_ISR({TA_HLNG, 0, IR_CMT0_CMI0, ostim_hdr});
ATT_INI({TA_HLNG, 6000 - 1, ostim_init});
/* 哲学メ5人分のタスク */
CRE_TSK(TSKID_PHILOSOPHER1, {TA_HLNG, 1, PhilosopherTask, 1, 1024, NULL});
CRE_TSK(TSKID_PHILOSOPHER2, {TA_HLNG, 2, PhilosopherTask, 1, 512, NULL});
CRE_TSK(TSKID_PHILOSOPHER3, {TA_HLNG, 3, PhilosopherTask, 1, 512, NULL});
CRE_TSK(TSKID_PHILOSOPHER4, {TA_HLNG, 4, PhilosopherTask, 1, 512, NULL});
CRE_TSK(TSKID_PHILOSOPHER5, {TA_HLNG, 5, PhilosopherTask, 1, 512, NULL});
/* フォーク5本分のセマフォ */
CRE_SEM(SEMID_FORK1, {TA_TFIFO, 1, 1});
CRE_SEM(SEMID_FORK2, {TA_TFIFO, 1, 1});
CRE_SEM(SEMID_FORK3, {TA_TFIFO, 1, 1});
CRE_SEM(SEMID_FORK4, {TA_TFIFO, 1, 1});
CRE_SEM(SEMID_FORK5, {TA_TFIFO, 1, 1});
/* 初期化ルーチンの追加 */
ATT_INI({TA_HLNG, 0, SampleInitialize});
/* システム排他用 */
CRE_SEM(SEMID_SYSCS, {TA_TFIFO, 1, 1});
/* SCI用 */
CRE_FLG(FLGID_SCI1_SND, {TA_TFIFO | TA_WSGL | TA_CLR, 0});
CRE_SEM(SEMID_SCI1_RCV, {TA_TFIFO, 0, SCI_RCV_BUFSZ});
CRE_SEM(SEMID_SCI1_SND, {TA_TFIFO, 1, 1});
ATT_ISR({TA_HLNG, 1, IR_SCI2_TXI2, sci_snd_hdr});
ATT_ISR({TA_HLNG, 1, IR_SCI2_RXI2, sci_rcv_hdr});
/*ATT_INI({TA_HLNG, 0, sci_init}); */
/* cyc */
CRE_CYC(CYC_ID, {TA_HLNG | TA_STA, 0, cyc_test, 500, 0});
/* ------------------------------------------------------------------------ */
/* Copyright (C) 1998-2002 by Project HOS */
/* ------------------------------------------------------------------------ */
Borland C++のプリプロセッサを利用して
cpp32.exe -P- -osystem.i system.cfg
hos4cfg.exe system.i
で
kernel_cfg.c と kernel_id.h が得られます。
あとは
sample/rx600/vector.src hew版
;/* ------------------------------------------------------------------------ */
;/* Hyper Operating System V4 サンプルプログラム */
;/* 割り込みベクタテーブル (日立 SH2 gcc 用) */
;/* */
;/* Copyright (C) 1998-2002 by Project HOS */
;/* http://sourceforge.jp/projects/hos/ */
;/* ------------------------------------------------------------------------ */
.glb _hos_vecter000
.glb _hos_vecter001
.glb _hos_vecter002
.glb _hos_vecter003
.glb _hos_vecter004
.glb _hos_vecter005
.glb _hos_vecter006
.glb _hos_vecter007
.glb _hos_vecter008
.glb _hos_vecter009
.glb _hos_vecter010
.glb _hos_vecter011
.glb _hos_vecter012
.glb _hos_vecter013
.glb _hos_vecter014
.glb _hos_vecter015
.glb _hos_vecter016
.glb _hos_vecter017
.glb _hos_vecter018
.glb _hos_vecter019
.glb _hos_vecter020
.glb _hos_vecter021
.glb _hos_vecter022
.glb _hos_vecter023
.glb _hos_vecter024
.glb _hos_vecter025
.glb _hos_vecter026
.glb _hos_vecter027
.glb _hos_vecter028
.glb _hos_vecter029
.glb _hos_vecter030
.glb _hos_vecter031
.glb _hos_vecter032
.glb _hos_vecter033
.glb _hos_vecter034
.glb _hos_vecter035
.glb _hos_vecter036
.glb _hos_vecter037
.glb _hos_vecter038
.glb _hos_vecter039
.glb _hos_vecter040
.glb _hos_vecter041
.glb _hos_vecter042
.glb _hos_vecter043
.glb _hos_vecter044
.glb _hos_vecter045
.glb _hos_vecter046
.glb _hos_vecter047
.glb _hos_vecter048
.glb _hos_vecter049
.glb _hos_vecter050
.glb _hos_vecter051
.glb _hos_vecter052
.glb _hos_vecter053
.glb _hos_vecter054
.glb _hos_vecter055
.glb _hos_vecter056
.glb _hos_vecter057
.glb _hos_vecter058
.glb _hos_vecter059
.glb _hos_vecter060
.glb _hos_vecter061
.glb _hos_vecter062
.glb _hos_vecter063
.glb _hos_vecter064
.glb _hos_vecter065
.glb _hos_vecter066
.glb _hos_vecter067
.glb _hos_vecter068
.glb _hos_vecter069
.glb _hos_vecter070
.glb _hos_vecter071
.glb _hos_vecter072
.glb _hos_vecter073
.glb _hos_vecter074
.glb _hos_vecter075
.glb _hos_vecter076
.glb _hos_vecter077
.glb _hos_vecter078
.glb _hos_vecter079
.glb _hos_vecter080
.glb _hos_vecter081
.glb _hos_vecter082
.glb _hos_vecter083
.glb _hos_vecter084
.glb _hos_vecter085
.glb _hos_vecter086
.glb _hos_vecter087
.glb _hos_vecter088
.glb _hos_vecter089
.glb _hos_vecter090
.glb _hos_vecter091
.glb _hos_vecter092
.glb _hos_vecter093
.glb _hos_vecter094
.glb _hos_vecter095
.glb _hos_vecter096
.glb _hos_vecter097
.glb _hos_vecter098
.glb _hos_vecter099
.glb _hos_vecter100
.glb _hos_vecter101
.glb _hos_vecter102
.glb _hos_vecter103
.glb _hos_vecter104
.glb _hos_vecter105
.glb _hos_vecter106
.glb _hos_vecter107
.glb _hos_vecter108
.glb _hos_vecter109
.glb _hos_vecter110
.glb _hos_vecter111
.glb _hos_vecter112
.glb _hos_vecter113
.glb _hos_vecter114
.glb _hos_vecter115
.glb _hos_vecter116
.glb _hos_vecter117
.glb _hos_vecter118
.glb _hos_vecter119
.glb _hos_vecter120
.glb _hos_vecter121
.glb _hos_vecter122
.glb _hos_vecter123
.glb _hos_vecter124
.glb _hos_vecter125
.glb _hos_vecter126
.glb _hos_vecter127
.glb _hos_vecter128
.glb _hos_vecter129
.glb _hos_vecter130
.glb _hos_vecter131
.glb _hos_vecter132
.glb _hos_vecter133
.glb _hos_vecter134
.glb _hos_vecter135
.glb _hos_vecter136
.glb _hos_vecter137
.glb _hos_vecter138
.glb _hos_vecter139
.glb _hos_vecter140
.glb _hos_vecter141
.glb _hos_vecter142
.glb _hos_vecter143
.glb _hos_vecter144
.glb _hos_vecter145
.glb _hos_vecter146
.glb _hos_vecter147
.glb _hos_vecter148
.glb _hos_vecter149
.glb _hos_vecter150
.glb _hos_vecter151
.glb _hos_vecter152
.glb _hos_vecter153
.glb _hos_vecter154
.glb _hos_vecter155
.glb _hos_vecter156
.glb _hos_vecter157
.glb _hos_vecter158
.glb _hos_vecter159
.glb _hos_vecter160
.glb _hos_vecter161
.glb _hos_vecter162
.glb _hos_vecter163
.glb _hos_vecter164
.glb _hos_vecter165
.glb _hos_vecter166
.glb _hos_vecter167
.glb _hos_vecter168
.glb _hos_vecter169
.glb _hos_vecter170
.glb _hos_vecter171
.glb _hos_vecter172
.glb _hos_vecter173
.glb _hos_vecter174
.glb _hos_vecter175
.glb _hos_vecter176
.glb _hos_vecter177
.glb _hos_vecter178
.glb _hos_vecter179
.glb _hos_vecter180
.glb _hos_vecter181
.glb _hos_vecter182
.glb _hos_vecter183
.glb _hos_vecter184
.glb _hos_vecter185
.glb _hos_vecter186
.glb _hos_vecter187
.glb _hos_vecter188
.glb _hos_vecter189
.glb _hos_vecter190
.glb _hos_vecter191
.glb _hos_vecter192
.glb _hos_vecter193
.glb _hos_vecter194
.glb _hos_vecter195
.glb _hos_vecter196
.glb _hos_vecter197
.glb _hos_vecter198
.glb _hos_vecter199
.glb _hos_vecter200
.glb _hos_vecter201
.glb _hos_vecter202
.glb _hos_vecter203
.glb _hos_vecter204
.glb _hos_vecter205
.glb _hos_vecter206
.glb _hos_vecter207
.glb _hos_vecter208
.glb _hos_vecter209
.glb _hos_vecter210
.glb _hos_vecter211
.glb _hos_vecter212
.glb _hos_vecter213
.glb _hos_vecter214
.glb _hos_vecter215
.glb _hos_vecter216
.glb _hos_vecter217
.glb _hos_vecter218
.glb _hos_vecter219
.glb _hos_vecter220
.glb _hos_vecter221
.glb _hos_vecter222
.glb _hos_vecter223
.glb _hos_vecter224
.glb _hos_vecter225
.glb _hos_vecter226
.glb _hos_vecter227
.glb _hos_vecter228
.glb _hos_vecter229
.glb _hos_vecter230
.glb _hos_vecter231
.glb _hos_vecter232
.glb _hos_vecter233
.glb _hos_vecter234
.glb _hos_vecter235
.glb _hos_vecter236
.glb _hos_vecter237
.glb _hos_vecter238
.glb _hos_vecter239
.glb _hos_vecter240
.glb _hos_vecter241
.glb _hos_vecter242
.glb _hos_vecter243
.glb _hos_vecter244
.glb _hos_vecter245
.glb _hos_vecter246
.glb _hos_vecter247
.glb _hos_vecter248
.glb _hos_vecter249
.glb _hos_vecter250
.glb _hos_vecter251
.glb _hos_vecter252
.glb _hos_vecter253
.glb _hos_vecter254
.glb _hos_vecter255
.section C$VECT,CODE,ALIGN=4
.lword _hos_vecter000
.lword _hos_vecter001
.lword _hos_vecter002
.lword _hos_vecter003
.lword _hos_vecter004
.lword _hos_vecter005
.lword _hos_vecter006
.lword _hos_vecter007
.lword _hos_vecter008
.lword _hos_vecter009
.lword _hos_vecter010
.lword _hos_vecter011
.lword _hos_vecter012
.lword _hos_vecter013
.lword _hos_vecter014
.lword _hos_vecter015
.lword _hos_vecter016
.lword _hos_vecter017
.lword _hos_vecter018
.lword _hos_vecter019
.lword _hos_vecter020
.lword _hos_vecter021
.lword _hos_vecter022
.lword _hos_vecter023
.lword _hos_vecter024
.lword _hos_vecter025
.lword _hos_vecter026
.lword _hos_vecter027
.lword _hos_vecter028
.lword _hos_vecter029
.lword _hos_vecter030
.lword _hos_vecter031
.lword _hos_vecter032
.lword _hos_vecter033
.lword _hos_vecter034
.lword _hos_vecter035
.lword _hos_vecter036
.lword _hos_vecter037
.lword _hos_vecter038
.lword _hos_vecter039
.lword _hos_vecter040
.lword _hos_vecter041
.lword _hos_vecter042
.lword _hos_vecter043
.lword _hos_vecter044
.lword _hos_vecter045
.lword _hos_vecter046
.lword _hos_vecter047
.lword _hos_vecter048
.lword _hos_vecter049
.lword _hos_vecter050
.lword _hos_vecter051
.lword _hos_vecter052
.lword _hos_vecter053
.lword _hos_vecter054
.lword _hos_vecter055
.lword _hos_vecter056
.lword _hos_vecter057
.lword _hos_vecter058
.lword _hos_vecter059
.lword _hos_vecter060
.lword _hos_vecter061
.lword _hos_vecter062
.lword _hos_vecter063
.lword _hos_vecter064
.lword _hos_vecter065
.lword _hos_vecter066
.lword _hos_vecter067
.lword _hos_vecter068
.lword _hos_vecter069
.lword _hos_vecter070
.lword _hos_vecter071
.lword _hos_vecter072
.lword _hos_vecter073
.lword _hos_vecter074
.lword _hos_vecter075
.lword _hos_vecter076
.lword _hos_vecter077
.lword _hos_vecter078
.lword _hos_vecter079
.lword _hos_vecter080
.lword _hos_vecter081
.lword _hos_vecter082
.lword _hos_vecter083
.lword _hos_vecter084
.lword _hos_vecter085
.lword _hos_vecter086
.lword _hos_vecter087
.lword _hos_vecter088
.lword _hos_vecter089
.lword _hos_vecter090
.lword _hos_vecter091
.lword _hos_vecter092
.lword _hos_vecter093
.lword _hos_vecter094
.lword _hos_vecter095
.lword _hos_vecter096
.lword _hos_vecter097
.lword _hos_vecter098
.lword _hos_vecter099
.lword _hos_vecter100
.lword _hos_vecter101
.lword _hos_vecter102
.lword _hos_vecter103
.lword _hos_vecter104
.lword _hos_vecter105
.lword _hos_vecter106
.lword _hos_vecter107
.lword _hos_vecter108
.lword _hos_vecter109
.lword _hos_vecter110
.lword _hos_vecter111
.lword _hos_vecter112
.lword _hos_vecter113
.lword _hos_vecter114
.lword _hos_vecter115
.lword _hos_vecter116
.lword _hos_vecter117
.lword _hos_vecter118
.lword _hos_vecter119
.lword _hos_vecter120
.lword _hos_vecter121
.lword _hos_vecter122
.lword _hos_vecter123
.lword _hos_vecter124
.lword _hos_vecter125
.lword _hos_vecter126
.lword _hos_vecter127
.lword _hos_vecter128
.lword _hos_vecter129
.lword _hos_vecter130
.lword _hos_vecter131
.lword _hos_vecter132
.lword _hos_vecter133
.lword _hos_vecter134
.lword _hos_vecter135
.lword _hos_vecter136
.lword _hos_vecter137
.lword _hos_vecter138
.lword _hos_vecter139
.lword _hos_vecter140
.lword _hos_vecter141
.lword _hos_vecter142
.lword _hos_vecter143
.lword _hos_vecter144
.lword _hos_vecter145
.lword _hos_vecter146
.lword _hos_vecter147
.lword _hos_vecter148
.lword _hos_vecter149
.lword _hos_vecter150
.lword _hos_vecter151
.lword _hos_vecter152
.lword _hos_vecter153
.lword _hos_vecter154
.lword _hos_vecter155
.lword _hos_vecter156
.lword _hos_vecter157
.lword _hos_vecter158
.lword _hos_vecter159
.lword _hos_vecter160
.lword _hos_vecter161
.lword _hos_vecter162
.lword _hos_vecter163
.lword _hos_vecter164
.lword _hos_vecter165
.lword _hos_vecter166
.lword _hos_vecter167
.lword _hos_vecter168
.lword _hos_vecter169
.lword _hos_vecter170
.lword _hos_vecter171
.lword _hos_vecter172
.lword _hos_vecter173
.lword _hos_vecter174
.lword _hos_vecter175
.lword _hos_vecter176
.lword _hos_vecter177
.lword _hos_vecter178
.lword _hos_vecter179
.lword _hos_vecter180
.lword _hos_vecter181
.lword _hos_vecter182
.lword _hos_vecter183
.lword _hos_vecter184
.lword _hos_vecter185
.lword _hos_vecter186
.lword _hos_vecter187
.lword _hos_vecter188
.lword _hos_vecter189
.lword _hos_vecter190
.lword _hos_vecter191
.lword _hos_vecter192
.lword _hos_vecter193
.lword _hos_vecter194
.lword _hos_vecter195
.lword _hos_vecter196
.lword _hos_vecter197
.lword _hos_vecter198
.lword _hos_vecter199
.lword _hos_vecter200
.lword _hos_vecter201
.lword _hos_vecter202
.lword _hos_vecter203
.lword _hos_vecter204
.lword _hos_vecter205
.lword _hos_vecter206
.lword _hos_vecter207
.lword _hos_vecter208
.lword _hos_vecter209
.lword _hos_vecter210
.lword _hos_vecter211
.lword _hos_vecter212
.lword _hos_vecter213
.lword _hos_vecter214
.lword _hos_vecter215
.lword _hos_vecter216
.lword _hos_vecter217
.lword _hos_vecter218
.lword _hos_vecter219
.lword _hos_vecter220
.lword _hos_vecter221
.lword _hos_vecter222
.lword _hos_vecter223
.lword _hos_vecter224
.lword _hos_vecter225
.lword _hos_vecter226
.lword _hos_vecter227
.lword _hos_vecter228
.lword _hos_vecter229
.lword _hos_vecter230
.lword _hos_vecter231
.lword _hos_vecter232
.lword _hos_vecter233
.lword _hos_vecter234
.lword _hos_vecter235
.lword _hos_vecter236
.lword _hos_vecter237
.lword _hos_vecter238
.lword _hos_vecter239
.lword _hos_vecter240
.lword _hos_vecter241
.lword _hos_vecter242
.lword _hos_vecter243
.lword _hos_vecter244
.lword _hos_vecter245
.lword _hos_vecter246
.lword _hos_vecter247
.lword _hos_vecter248
.lword _hos_vecter249
.lword _hos_vecter250
.lword _hos_vecter251
.lword _hos_vecter252
.lword _hos_vecter253
.lword _hos_vecter254
.lword _hos_vecter255
.end
;/* ------------------------------------------------------------------------ */
;/* Copyright (C) 1998-2002 by Project HOS */
;/* ------------------------------------------------------------------------ */
sample/rx600/ostimer.c
/* ------------------------------------------------------------------------ */
/* Hyper Operating System V4 サンプルプログラム */
/* OS用タイマ */
/* */
/* Copyright (C) 1998-2002 by Project HOS */
/* http://sourceforge.jp/projects/hos/ */
/* ------------------------------------------------------------------------ */
#include <machine.h>
#include "kernel.h"
#include "iodefine.h"
#include "ostimer.h"
/* OS用タイマ初期化 */
void
ostim_init (VP_INT exinf)
{
/* タイマ初期化 */
SYSTEM.PRCR.WORD = 0xA503;
MSTP (CMT0) = 0; /* CMT0モジュールストップ状態解除 */
SYSTEM.PRCR.WORD = 0xA500;
CMT.CMSTR0.BIT.STR0 = 0; /* CMT0カウント動作停止 */
CMT0.CMCR.WORD = 0x0040; /* PCLK/8でカウント */
CMT0.CMCNT = 0; /* タイマカウンタ初期化 */
CMT0.CMCOR = (UH) (INT) exinf; /* CMTコンスタントレジスタ設定 */
IPR (CMT0, CMI0) = 7; /* CMT0 CMI0割り込み優先レベル設定 */
IEN (CMT0, CMI0) = 1; /* CMT0 CMI0割込み要求許可 */
CMT.CMSTR0.BIT.STR0 = 1; /* CMT0カウント動作開始 */
}
/* 割り込みハンドラサンプル */
void
ostim_hdr (VP_INT exinf) /* OSタイマ用ハンドラ */
{
IR(CMT0, CMI0) = 0;
isig_tim (); /* タイムティックの供給 */
}
/* ------------------------------------------------------------------------ */
/* Copyright (C) 1998-2002 by Project HOS */
/* ------------------------------------------------------------------------ */
sample/rx600/sci.c
/* ------------------------------------------------------------------------ */
/* RX63N SCI制御 */
/* */
/* Copyright (C) 1998-2002 by Project HOS */
/* http://sourceforge.jp/projects/hos/ */
/* ------------------------------------------------------------------------ */
#include "kernel.h"
#include "kernel_id.h"
#include "iodefine.h"
#include "sci.h"
#include "stmfifo.h"
/* SCI制御クラス */
typedef struct t_sci
{
ID flgid_snd;
ID semid_rcv;
T_STMFIFO sndfifo;
T_STMFIFO rcvfifo;
UB sndbuf[SCI_SND_BUFSZ];
UB rcvbuf[SCI_RCV_BUFSZ];
}
T_SCI;
T_SCI scicb_tbl[1];
/* 初期化 */
void
sci_init (VP_INT exinf)
{
T_SCI *scicb;
SYSTEM.PRCR.WORD = 0xA503; /* */
MSTP (SCI2) = 0; /* Enable module */
SYSTEM.PRCR.WORD = 0xA500; /* */
SCI2.SCR.BYTE = 0; /* シリアルコントロールレジスタクリア */
PORT1.PMR.BIT.B3 = 0;
PORT1.PMR.BIT.B2 = 0;
MPC.PWPR.BIT.B0WI = 0;
MPC.PWPR.BIT.PFSWE = 1;
MPC.P13PFS.BYTE = 10; /* P13 TXD2 */
MPC.P12PFS.BYTE = 10; /* P12 RXD2 */
MPC.PWPR.BIT.PFSWE = 0;
PORT1.PMR.BIT.B3 = 1;
PORT1.PMR.BIT.B2 = 1;
PORT1.PDR.BIT.B3 = 1; /* TXD2 is output */
PORT1.PDR.BIT.B2 = 0; /* RXD2 is input */
scicb_tbl[0].flgid_snd = FLGID_SCI1_SND;
scicb_tbl[0].semid_rcv = SEMID_SCI1_RCV;
/* 割り込みレベルの設定 */
IPR (SCI2, RXI2) = 1;
IEN (SCI2, RXI2) = 1;
IEN (SCI2, TXI2) = 1;
}
/* オープン */
ER
sci_open (ID id, UB brr)
{
T_SCI *scicb;
INT i;
scicb = &scicb_tbl[id - 1];
/* 送受信用FIFOバッファ生成 */
stmfifo_cre_fifo (&scicb->sndfifo, scicb->sndbuf, SCI_SND_BUFSZ);
stmfifo_cre_fifo (&scicb->rcvfifo, scicb->rcvbuf, SCI_RCV_BUFSZ);
/* 初期化 */
SCI2.SCR.BIT.CKE = 0; /* シリアルコントロールレジスタクリア */
SCI2.SMR.BYTE = 0; /* シリアルモードレジスタクリア */
SCI2.SCMR.BYTE = 0; /* */
SCI2.SEMR.BYTE = 0; /* */
SCI2.BRR = brr;
SCI2.SPMR.BIT.CTSE = 0;
SCI2.SCR.BIT.TEIE = 0; /* Enable TEND interrupt flag */
SCI2.SCR.BIT.RIE = 1; /* Enable RX interrupt flag */
SCI2.SCR.BIT.RE = 1; /* Enable */
SCI2.SCR.BIT.TIE = 0; /* Enable TX interrupt flag */
SCI2.SCR.BIT.TE = 1; /* Enable */
}
/* クローズ */
ER
sci_close (ID id)
{
T_SCI *scicb;
scicb = &scicb_tbl[id - 1];
/* SCIの停止 */
SCI2.SCR.BYTE = 0; /* シリアルコントロールレジスタクリア */
/* バッファ破棄 */
stmfifo_del_fifo (&scicb->sndfifo);
stmfifo_del_fifo (&scicb->rcvfifo);
}
ER
sci_trend_chk (ID id)
{
T_SCI *scicb;
scicb = &scicb_tbl[id - 1];
if (stmfifo_emp_chk (&scicb->sndfifo) != E_OK)
{
return E_OK;
}
else
{
return E_TMOUT;
}
}
/* 1文字出力 */
ER
sci_putc (ID id, UB chr)
{
T_SCI *scicb;
FLGPTN flgptn;
UB c ;
scicb = &scicb_tbl[id - 1];
/* *RX_PEDR |= 0x10; !!!not need? */
if (chr == '\0')
{
return -1;
}
//SCI2.SCR.BIT.TIE = 0;
if(SCI2.SCR.BIT.TIE == 0){
if (stmfifo_rcv_chr (&scicb->sndfifo, &c) == E_OK){
SCI2.TDR = c;
SCI2.SCR.BIT.TIE = 1;
}
}
while (stmfifo_snd_chr (&scicb->sndfifo, chr) != E_OK)
{
clr_flg (scicb->flgid_snd, 0xfffe);
wai_flg (scicb->flgid_snd, 1, TWF_ANDW, &flgptn);
}
}
/* 文字列出力 */
ER_UINT
sci_puts (ID id, const UB * str)
{
char c;
T_SCI *scicb;
scicb = &scicb_tbl[id - 1];
if (*str == '\0')
{
return -1;
}
//SCI2.SCR.BIT.TIE = 0;
if(SCI2.SCR.BIT.TIE == 0){
if (stmfifo_rcv_chr (&scicb->sndfifo, &c) == E_OK){
SCI2.TDR = c;
SCI2.SCR.BIT.TIE = 1;
}
}
while (*str)
{
c = *str++;
while (stmfifo_snd_chr (&scicb->sndfifo, c) != E_OK)
{
clr_flg (scicb->flgid_snd, 0xfffe);
wai_flg (scicb->flgid_snd, 1, TWF_ANDW, NULL);
}
}
return 0;
}
/* 1文字入力 */
ER_UINT
sci_getc (ID id)
{
T_SCI *scicb;
UB c;
scicb = &scicb_tbl[id - 1];
wai_sem (scicb->semid_rcv);
stmfifo_rcv_chr (&scicb->rcvfifo, &c);
return (ER_UINT) c;
}
/* 文字列入力 */
ER_UINT
sci_gets (ID id, UB * str)
{
INT i;
UB c;
for (i = 0;; i++)
{
c = sci_getc (id);
if (c == '\r')
{
break;
}
str[i] = c;
}
str[i] = '\0';
return i;
}
/* 送信割り込みハンドラ */
void
sci_snd_hdr (VP_INT exinf)
{
T_SCI *scicb;
ID id;
UB c;
id = (ID) exinf;
scicb = &scicb_tbl[id - 1];
/* *RX_PEDR |= 0x01; !!! */
/* 送信FIFOから取り出し */
if (stmfifo_rcv_chr (&scicb->sndfifo, &c) != E_OK)
{
/* 送信割り込み停止 */ //問題なければここには来ない
SCI2.SCR.BIT.TIE = 0;
return;
}
/* 1キャラクタ送信 */
SCI2.TDR = c;
/* 送信可能フラグセット */
iset_flg (scicb->flgid_snd, 1);
if (stmfifo_emp_chk (&scicb->sndfifo) != E_OK)
{
/* 送信割り込み停止 */
SCI2.SCR.BIT.TIE = 0;
}
}
/* 受信割り込みハンドラ */
void
sci_rcv_hdr (VP_INT exinf)
{
T_SCI *scicb;
ID id;
UB c;
id = (ID) exinf;
scicb = &scicb_tbl[id - 1];
/* 1キャラクタ受信 */
c = SCI2.RDR;
SCI2.SCR.BYTE &= ~0x38;
/* 受信FIFOバッファに追加 */
if (stmfifo_snd_chr (&scicb->rcvfifo, c) == E_OK)
{
sig_sem (scicb->semid_rcv);
}
}
/* ------------------------------------------------------------------------ */
/* Copyright (C) 1998-2002 by Project HOS */
/* ------------------------------------------------------------------------ */
sample/rx600/hwsetup.c
#include <machine.h>
#include "iodefine.h"
void
HardwareSetup (void)
{
int i;
/* Protect off. */
SYSTEM.PRCR.WORD = 0xA50b;
/* Wait 2 cycles Extal */
SYSTEM.MOSCWTCR.BYTE = 0x0d;
/* PLL wait */
SYSTEM.PLLWTCR.BYTE = 0x0f;
/* PLL OFF */
SYSTEM.PLLCR2.BYTE = 0x01;
/* x16 @PLL */
SYSTEM.PLLCR.WORD = 0x0F00;
/* EXTAL ON */
SYSTEM.MOSCCR.BYTE = 0x00;
/* PLL ON */
SYSTEM.PLLCR2.BYTE = 0x00;
for (i = 0; i < 0x168; i++)
nop ();
SYSTEM.SCKCR.LONG = 0x21c21211; /* OK */
SYSTEM.SCKCR2.WORD = 0x0033;
SYSTEM.SCKCR3.WORD = 0x0400; /* PLL */
SYSTEM.PRCR.WORD = 0xA500;
/* PA0 */
PORTA.PMR.BIT.B0 = 0;
PORTA.PDR.BIT.B0 = 1;
PORTA.PODR.BIT.B0 = 1;
/* PA1 */
PORTA.PMR.BIT.B1 = 0;
PORTA.PDR.BIT.B1 = 1;
PORTA.PODR.BIT.B1 = 0;
/* PA2 */
PORTA.PMR.BIT.B2 = 0;
PORTA.PDR.BIT.B2 = 1;
PORTA.PODR.BIT.B2 = 0;
/* PA6 */
PORTA.PMR.BIT.B6 = 0;
PORTA.PDR.BIT.B6 = 1;
PORTA.PODR.BIT.B6 = 0;
/* PA7 */
PORTA.PMR.BIT.B7 = 0;
PORTA.PDR.BIT.B7 = 0;
}
sample/rx600/intprg.c /***********************************************************************/
/* */
/* FILE :intprg.c */
/* DATE :Wed, Aug 01, 2012 */
/* DESCRIPTION :Interrupt Program */
/* CPU TYPE :RX63N */
/* */
/* This file is generated by Renesas Project Generator (Ver.4.52). */
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
/* */
/***********************************************************************/
/************************************************************************
*
* Device : RX/RX600/RX63N
*
* File Name : intprg.c
*
* Abstract : Interrupt Program.
*
* History : 0.10 (2011-02-21) [Hardware Manual Revision : 0.01]
*
* NOTE : THIS IS A TYPICAL EXAMPLE.
*
* Copyright (C) 2011 Renesas Electronics Corporation.
* and Renesas Solutions Corp.
*
*********************************************************************/
#include <machine.h>
#include "vect.h"
#pragma section IntPRG
// Exception(Supervisor Instruction)
void Excep_SuperVisorInst(void){/* brk(); */}
// Exception(Undefined Instruction)
void Excep_UndefinedInst(void){/* brk(); */}
// Exception(Floating Point)
void Excep_FloatingPoint(void){/* brk(); */}
// NMI
void NonMaskableInterrupt(void){/* brk(); */}
// Dummy
void Dummy(void){/* brk(); */}
sample/rx600/resetprg.c /***********************************************************************/
/* */
/* FILE :resetprg.c */
/* DATE :Wed, Aug 01, 2012 */
/* DESCRIPTION :Reset Program */
/* CPU TYPE :RX63N */
/* */
/* This file is generated by Renesas Project Generator (Ver.4.52). */
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
/* */
/***********************************************************************/
/*********************************************************************
*
* Device : RX/RX600
*
* File Name : resetprg.c
*
* Abstract : Reset Program.
*
* History : 1.00 (2009-08-07)
* : 1.10 (2011-02-21)
*
* NOTE : THIS IS A TYPICAL EXAMPLE.
*
* Copyright (C) 2009 (2011) Renesas Electronics Corporation.
* and Renesas Solutions Corp.
*
*********************************************************************/
#include <machine.h>
#include <_h_c_lib.h>
//#include <stddef.h> // Remove the comment when you use errno
//#include <stdlib.h> // Remove the comment when you use rand()
#include "typedefine.h" // Define Types
#include "stacksct.h" // Stack Sizes (Interrupt and User)
#ifdef __cplusplus
extern "C"
{
#endif
void PowerON_Reset (void);
void main (void);
#ifdef __cplusplus
}
#endif
//#ifdef __cplusplus // Use SIM I/O
//extern "C" {
//#endif
//extern void _INIT_IOLIB(void);
//extern void _CLOSEALL(void);
//#ifdef __cplusplus
//}
//#endif
#define PSW_init 0x00030000 // PSW bit pattern
#define FPSW_init 0x00000000 // FPSW bit base pattern
//extern void srand(_UINT); // Remove the comment when you use rand()
//extern _SBYTE *_s1ptr; // Remove the comment when you use strtok()
#ifdef __cplusplus // Use Hardware Setup
extern "C"
{
#endif
extern void HardwareSetup (void);
#ifdef __cplusplus
}
#endif
//#ifdef __cplusplus // Remove the comment when you use global class object
//extern "C" { // Sections C$INIT and C$END will be generated
//#endif
//extern void _CALL_INIT(void);
//extern void _CALL_END(void);
//#ifdef __cplusplus
//}
//#endif
//unsigned long kernel_int_sp;
#pragma section ResetPRG // output PowerON_Reset to PResetPRG section
#pragma entry PowerON_Reset
void
PowerON_Reset (void)
{
set_intb (__sectop ("C$VECT"));
#ifdef __ROZ // Initialize FPSW
#define _ROUND 0x00000001 // Let FPSW RMbits=01 (round to zero)
#else
#define _ROUND 0x00000000 // Let FPSW RMbits=00 (round to nearest)
#endif
#ifdef __DOFF
#define _DENOM 0x00000100 // Let FPSW DNbit=1 (denormal as zero)
#else
#define _DENOM 0x00000000 // Let FPSW DNbit=0 (denormal as is)
#endif
// set_fpsw(FPSW_init | _ROUND | _DENOM);
_INITSCT ();
// _INIT_IOLIB(); // Use SIM I/O
// errno=0; // Remove the comment when you use errno
// srand((_UINT)1); // Remove the comment when you use rand()
// _s1ptr=NULL; // Remove the comment when you use strtok()
HardwareSetup (); // Use Hardware Setup
nop ();
// _CALL_INIT(); // Remove the comment when you use global class object
set_psw (PSW_init); // Set Ubit & Ibit for PSW
// chg_pmusr(); // Remove the comment when you need to change PSW PMbit (SuperVisor->User)
main ();
// _CLOSEALL(); // Use SIM I/O
// _CALL_END(); // Remove the comment when you use global class object
brk ();
}
sample/rx600/sample.c /* ------------------------------------------------------------------------ */
/* Hyper Operating System V4 サンプルプログラム */
/* いわゆる哲学者の食事の問題 */
/* */
/* Copyright (C) 1998-2002 by Project HOS */
/* http://sourceforge.jp/projects/hos/ */
/* ------------------------------------------------------------------------ */
#include <stdio.h>
#include <stdlib.h>
#include "kernel.h"
#include "kernel_id.h"
#include "user_id.h"
#include "iodefine.h"
#include "sci.h"
#include "sample.h"
#define SCIID ID_SCI1
#define LEFT_FORK(id) ((id) % 5 + 1)
#define RIGHT_FORK(id) (id)
void SetLed (INT id); /* 対応のLED点灯 */
void ResetLed (INT id); /* 対応LDEの消灯 */
int led = 0;
/* メイン関数 */
int
main ()
{
/* I/O の初期化 */
sci_init (1);
sci_open (1, 12);
/* HOS-V4 の開始 */
sta_hos ();
chg_imsk (0);
hospac_ena_int ();
return 0;
}
/* ATT_INI 登録の関数 */
void
SampleInitialize (VP_INT exinf)
{
/* タスク起動 */
act_tsk (TSKID_PHILOSOPHER1);
act_tsk (TSKID_PHILOSOPHER2);
act_tsk (TSKID_PHILOSOPHER3);
act_tsk (TSKID_PHILOSOPHER4);
act_tsk (TSKID_PHILOSOPHER5);
}
void
ELLOOP (VP_INT exinf)
{
while (1);
}
/* 哲学者タスク */
void
PhilosopherTask (VP_INT exinf)
{
INT id;
INT i;
id = (INT) exinf;
dly_tsk(10);
wai_sem( SEMID_SCI1_SND );
sci_puts(1, "abcd1234sssssssssssssssssss ");
sci_putc(1, 0x30|(UB)id);
sci_puts(1, " sssssssssssssssssss1234\r\n");
led++;
sig_sem(SEMID_SCI1_SND);
/* 超お馬鹿アルゴリズム */
for (;;)
{
/* 適当な時間悩んでみる */
for (i = rand () % 10 + 5; i > 0; i--)
{
/* 点滅させる */
SetLed (id);
dly_tsk (100);
ResetLed (id);
dly_tsk (100);
}
/* 左右のフォークを取る */
for (;;)
{
wai_sem (LEFT_FORK (id));
if (pol_sem (RIGHT_FORK (id)) == E_OK)
{
break;
}
sig_sem (LEFT_FORK (id));
dly_tsk ((rand () % 10 + 1) * 10); /* 適当に待つ */
}
/* お食事中 */
SetLed (id); /* 点灯させる */
dly_tsk (1000);
ResetLed (id);
/* フォークを放す */
sig_sem (LEFT_FORK (id));
sig_sem (RIGHT_FORK (id));
}
}
void
cyc_test (VP_INT exinf)
{
static char blink;
blink++;
wai_sem (SEMID_SYSCS);
PORTA.PODR.BIT.B6 = blink;
sig_sem (SEMID_SYSCS);
}
/* 対応のLED点灯 */
void
SetLed (INT id)
{
wai_sem (SEMID_SYSCS);
PORTA.PODR.BYTE &= ~(0x01 << (id - 1));
sig_sem (SEMID_SYSCS);
}
/* 対応LDEの消灯 */
void
ResetLed (INT id)
{
wai_sem (SEMID_SYSCS);
PORTA.PODR.BYTE |= (0x01 << (id - 1));
sig_sem (SEMID_SYSCS);
}
/* ------------------------------------------------------------------------ */
/* Copyright (C) 1998-2002 by Project HOS */
/* ------------------------------------------------------------------------ */
その他sample/rx600/dbsct.c HEWで生成したもの
sample/rx600/vect.c HEWで生成したもの
sample/rx600/vecttbl.c HEWで生成したもの
sample/rx600/iodefine.h HEWで生成したもの
sample/rx600/stacksct.h HEWで生成したもの
sample/rx600/typedefine.h HEWで生成したもの
sample/rx600/ostimer.h そのまま
sample/rx600/sci.h そのまま
sample/rx600/stmfifot.c そのまま
sample/rx600/stmfifot.h そのまま
sample/rx600/crt0.s 削除
0 件のコメント:
コメントを投稿