diff --git a/branches/2.2D_M0+/accero.c b/branches/2.2D_M0+/accero.c index aa584ec..c0c3d6e 100644 --- a/branches/2.2D_M0+/accero.c +++ b/branches/2.2D_M0+/accero.c @@ -6,7 +6,7 @@ $Id: accero.c 418 2011-09-22 01:35:37Z n2232 $ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma SFR #pragma NOP @@ -19,7 +19,7 @@ #endif -#ifndef _WIN32 +#ifdef _78K0R #pragma interrupt INTP23 intp23_ACC_ready RB3 // 加速度センサ、データ準備完了 @@ -30,7 +30,7 @@ #include "i2c_mcu.h" -#ifndef _WIN32 +#ifdef _78K0R #include #endif // ======================================================== @@ -185,7 +185,7 @@ task_status_immed tski_acc_setup( ) // ピン不足のため、TSとそれ以外(回路違い)を区別して設定 if( system_status.model == MODEL_TS_BOARD ) { - str_send_buf[2] = bits8(0,0,0,0, 0,0,1,0); + str_send_buf[2] = bits8(0,0,0,0, 0,0,1,0); } else { @@ -212,7 +212,7 @@ task_status_immed tski_acc_setup( ) | ACC_BITS_DR_100Hz << ACC_bP_DR0 | ACC_BITS_ALL_AXIS_ON ); } - + // 実書き込み兼、通信できたかフラグ更新 if( iic_mcu_write( IIC_SLA_ACCEL, ( ACC_REG_CTRL1 | ACC_REG_FLG_BURST_ACCESS ), 4, str_send_buf ) == I2C_ERR_NOSLAVE ) { @@ -238,7 +238,7 @@ task_status_immed tski_acc_setup( ) } // センサに書きにいっている最中にSoCがまた書き換えてしまうかもしれない - DI_wt_chk(); + DI_wt_chk(); if( acc_setting_sent != ( vreg_ctr[VREG_C_ACC_CONFIG] & ( VREG_BITMASK_ACC_CONF_HOSU | VREG_BITMASK_ACC_CONF_ACQ ))) { // DI状態のまま帰る @@ -260,7 +260,7 @@ task_status_immed tski_acc_setup( ) __interrupt void intp23_ACC_ready( ) { EI(); - if( ( vreg_ctr[VREG_C_ACC_CONFIG] & ( VREG_BITMASK_ACC_CONF_HOSU | VREG_BITMASK_ACC_CONF_ACQ ) ) != 0x00 ) + if( ( vreg_ctr[VREG_C_ACC_CONFIG] & ( VREG_BITMASK_ACC_CONF_HOSU | VREG_BITMASK_ACC_CONF_ACQ ) ) != 0x00 ) { // 加速度センサ on if( ( system_status.pwr_state == ON ) || ( system_status.pwr_state == SLEEP ) ) diff --git a/branches/2.2D_M0+/batt_params.c b/branches/2.2D_M0+/batt_params.c index 74c2146..3775722 100644 --- a/branches/2.2D_M0+/batt_params.c +++ b/branches/2.2D_M0+/batt_params.c @@ -24,7 +24,7 @@ const bt_param_ bt_param[ _BT_PARAM_NUM_ ] = 0x1C, 0x60, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00 }, 2, // 2 = 19 bit mode - { 92, (u8)(-256* 0.79), (u8)(-256* 4.35) }, //  (u8)誤キャストの誤パラメータのままの方が + { 92, /*(u8)*/(-256* 0.79), /*(u8)*/(-256* 4.35) }, //  (u8)誤キャストの誤パラメータのままの方が 0xD800, // システムとしては良好な動作 { 0xEA, 0xE8 } }, @@ -42,19 +42,19 @@ const bt_param_ bt_param[ _BT_PARAM_NUM_ ] = 0x07, 0x00, 0x09, 0x30, 0x01, 0xC0, 0x01, 0xC0 }, 1, - { 171, (u8)(-256* 1.00), (u8)(-256* 2.60) }, //  (u8)誤キャストの誤パラメータのままの方が + { 171, /*(u8)*/(-256* 1.00), /*(u8)*/(-256* 2.60) }, //  (u8)誤キャストの誤パラメータのままの方が 0xDA20, // システムとしては良好な動作 { 0x69, 0x67 }, }, - + // SPFL /////////////////////////////////////////////// // BT_PARAM_SPFL_MAXELL { { - 0xA1, 0x20, 0xB7, 0x50, 0xB9, 0xD0, 0xBB, 0x00, + 0xA1, 0x20, 0xB7, 0x50, 0xB9, 0xD0, 0xBB, 0x00, 0xBC, 0x30, 0xBC, 0x60, 0xBC, 0xA0, 0xBD, 0x10, 0xBD, 0xC0, 0xBE, 0x70, 0xBF, 0xD0, 0xC2, 0xA0, - 0xC4, 0x00, 0xC8, 0x50, 0xCC, 0x80, 0xD0, 0xB0, + 0xC4, 0x00, 0xC8, 0x50, 0xCC, 0x80, 0xD0, 0xB0, 0x01, 0xA0, 0x25, 0x10, 0x18, 0xB0, 0x17, 0xC0, 0x95, 0x20, 0x6F, 0xE0, 0x7C, 0x60, 0x35, 0x10, 0x35, 0x00, 0x37, 0xF0, 0x16, 0xF0, 0x1C, 0xA0, @@ -107,11 +107,11 @@ const bt_param_ bt_param[ _BT_PARAM_NUM_ ] = { { 0x9D, 0xA0, 0xA8, 0xF0, 0xAD, 0x90, 0xAF, 0x00, - 0xB3, 0x00, 0xB3, 0xE0, 0xB4, 0xA0, 0xB5, 0x40, + 0xB3, 0x00, 0xB3, 0xE0, 0xB4, 0xA0, 0xB5, 0x40, 0xB6, 0x30, 0xB7, 0xE0, 0xB8, 0xC0, 0xBE, 0x70, - 0xC1, 0x40, 0xC4, 0x20, 0xC9, 0xA0, 0xD0, 0x30, + 0xC1, 0x40, 0xC4, 0x20, 0xC9, 0xA0, 0xD0, 0x30, 0x01, 0x10, 0x06, 0x00, 0x2C, 0x20, 0x0D, 0xA0, - 0x37, 0x00, 0x37, 0x30, 0x47, 0xF0, 0x28, 0xF0, + 0x37, 0x00, 0x37, 0x30, 0x47, 0xF0, 0x28, 0xF0, 0x25, 0xF0, 0x37, 0x30, 0x10, 0xF0, 0x14, 0xF0, 0x0F, 0x70, 0x0D, 0x00, 0x0D, 0x00, 0x0D, 0x00, }, diff --git a/branches/2.2D_M0+/fsl_user.h b/branches/2.2D_M0+/fsl_user.h index 1018689..6884b34 100644 --- a/branches/2.2D_M0+/fsl_user.h +++ b/branches/2.2D_M0+/fsl_user.h @@ -94,7 +94,7 @@ /* FLMD0 control bit */ -#ifndef _WIN32 +#ifdef _78K0R #define FSL_FLMD0_HIGH {BECTL.7 = 1;} #define FSL_FLMD0_LOW {BECTL.7 = 0;} #else diff --git a/branches/2.2D_M0+/hal.c b/branches/2.2D_M0+/hal.c index 0ebc14c..611c4dd 100644 --- a/branches/2.2D_M0+/hal.c +++ b/branches/2.2D_M0+/hal.c @@ -1,9 +1,9 @@ /* ======================================================== 簡易テストのためのHALレイヤ - + $Id: asdf$ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma SFR #endif @@ -127,7 +127,7 @@ void hal_update() } else { - SW_HOME_n = SW_HOME_n_JIKKI_RAW; + SW_HOME_n = SW_HOME_n_JIKKI_RAW; } } diff --git a/branches/2.2D_M0+/hal.h b/branches/2.2D_M0+/hal.h index 245be75..5395399 100644 --- a/branches/2.2D_M0+/hal.h +++ b/branches/2.2D_M0+/hal.h @@ -1,6 +1,10 @@ #ifndef _hal_h_ #define _hal_h_ +#ifndef _78K0R +//#define bit bool +#define bit unsigned char +#endif extern bit PM_EXTDC_n; extern bit BT_IN_CHG_n; @@ -9,6 +13,7 @@ extern bit SW_HOME_n; extern bit SW_WIFI_n; extern bit SHELL_OPEN; + // ======================================================== void hal_update(); void hal_reset(); diff --git a/branches/2.2D_M0+/i2c_ctr.c b/branches/2.2D_M0+/i2c_ctr.c index a56fb98..a219a56 100644 --- a/branches/2.2D_M0+/i2c_ctr.c +++ b/branches/2.2D_M0+/i2c_ctr.c @@ -4,7 +4,7 @@ '09 Apr $Id: i2c_ctr.c 418 2011-09-22 01:35:37Z n2232 $ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma interrupt INTIICA1 int_iic_ctr RB1 #endif @@ -46,7 +46,6 @@ #define TRC TRC1 #define SMC SMC1 #define DFC DFC1 -#define IICS IICS1 #define PortMode PM20 #define Port P20 @@ -82,7 +81,7 @@ static enum en_IIC_STATE state = IIC_IDLE; /********************************************//** isr - + ステート毎に割り込みが入り処理を進める ***********************************************/ __interrupt void int_iic_ctr( ) @@ -98,7 +97,7 @@ __interrupt void int_iic_ctr( ) if( !bit_iics_ackd // 割り込み要因はNAK(データ送信の最後) || bit_iics_spd ) // ストップコンディション(!ACKD に来たときは割り込み来ない (SPIE = 0)) { - /* + /* I2Cの反応が遅くてこのフラグを処理する前にSTDがきてしまうことがある けど、問題なく動作するつもり */ diff --git a/branches/2.2D_M0+/i2c_mcu-sub.c b/branches/2.2D_M0+/i2c_mcu-sub.c index 1a23304..9f18d2b 100644 --- a/branches/2.2D_M0+/i2c_mcu-sub.c +++ b/branches/2.2D_M0+/i2c_mcu-sub.c @@ -4,7 +4,7 @@ '09 Feb - $Id$ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma sfr #pragma di #pragma ei @@ -72,7 +72,7 @@ i2c_err iic_mcu_write_a_byte_codec( u8 adrs, u8 dat ) { // 共有レジスタが 0x00 に書き換わっている(エラッタ発生!)ようなら書き戻す u8 pm_reg_after; - + if(( rv = iic_mcu_read( IIC_SLA_CODEC, CODEC_REG_PM, 1, &pm_reg_after )) != I2C_ERR_OK ) { return( rv ); diff --git a/branches/2.2D_M0+/i2c_mcu.c b/branches/2.2D_M0+/i2c_mcu.c index db007b3..71f8018 100644 --- a/branches/2.2D_M0+/i2c_mcu.c +++ b/branches/2.2D_M0+/i2c_mcu.c @@ -4,7 +4,7 @@ '09 Feb - $Id$ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma sfr #pragma di #pragma ei @@ -135,7 +135,7 @@ static i2c_err iic_mcu_wait_free() スレーブからの 『1文字』 リード 返値がデータそのものです。 - + エラーコードは iic_mcu_result に入っています ***********************************************/ u8 iic_mcu_read_a_byte( u8 SLA, u8 adrs ) @@ -361,7 +361,7 @@ __interrupt void int_dma1( ) EI(); // 最後のバイトの送信完了待ち - while( ( SSR02L & TSF0 ) != 0 ) + while( ( SSR02L & TSF0 ) != 0 ) { u16 i = 0; if( ++i == 0 ) // タイムアウト? @@ -413,7 +413,7 @@ __interrupt void int_dma1( ) DMAIF1 = 0; DMAMK1 = 0; DST1 = 1; - + SIO10 = last_reg_adrs; // 書きっぱなし! 割り込みが発生してDMAスタート return; // おしまい diff --git a/branches/2.2D_M0+/i2c_twl.c b/branches/2.2D_M0+/i2c_twl.c index fef7ac2..627fdea 100644 --- a/branches/2.2D_M0+/i2c_twl.c +++ b/branches/2.2D_M0+/i2c_twl.c @@ -1,17 +1,15 @@ /* ======================================================== TWL 互換I2C - + $Id: i2c_twl.c 418 2011-09-22 01:35:37Z n2232 $ ======================================================== */ -#ifndef _WIN32 - -#pragma sfr /* 特殊機能レジスタ使用 */ - +#ifdef _78K0R +# pragma sfr /* 特殊機能レジスタ使用 */ #endif /*============================================================================*/ -#ifndef _WIN32 +#ifdef _78K0R # pragma interrupt INTIICA0 int_iic_twl RB2 #endif @@ -97,7 +95,7 @@ enum IIC_TWL_STATE{ /********************************************//** isr - + TWLはウェイトを理解してくれず、また、バーストR/W は しないでもらっているので、ストップコンディションまで一気にやってしまう。 ***********************************************/ diff --git a/branches/2.2D_M0+/incs.h b/branches/2.2D_M0+/incs.h index 014e6f2..cd4f58e 100644 --- a/branches/2.2D_M0+/incs.h +++ b/branches/2.2D_M0+/incs.h @@ -1,4 +1,5 @@ -#ifndef _WIN32 +#ifdef _78K0R + #pragma SFR #pragma di #pragma ei @@ -7,16 +8,19 @@ #pragma halt #endif -#ifndef _WIN32 +#ifdef _78K0R #pragma section @@CODE ROM_CODE //#pragma section @@CNST ROM_CNST #endif #ifdef _WIN32 // VCの赤線をどうにかする -#include "sim/simOnWin.h" -# endif +# include "sim/simOnWin.h" +#endif +#ifdef _IAR +# include "sim/simOnWin.h" +#endif //========================================================= diff --git a/branches/2.2D_M0+/incs_loader.h b/branches/2.2D_M0+/incs_loader.h index 0569b9f..1ee20c0 100644 --- a/branches/2.2D_M0+/incs_loader.h +++ b/branches/2.2D_M0+/incs_loader.h @@ -2,10 +2,10 @@  ピン状態はvolatileなのでタイミング依存で期待しない動作になるのを回避  兼 Hardware abstruct layer - + $Id: asdf$ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma SFR #pragma di #pragma ei @@ -13,7 +13,6 @@ #pragma stop #pragma halt - #pragma section @@CODE LDR_CODE #pragma section @@CODEL LDR_CODL @@ -23,11 +22,14 @@ #endif -# ifdef _WIN32 +#ifdef _WIN32 // VCの赤線をどうにかする #include "sim/simOnWin.h" # endif +#ifdef _IAR +# include "sim/simOnWin.h" +#endif //========================================================= #include "jhl_defs.h" diff --git a/branches/2.2D_M0+/ini_VECT.c b/branches/2.2D_M0+/ini_VECT.c index 84da25c..3cadc47 100644 --- a/branches/2.2D_M0+/ini_VECT.c +++ b/branches/2.2D_M0+/ini_VECT.c @@ -3,7 +3,7 @@ $Id$ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma nop @@ -11,11 +11,11 @@ #include "config.h" -#ifndef _WIN32 +#ifdef _78K0R -#ifdef _WDT_CHECK_ -#pragma interrupt INTWDTI fn_intwdti // wdt debug -#endif +# ifdef _WDT_CHECK_ +# pragma interrupt INTWDTI fn_intwdti // wdt debug +# endif //#pragma interrupt INTLVI fn_intlvi // 未使用 diff --git a/branches/2.2D_M0+/led.c b/branches/2.2D_M0+/led.c index 5904121..c1a3bbb 100644 --- a/branches/2.2D_M0+/led.c +++ b/branches/2.2D_M0+/led.c @@ -3,10 +3,8 @@ $Id: LED.c 418 2011-09-22 01:35:37Z n2232 $ ======================================================== */ -#ifndef _WIN32 - -#pragma sfr - +#ifdef _78K0R +# pragma sfr #endif #include "incs.h" @@ -100,7 +98,7 @@ u8 fade_to2( st_LED_dim_status* status ) /********************************************//** LEDの初期化 - + HWタイマーを使うのでそれらの初期化を行う ***********************************************/ void LED_init( ) @@ -152,7 +150,7 @@ void LED_init( ) /********************************************//** LEDの停止。 - + HWタイマーの停止 ***********************************************/ @@ -182,7 +180,7 @@ void LED_stop( ) /********************************************//** WiFi LED の更新 - + - レジスタの設定で on / off - off であってもモジュールからの送信パルスで -_-_-_--------_-_-_-------のパターン点滅 ***********************************************/ @@ -358,7 +356,7 @@ void tsk_led_notify( ) calc_info_led_next_frame( &LED_dim_status_info_R, info_LED.info_LED.red[frame] ); calc_info_led_next_frame( &LED_dim_status_info_G, info_LED.info_LED.grn[frame] ); calc_info_led_next_frame( &LED_dim_status_info_B, info_LED.info_LED.blu[frame] ); - + } time_to_next_frame --; } diff --git a/branches/2.2D_M0+/led.h b/branches/2.2D_M0+/led.h index ce8541f..04f1685 100644 --- a/branches/2.2D_M0+/led.h +++ b/branches/2.2D_M0+/led.h @@ -17,7 +17,7 @@ #define LED_duty_notify_blu TDR02 // これらはduty変えられません -#ifndef _WIN32 +#ifdef _78K0R #define LED_pow_red P4.2 #define LED_CAM P7.5 #else diff --git a/branches/2.2D_M0+/led_cam.c b/branches/2.2D_M0+/led_cam.c index 7d4a1eb..bdcde87 100644 --- a/branches/2.2D_M0+/led_cam.c +++ b/branches/2.2D_M0+/led_cam.c @@ -5,12 +5,10 @@ その間に OFF→BLINK などされると、OFFが無視されます。 - $Id$ +$Id: asdf$ *********************************************************/ -#ifndef _WIN32 - -#pragma sfr - +#ifdef _78K0R +# pragma sfr #endif #include "incs.h" diff --git a/branches/2.2D_M0+/led_pow.c b/branches/2.2D_M0+/led_pow.c index 6773d4e..be97c4b 100644 --- a/branches/2.2D_M0+/led_pow.c +++ b/branches/2.2D_M0+/led_pow.c @@ -24,10 +24,8 @@ enum LED_ILUM_MODE{ LED_POW_ILM_CEOFF }; ======================================================== */ -#ifndef _WIN32 - -#pragma sfr - +#ifdef _78K0R +# pragma sfr #endif #include "incs.h" @@ -73,26 +71,26 @@ static u8 frame_sleep; static st_LED_dim_status LED_dim_status_sleep; extern bit ledInitialized; -extern bit BT_IN_CHG_delayed_n; +extern bit BT_IN_CHG_delayed_n; /********************************************//** 電源LED - + 基本的には、 - + 動作時、 - 電池残量 > 10% 青点灯(master_brightnessの明るさ) - 5% 赤点灯 (100%点灯、HW制限で調光不可) - それ以下 赤点灯、お知らせLED赤も同期する。ただし、アダプタが刺さったら5%〜の動作に - + スリープ中は - 電池残量 > 10% 青点灯(master_brightnessの明るさ) - 他 動作時と同じ - + スリープには自動で切り替えないので、レジスタ操作が必要です(その方が都合がよいでしょう?) - + 他のパターンは生産検査のため。 ***********************************************/ void tsk_led_pow( ) @@ -159,7 +157,7 @@ void tsk_led_pow( ) /********************************************//** 通常動作時 - + 電池残量で、 青→赤→赤点滅 ***********************************************/ static void led_pow_normal( ) @@ -182,7 +180,7 @@ static void led_pow_normal( ) /********************************************//** スリープ時ホタルパターン - + 電池残量で赤→赤点滅にする ***********************************************/ static void led_pow_sleep( ) diff --git a/branches/2.2D_M0+/loader.c b/branches/2.2D_M0+/loader.c index 5bfb301..926a009 100644 --- a/branches/2.2D_M0+/loader.c +++ b/branches/2.2D_M0+/loader.c @@ -1,14 +1,14 @@ /* ======================================================== MCU CTR BSR - 2009/03/30 - + 2009/03/30 - 開発技術部 藤田 ブートローダー部 ホストの通信と、自己書き換え、ファームのチェックを行う。 - + $Id: loader.c 418 2011-09-22 01:35:37Z n2232 $ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma SFR #pragma di @@ -21,7 +21,10 @@ #endif #include "incs_loader.h" +#ifdef _78K0R #include +#endif + #include "fsl_user.h" #include "i2c_ctr.h" @@ -121,12 +124,12 @@ void main( ) //*/ hdwinit2( ); -#ifndef _WIN32 +#ifdef _78K0R // ファームの整合性チェック // chk_firm_broke(); // 壊れていたら帰ってこない #endif - // 機種判定 + // 機種判定 chk_platform_type(); // HALデバッグリセット @@ -183,7 +186,7 @@ static void chk_firm_broke() ●CTRファミリ DEV_DET(P12.[2:1]) - + ●CTR&その開発機材 @@ -198,7 +201,7 @@ static void chk_firm_broke() void chk_platform_type() { // ●CTRファミリ // - system_status.family = (enum family_)( DEV_DET >> 1 ); /// あぁ... +//iar! system_status.family = (enum family_)( DEV_DET >> 1 ); /// あぁ... #ifdef _DBG_FORCE_SNAKE_ system_status.family = FAMILY_SNAKE; #endif @@ -257,7 +260,7 @@ void chk_platform_type() /********************************************//** 最小限のレジスタ初期化を行います。 - + 組み込みスタートアップルーチンから呼ばれます。 ***********************************************/ void hdwinit( void ) @@ -282,7 +285,7 @@ void hdwinit( void ) /********************************************//** 追加のレジスタ初期化を行います。 - + 出来るだけ hdwinit には書かない方針です。 ***********************************************/ static void hdwinit2( ) diff --git a/branches/2.2D_M0+/magic.c b/branches/2.2D_M0+/magic.c index 5cf42fa..00437e7 100644 --- a/branches/2.2D_M0+/magic.c +++ b/branches/2.2D_M0+/magic.c @@ -1,6 +1,6 @@ /********************************************//** magic.c - + ビルド時刻を埋め込みます。 ビルドの度に更新されるようにする必要があります。(touch) @@ -10,7 +10,7 @@ #include "magic.h" #include "config.h" -#ifndef _WIN32 +#ifdef _78K0R #pragma section @@CNSTL MGC_LOAD AT 0x0FF6 __far const unsigned char MGC_LOADd[] = __TIME__; diff --git a/branches/2.2D_M0+/pedo_alg_thre_det2.c b/branches/2.2D_M0+/pedo_alg_thre_det2.c index 4e69a04..727dd59 100644 --- a/branches/2.2D_M0+/pedo_alg_thre_det2.c +++ b/branches/2.2D_M0+/pedo_alg_thre_det2.c @@ -1,12 +1,12 @@ /* ******************************************************** 歩数計 - + 3軸加速度のリアルタイムデータから、ベクトルのノルムを出し、 閾値を超える時間、間隔、ノルムの大きさで閾値を切り替えるなど - + $Id$ ********************************************************* */ -#ifndef _WIN32 +#ifdef _78K0R #pragma mul #pragma div @@ -16,7 +16,7 @@ #include "incs.h" -#ifndef _WIN32 +#ifdef _78K0R #include #endif @@ -237,10 +237,10 @@ void hosu_increment_if_necessary() cal_temp.year_bcd = YEAR; cal_temp.min_bcd = MIN; cal_temp.sec_bcd = SEC; - + RWAIT = 0; EI(); - + year_compd = bcdtob( cal_temp.year_bcd ); now_longhour = get_long_hour(); @@ -286,7 +286,7 @@ void hosu_increment_if_necessary() { // これしないと1歩足りない pool.vreg_c_ext.pedo_log[ p_record ] = 1; } - else + else { // 通常パス pool.vreg_c_ext.pedo_log[ p_record ] ++; @@ -316,7 +316,7 @@ void hosu_increment_if_necessary() static void fill_hosu_hist_hours( u16 hours ) { // ログあふれ? - if( (u16)p_record + hours >= PEDOMETER_LOG_SIZE ) + if( (u16)p_record + hours >= PEDOMETER_LOG_SIZE ) { pedolog_overflow = true; return; diff --git a/branches/2.2D_M0+/pm.c b/branches/2.2D_M0+/pm.c index d0debf6..a724f5f 100644 --- a/branches/2.2D_M0+/pm.c +++ b/branches/2.2D_M0+/pm.c @@ -3,13 +3,11 @@ 藤田@開技 nintendo '08 Dec - + $Id: pm.c 418 2011-09-22 01:35:37Z n2232 $ ======================================================== */ -#ifndef _WIN32 - -#pragma nop - +#ifdef _78K0R +# pragma nop #endif #include "incs.h" @@ -20,7 +18,10 @@ #include "batt_params.h" -#include +#ifdef _78K0R +# include +#endif + #include "fsl_user.h" #include "vreg_twl.h" @@ -155,7 +156,7 @@ void tsk_batt( ) static void update_chg_led() { static bit temp_led_chg; // static つけないとコンパイル通らず - + temp_led_chg = false; // アダプタつないだ瞬間、満充電でも数秒わざと点灯させる。給電してることをわからせるため。 @@ -167,7 +168,7 @@ static void update_chg_led() // CCIC は充電中と言っているか? if( ! BT_IN_CHG_delayed_n // bt_get_charge_status()で更新されます。 - && ! PM_EXTDC_n ) + && ! PM_EXTDC_n ) { temp_led_chg = true; } @@ -231,7 +232,7 @@ void bt_chk_temparature() /********************************************//** 充電中かのチェック - + 充電ICのバグ対策も行う。 ***********************************************/ #define TIME_DENOIZE (u8)( 1000 / INTERVAL_TSK_BATT ) @@ -255,7 +256,7 @@ void bt_get_charge_status() } else { - if( !BT_CHG_Ena_n + if( !BT_CHG_Ena_n && ( vreg_ctr[ VREG_C_BT_REMAIN ] < 60 ) && !( is_mgic_error ) ) @@ -482,7 +483,7 @@ static void BT_mgic_quick_start() /********************************************//** 電池残量測定初期化 - + 電池パラメータなども転送する ***********************************************/ @@ -670,7 +671,7 @@ void BT_get_left(){ { // エミュレーション機能がおかしい //  それで電源断は不便すぎるだろう - reg_volatile_temp_bt_remain = 99; + reg_volatile_temp_bt_remain = 99; reg_volatile_temp_bt_remain_fine = 0; } } @@ -761,7 +762,7 @@ void BT_get_left(){ hysteresis = 500; } } - + // 充電許可(=アダプタも刺さってる)のに充電してない // かつ、(少なくとも)素の電池残量が60%以上(CCICバグ回避、BT_IN_CHG_delayed_nに織り込み済み) @@ -1113,7 +1114,7 @@ void PM_sys_pow_off( ) /********************************************//** extDC割り込み - + 電源OFFから起こす(充電の温度監視のため)のみ 普段はポーリング(pm) @@ -1126,7 +1127,7 @@ __interrupt void intp4_extdc( ) /********************************************//** フタ開け閉め割り込み - + 普段はポーング(misc) ***********************************************/ __interrupt void intp5_shell( ) @@ -1193,7 +1194,7 @@ task_status_immed tski_ntr_pmic_comm( ) // EI(); - vreg_ctr[ VREG_C_STATUS_1 ] = ( vreg_ctr[ VREG_C_STATUS_1 ] & ~REG_BIT_MASK_STATUS1_NTR_PM_REG ) + vreg_ctr[ VREG_C_STATUS_1 ] = ( vreg_ctr[ VREG_C_STATUS_1 ] & ~REG_BIT_MASK_STATUS1_NTR_PM_REG ) | ( ntr_pm_reg_shadow & REG_BIT_MASK_STATUS1_NTR_PM_REG ); // TWLバックライト情報のミラー irq_work &= ~vreg_ctr[ VREG_C_IRQ_MASK2 ]; @@ -1337,7 +1338,7 @@ void bt_param_select() { bt_type_temp += BT_PARAM_SNAKE_MAXELL; } - p_bt_param = &bt_param[ bt_type_temp ]; +// iar! p_bt_param = &bt_param[ bt_type_temp ]; } diff --git a/branches/2.2D_M0+/pm.h b/branches/2.2D_M0+/pm.h index 6baa5d7..c2ca028 100644 --- a/branches/2.2D_M0+/pm.h +++ b/branches/2.2D_M0+/pm.h @@ -24,10 +24,10 @@ //========================================================= -#ifdef _WIN32 -#define LED_CHARGE mcuRegP[ _P2_4 ] -#else +#ifdef _78K0R #define LED_CHARGE P2.4 +#else +#define LED_CHARGE mcuRegP[ _P2_4 ] #endif diff --git a/branches/2.2D_M0+/reboot.c b/branches/2.2D_M0+/reboot.c index 53912a5..c8cdc53 100644 --- a/branches/2.2D_M0+/reboot.c +++ b/branches/2.2D_M0+/reboot.c @@ -5,10 +5,9 @@ そのモジュール全部最適化が聞かなくなるため追い出した $Id$ **********************************************************/ -#pragma SFR - #include "incs_loader.h" +#ifdef _78K0R void my_reboot(){ #asm @@ -21,3 +20,10 @@ void my_reboot(){ #endasm } + +#endif + +#ifdef _IAR +void my_reboot(){ +} +#endif \ No newline at end of file diff --git a/branches/2.2D_M0+/renge/renge.c b/branches/2.2D_M0+/renge/renge.c index 19bee20..24a46ea 100644 --- a/branches/2.2D_M0+/renge/renge.c +++ b/branches/2.2D_M0+/renge/renge.c @@ -1,4 +1,4 @@ -#ifndef _WIN32 +#ifdef _78K0R #pragma section @@CODE ROM_CODE #pragma nop @@ -9,6 +9,11 @@ #endif +#ifdef _IAR +typedef unsigned char bit; +typedef unsigned char u8; +#endif + #ifdef _WIN32 typedef unsigned char bit; typedef unsigned char u8; @@ -29,9 +34,15 @@ typedef unsigned char u8; #include "..\util_funcs.h" +#ifdef _IAR +#include "../sim/simOnWin.h" +#endif + #ifdef _WIN32 #include "../sim/simOnWin.h" #endif + + //#define _renge_test_ #define true 1 @@ -218,7 +229,7 @@ __callt err renge_task_immed_run(){ rv = tasks_immed[ list_id ](); // タスク実行 if( rv == ERR_SUCCESS ) { - tasks_immed[ list_id ] = TSK_IMM_DELETED_; +// iar! tasks_immed[ list_id ] = TSK_IMM_DELETED_; } // きわどいタイミングで同じタスクの登録があると困るのでDI状態でかえって来る事がある } diff --git a/branches/2.2D_M0+/renge/renge_defs.h b/branches/2.2D_M0+/renge/renge_defs.h index 03c98a6..863214f 100644 --- a/branches/2.2D_M0+/renge/renge_defs.h +++ b/branches/2.2D_M0+/renge/renge_defs.h @@ -12,11 +12,21 @@ 大きく育ってね! ******************************************************************************/ +#ifdef _78K0R + typedef unsigned char u8; typedef signed char s8; typedef unsigned short u16; typedef signed short s16; +#else + +#define __callt + +#endif + + + // ************************************ #define SYS_INTERVAL_TICK 1.953 diff --git a/branches/2.2D_M0+/renge/renge_task_immediate.h b/branches/2.2D_M0+/renge/renge_task_immediate.h index 9ac3bd2..c392577 100644 --- a/branches/2.2D_M0+/renge/renge_task_immediate.h +++ b/branches/2.2D_M0+/renge/renge_task_immediate.h @@ -17,8 +17,8 @@ extern task_status_immed tski_vol_update(); // ************************************* -#define TSK_IMM_EMPTY_ ( void * )( 0x0000 ) -#define TSK_IMM_DELETED_ ( void * )( 0x0001 ) +#define TSK_IMM_EMPTY_ ( task_status_immed )( 0x0000 ) +#define TSK_IMM_DELETED_ ( task_status_immed(*)() )( 0x0001 ) diff --git a/branches/2.2D_M0+/renge/renge_task_intval.h b/branches/2.2D_M0+/renge/renge_task_intval.h index 9b0d9ea..a13e23b 100644 --- a/branches/2.2D_M0+/renge/renge_task_intval.h +++ b/branches/2.2D_M0+/renge/renge_task_intval.h @@ -7,7 +7,7 @@ enum TSK { - TSK_SW, TSK_ADC, TSK_BATT, TSK_LED_POW, TSK_LED_WIFI, TSK_LED_NOTIFY, TSK_LED_CAM, TSK_MISC, TSK_STATUS, TSK_SYS, TSK_LAST + TSK_SW, TSK_ADC, TSK_BATT, TSK_LED_POW, TSK_LED_WIFI, TSK_LED_NOTIFY, TSK_LED_CAM, TSK_MISC, TSK_STATUS, TSK_SYS, TSK_LAST }; extern void tsk_sw(); @@ -21,7 +21,7 @@ extern void tsk_misc(); extern void tsk_status(); extern void tsk_sys(); -const void ( *tasks[ TSK_LAST ] )() = { +/*const*/ void ( *tasks[ TSK_LAST ] )() = { tsk_sw, tsk_adc, tsk_batt, diff --git a/branches/2.2D_M0+/rtc.c b/branches/2.2D_M0+/rtc.c index dd2d1a9..d97ad18 100644 --- a/branches/2.2D_M0+/rtc.c +++ b/branches/2.2D_M0+/rtc.c @@ -2,11 +2,9 @@ RTC $Id$ ======================================================== */ -#ifndef _WIN32 - -#pragma sfr -#pragma inline - +#ifdef _78K0R +# pragma sfr +# pragma inline #endif #include "incs.h" @@ -22,7 +20,7 @@ bit rtc_alarm_dirty; /********************************************//** ペリフェラルの初期化 - + レジスタの電池交換ビットのセット ***********************************************/ void RTC_init( void ) @@ -94,7 +92,7 @@ __interrupt void int_rtc( ) /********************************************//** RTC のリード - + レジスタは、sec,min,hour,week,day,month,year の順 ***********************************************/ void rtc_buf_refresh( ) diff --git a/branches/2.2D_M0+/self_flash.c b/branches/2.2D_M0+/self_flash.c index a662d07..9d53f5d 100644 --- a/branches/2.2D_M0+/self_flash.c +++ b/branches/2.2D_M0+/self_flash.c @@ -1,8 +1,8 @@ /* ======================================================== 自己アップデータ - $Id$ +$Id: qqqqq$ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma SFR #pragma di @@ -74,12 +74,12 @@ const u8 fsl_low_voltage_u08 = 1; #define WTIM WTIM1 #endif -#ifndef _WIN32 -#define LED_POW1 P4.2 -#define LED_PM_POW1 PM4.2 +#ifdef _78K0R +#define LED_POW1 P4.2 +#define LED_PM_POW1 PM4.2 #else #define LED_POW1 mcuRegP[ _P4_2 ] -#define LED_PM_POW1 mcuRegPM[ _P4_2 ] +#define LED_PM_POW1 mcuRegPM[ _P4_2 ] #endif // ======================================================== diff --git a/branches/2.2D_M0+/sw.c b/branches/2.2D_M0+/sw.c index d0cd54f..d454f53 100644 --- a/branches/2.2D_M0+/sw.c +++ b/branches/2.2D_M0+/sw.c @@ -7,7 +7,7 @@ $Id$ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma SFR #pragma NOP @@ -91,7 +91,7 @@ static u16 sw_pwsw_mukan_time; else \ { \ count = 0; \ - } + } @@ -133,7 +133,7 @@ void tsk_sw( ) // 実機の場合 if( ! system_status.taikendai ) { - + // 電源スイッチの監視 // if( SW_pow_count == ( TIME_PWSW_CLICK ) ) // クリック時間に到達 { @@ -160,7 +160,7 @@ void tsk_sw( ) force_off = true; } } - + }else{ // スタンドアロン試遊台 // 電源スイッチの監視 // @@ -177,7 +177,7 @@ void tsk_sw( ) { force_off = true; } - + if( sw_pwsw_mukan_time != 0 ) { sw_pwsw_mukan_time--; @@ -189,7 +189,7 @@ void tsk_sw( ) // HOME sw // chk_clicked( SW_HOME_n, SW_home_count, REG_BIT_SW_HOME_CLICK ); chk_clicked( !SW_HOME_n, SW_home_count_rel, REG_BIT_SW_HOME_RELEASE ); - + // wifi sw // /// 最悪な実装なのはわかっているが、市場に出てしまった不良スイッチを救うため if( sw_wifi_mukan_time != 0 ) diff --git a/branches/2.2D_M0+/task_debug.c b/branches/2.2D_M0+/task_debug.c index e5b502c..9419cf0 100644 --- a/branches/2.2D_M0+/task_debug.c +++ b/branches/2.2D_M0+/task_debug.c @@ -2,7 +2,7 @@ デバッグタスク $Id$ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma SFR #pragma NOP @@ -61,7 +61,7 @@ void tsk_debug( ) /* { u8 str[4]; - + if( ( system_status.pwr_state == ON ) || ( system_status.pwr_state == SLEEP ) ) { str[3] = vreg_ctr[ VREG_C_FREE0 ]; diff --git a/branches/2.2D_M0+/task_misc.c b/branches/2.2D_M0+/task_misc.c index f13e0da..092dd4a 100644 --- a/branches/2.2D_M0+/task_misc.c +++ b/branches/2.2D_M0+/task_misc.c @@ -5,7 +5,7 @@ $Id: task_misc.c 418 2011-09-22 01:35:37Z n2232 $ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma SFR #pragma NOP @@ -67,7 +67,7 @@ bit going_to_sleep; // SoC // 自動テスト用 -bit reserve_pedo_increnent; +bit reserve_pedo_increnent; // ======================================================== @@ -235,7 +235,7 @@ void update_LED_3D() COMMANDレジスタへの書き込み 0なら呼ばれません。ケア不要 - + - sleep 通知(受) - リセット系コマンド ***********************************************/ @@ -370,7 +370,7 @@ static const u8 *infos_table[ KOUMOKU ] = { u8 extinfo_read(void) { u8 ret = 0xFF; - + /* * tempは計算処理が必要なデータ。メモリに余裕がないので計算が必要な * 変数は、要/不要に関わらず計算するポリシー @@ -380,12 +380,12 @@ u8 extinfo_read(void) { infos_temp[0] = system_status.captureBox? MODEL_CAPTURE_BOX : ( system_status.is_dev? MODEL_ISBAKO: (u8)system_status.model ); - infos_temp[1] = (u8)( _dbg_rcomp & 0xFF ); - infos_temp[2] = ( !temp_zone_charge_disable | ( bt_authorized << 1 ) ); + infos_temp[1] = (u8)( _dbg_rcomp & 0xFF ); + infos_temp[2] = ( !temp_zone_charge_disable | ( bt_authorized << 1 ) ); infos_temp[3] = 1; /* 仕様変更により1固定になった */ infos_temp[4] = 0 // | ( PM_EXTDC_n ? REG_BIT_HAL0_PM_EXTDC_n : 0 ) // status0にある - | ( BT_IN_CHG_n ? REG_BIT_HAL0_BT_IN_CHG_n : 0 ) + | ( BT_IN_CHG_n ? REG_BIT_HAL0_BT_IN_CHG_n : 0 ) | ( BT_CHG_Ena_n ? REG_BIT_HAL0_RSV_5 : 0 ) // 空きビット使用,out pin | 0 // WL_TX 使えない // | ( SHELL_OPEN ? REG_BIT_HAL0_SHELL_OPEN : 0 ) // status0にある diff --git a/branches/2.2D_M0+/task_status.c b/branches/2.2D_M0+/task_status.c index 361497b..faa2124 100644 --- a/branches/2.2D_M0+/task_status.c +++ b/branches/2.2D_M0+/task_status.c @@ -4,7 +4,7 @@ $Id$ ********************************************************* */ -#ifndef _WIN32 +#ifdef _78K0R #pragma SFR #pragma NOP diff --git a/branches/2.2D_M0+/task_sys.c b/branches/2.2D_M0+/task_sys.c index 5267452..81021d3 100644 --- a/branches/2.2D_M0+/task_sys.c +++ b/branches/2.2D_M0+/task_sys.c @@ -1,10 +1,10 @@ /* ======================================================== task_sys 電源周りを司るのタスク - + $Id$ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma SFR #pragma NOP @@ -293,7 +293,7 @@ void tsk_sys( ) send_getup_to_soc(); system_status.pwr_state = ON; } - + force_off_check(); // leak_check(); @@ -338,7 +338,7 @@ void tsk_sys( ) LED_stop( ); IIC_ctr_Stop( ); IIC_twl_Stop( ); - RTC_32k_off(); +//iar! RTC_32k_off(); // 電源オン条件の割り込みセット // PWSW KR3 押すとL @@ -405,14 +405,14 @@ void tsk_sys( ) system_status.poweron_reason = NONE; pwsw_timeout = 0; - if( !PM_EXTDC_n + if( !PM_EXTDC_n || chg_led_override != 0 ) // これがゼロになるまで待つ { // アダプタ有り /////////////////////////////// または、アダプタさして3秒は充電LEDを点けている期間 // 電源ボタン押しチェックへ system_status.poweron_reason = RSN_PWSW; - system_status.pwr_state = ON_CHECK; + system_status.pwr_state = ON_CHECK; #ifndef _TAIKENDAI_SEISAN_SPECIAL_ // 試遊台なら自動で電源再投入 @@ -487,7 +487,7 @@ void tsk_sys( ) } RTCIMK = 0; // sys tick タイマー有効 - + #ifndef _TAIKENDAI_SEISAN_SPECIAL_ if( system_status.taikendai ) { @@ -616,7 +616,7 @@ void send_getup_to_soc() /********************************************//** 自己アップデート firm_update() を呼ぶ(isr中から実行できないので) - + task_status_immed型 を返すようにすればいいのですが... ***********************************************/ task_status_immed tski_firm_update(){ diff --git a/branches/2.2D_M0+/user_define.h b/branches/2.2D_M0+/user_define.h index 68072de..8e00504 100644 --- a/branches/2.2D_M0+/user_define.h +++ b/branches/2.2D_M0+/user_define.h @@ -10,7 +10,7 @@ #define bits8(a,b,c,d,e,f,g,h) ( a<<7 | b<<6 | c<<5 | d<<4 | e<<3 | f<<2 | g<<1 | h ) -#ifndef _WIN32 +#ifdef _78K0R // 実機環境 #ifdef _debug_led_ @@ -173,7 +173,7 @@ #define PM_ACCEL_INT1 PM2.5 -#endif // _WIN32 +#endif // _WIN32 // win32 sim環境と共通 diff --git a/branches/2.2D_M0+/util_funcs.c b/branches/2.2D_M0+/util_funcs.c index 2edea63..b70f81e 100644 --- a/branches/2.2D_M0+/util_funcs.c +++ b/branches/2.2D_M0+/util_funcs.c @@ -1,11 +1,11 @@ /* ======================================================== util_funcs - + 雑多なユーティリティ関数 - $Id$ +$Id: asdf$ ======================================================== */ -#ifndef _WIN32 +#ifdef _78K0R #pragma SFR #pragma di @@ -51,7 +51,7 @@ extern unsigned char get_ei(); #ifdef _DI_WITH_CHECK_ /********************************************//** すでに 割り込み禁止状態下チェックしてから割り込み禁止にする - + 評価の結果、現状、#ifdef でチェックせずに DI する ***********************************************/ void DI_wt_chk() diff --git a/branches/2.2D_M0+/vreg_ctr.c b/branches/2.2D_M0+/vreg_ctr.c index bb889eb..ded1145 100644 --- a/branches/2.2D_M0+/vreg_ctr.c +++ b/branches/2.2D_M0+/vreg_ctr.c @@ -73,7 +73,7 @@ void vreg_ctr_init( ) /********************************************//** 初期値セット - + システムリセット時に呼ばれます ***********************************************/ void vreg_ctr_reset( ) @@ -96,8 +96,8 @@ void vreg_ctr_reset( ) vreg_ctr[ VREG_C_WIFI_CALIB ] = 0; // ここでやるのは気持ち悪いが… - RTC_32k_on(); - RESET1_neg; +//iar! RTC_32k_on(); +//iar! RESET1_neg; RESET2_neg; FCRAM_RST_neg; } @@ -325,14 +325,14 @@ void vreg_ctr_write( u8 adrs, u8 data ) case VREG_C_WIFI_CALIB: if( data & REG_BIT_WIFI_CALIB_32K_HI_Z ) { - RTC_32k_HI_Z(); +//iar! RTC_32k_HI_Z(); } else{ - RTC_32k_on(); +//iar! RTC_32k_on(); } if( data & REG_BIT_WIFI_CALIB_RSTS_AST ) { - RESET1_ast; +//iar! RESET1_ast; // RESET2_ast; RESET1のみ。 // FCRAM_RST_ast; } @@ -595,7 +595,7 @@ void set_irq( u8 irqreg, u8 irq_flg ) { /*0 すでにDI状態ならケアが必要かもしれない ei_orig = get_ei(); - + //. debug if( !ei_orig ) {