0.15 for E3

TSボードに書き込むと動作はしますが実機との差分で以下の不具合があります。
 (ベースが10.10であり、E3実機専用版と言うことで)
 ・加速度センサが使用できません
 ・音量Volが上下反転しています


git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@162 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
N2232 2010-05-18 00:37:45 +00:00
parent 53eb31b448
commit 898a08202c
47 changed files with 2515 additions and 2990 deletions

View File

@ -3,3 +3,12 @@
#include "incs_loader.h"
//=========================================================
// ウォッチドッグタイマのリスタート
// 0xACはマジック
void WDT_Restart( void )
{
WDTE = WDT_RESTART_MAGIC;
}

View File

@ -9,12 +9,10 @@
//=========================================================
// ウォッチドッグタイマのリスタート
// void WDT_Restart( void );
#define WDT_Restart() WDTE = WDT_RESTART_MAGIC
void WDT_Restart( void );
// 規定値以外を書くと例外でリセットがかかる
#define mcu_reset WDTE = 0xFF
#define mcu_reset WDTE = 0x5A
#endif

View File

@ -14,16 +14,7 @@
#pragma MUL
#pragma BCD
#include "config.h"
#ifdef _MCU_BSR_
#pragma interrupt INTP23 intp23_ACC_ready RB3 // 加速度センサ、データ準備完了
#endif
#include "incs.h"
#include <math.h>
// ========================================================
@ -74,19 +65,26 @@ task_status tsk_soft_int( );
task_status_immed tsk_cbk_accero( )
{ // 疑似isrから登録されます
// 加速度センサデータレジスタへの反映
if( iic_mcu_read( IIC_SLA_ACCEL, ( ACC_REG_X | 0x80 ), 6, &vreg_ctr[VREG_C_ACC_XL] )
!= ERR_SUCCESS )
/*
if(( system_status.pwr_state == OFF ) || ( system_status.pwr_state == BT_CHARGE ) )
{
// 加速度センサが異常になったので止める
vreg_ctr[ VREG_C_ACC_CONFIG ] &= ~( VREG_BITMASK_ACC_CONF_HOSU | VREG_BITMASK_ACC_CONF_ACQ );
acc_hosu_set();
vreg_ctr[ VREG_C_STATUS_1 ] |= REG_BIT_ACCERO_ERR;
return ( ERR_SUCCESS ); // タスクの削除は必要
return ( ERR_SUCCESS );
}
else
{
*/
// 加速度センサデータレジスタへの反映
if( iic_mcu_read( IIC_SLA_ACCEL, ( ACC_REG_X | 0x80 ), 6, &vreg_ctr[VREG_C_ACC_XL] )
!= ERR_SUCCESS )
{
// 加速度センサが異常になったので止める
vreg_ctr[VREG_C_ACC_CONFIG] &= ~( VREG_BITMASK_ACC_CONF_HOSU | VREG_BITMASK_ACC_CONF_ACQ );
// vreg_ctr[ VREG_C_STATUS_1 ] |= REG_BIT_ACCERO_ERR;
acc_hosu_set();
return ( ERR_SUCCESS ); // タスクの削除は必要
}
else
{
// 正常時パス //
// 加速度更新&割り込み
if( (( vreg_ctr[VREG_C_ACC_CONFIG] & VREG_BITMASK_ACC_CONF_ACQ ) != 0 ) &&
@ -106,9 +104,9 @@ task_status_immed tsk_cbk_accero( )
( ( vreg_ctr[VREG_C_ACC_CONFIG] & VREG_BITMASK_ACC_CONF_HOSU ) != 0 )
)
{
DBG_LED_on;
pedometer(); // 歩数計
DBG_LED_off;
DBG_LED_WIFI_2_on;
pedometer(); // 歩数計
DBG_LED_WIFI_2_off;
}
}
return ( ERR_SUCCESS );
@ -152,7 +150,9 @@ task_status_immed acc_write( )
/*=========================================================
 
 
todo
========================================================*/
task_status_immed acc_hosu_set( )
{
@ -173,32 +173,13 @@ task_status_immed acc_hosu_set( )
str_send_buf[1] = 0x00; // ctrl2 HPF:normal, filterd, HPF for IRQ : dis/dis, HPF coeff:norm
#ifdef _MODEL_WM0_
# ifdef _MODEL_WM0_TEG2_CTRC_
str_send_buf[2] = 0x02; // 回路が一部違う
# else
str_send_buf[2] = 0x10; // 3 IRQ pol :Active HI, Drive:Pushpull,
/// IRQ2flg latch: auto clear after read, IRQ2 conf: IRQ( fall,shock,...)
/// 1 : auto clear after read, conf: data ready
# endif
#else
# ifdef _MODEL_CTR_
/*
if( system_status.model == MODEL_TS_BOARD )
{
// TS Final SoC
str_send_buf[2] = 0x02; // 3 IRQ pol :Active HI, Drive:Pushpull,
}
else
{
// 実機&派生種、白箱
str_send_buf[2] = 0x10; // 3 IRQ pol :Active HI, Drive:Pushpull,
}
*/
str_send_buf[2] = 0x12; // 面倒なので両方...。
# ifdef _MODEL_CTR_JIKKI_
str_send_buf[2] = 0x10;
# else
// TS( type T )
str_send_buf[2] = 0x02; // 3 IRQ pol :Active HI, Drive:Pushpull,
/// IRQ2flg latch: auto clear after read, IRQ2 conf: IRQ( fall,shock,...)
/// 1 : auto clear after read, conf: data ready
@ -255,11 +236,11 @@ __interrupt void intp23_ACC_ready( )
{
if( ( system_status.pwr_state == ON ) || ( system_status.pwr_state == SLEEP ) )
{
if( ACC_VALID == 1 )
if( ACC_VALID )
{
// todo
// renge_task_immed_add( tsk_cbk_accero );
renge_task_immed_add( tsk_cbk_accero );
}
}
}
}

View File

@ -9,28 +9,12 @@
#include "led.h"
//#define _4db_
#define _15db_
// ===================================================== //
bit adc_updated;
u8 adc_raw_vol;
u8 adc_raw_dep;
// ===================================================== //
extern void nop8();
// ===================================================== //
#define INTERVAL_TSK_ADC 15
#define INTERVAL_TSK_ADC 3
/* ========================================================
ADC設定と
@ -40,42 +24,38 @@ extern void nop8();
VOL
PM_BT_DET,_P BT_init
PM_BT_DET,_P PM_init
8tics毎に呼ばれADCを停止します
 
======================================================== */
#ifdef _15db_
// max -15db
const u8 slider_to_codec[64] =
{
127, 127, 127, 126, 125, 124, 123, 122,
121, 120, 119, 118, 117, 116, 115, 114,
113, 112, 111, 110, 109, 108, 107, 106,
105, 104, 103, 102, 101, 100, 99, 98,
97, 96, 95, 94, 93, 92, 91, 90,
89, 88, 87, 86, 85, 84, 83, 82,
81, 80, 79, 78, 77, 76, 75, 74,
73, 72, 71, 70, 69, 68, 67, 66
};
#endif
#ifdef _4db_
/*
// max -4db
const u8 slider_to_codec[64] =
static const u8 slider_to_codec[64] =
{
127, 127, 126, 125, 123, 122, 121, 119,
118, 117, 115, 114, 112, 111, 110, 108,
107, 106, 104, 103, 101, 100, 99, 97,
96, 94, 93, 92, 90, 89, 88, 86,
85, 83, 82, 81, 79, 78, 77, 75,
74, 72, 71, 70, 68, 67, 66, 64,
64, 63, 61, 60, 59, 57, 56, 54,
53, 52, 50, 49, 48, 46, 44, 44
127, 125, 124, 123, 121, 120, 119, 117,
116, 115, 113, 112, 111, 109, 108, 107,
105, 104, 103, 101, 100, 99, 98, 96,
95, 94, 92, 91, 90, 88, 87, 86,
84, 83, 82, 80, 79, 78, 76, 75,
74, 72, 71, 70, 69, 67, 66, 65,
63, 62, 61, 59, 58, 57, 55, 54,
53, 51, 50, 49, 47, 46, 45, 44
};
#endif
*/
// max -10db
static const u8 slider_to_codec[64] =
{
127, 126, 125, 124, 123, 122, 121, 120,
119, 118, 117, 116, 115, 114, 113, 112,
111, 110, 109, 109, 108, 107, 106, 105,
104, 103, 102, 101, 100, 99, 98, 97,
96, 95, 94, 93, 92, 91, 90, 89,
88, 87, 86, 85, 84, 83, 82, 81,
81, 80, 79, 78, 77, 76, 75, 74,
73, 72, 71, 70, 69, 68, 67, 66
};
void tsk_adc( )
{
@ -149,49 +129,71 @@ void tsk_adc( )
}
}
}
vreg_ctr[ VREG_C_DBG1 ] = vreg_ctr[ VREG_C_TUNE ];
vreg_ctr[ VREG_C_DBG2 ] = adc_raw_dep; // dbg
// Volume /////////////////////////////////////
{
// 似非ヒステリシスを付けて64段
u8 temp;
static u8 vol_old;
static u8 force_update_vol;
if( ( abs( adc_raw_vol - vol_old ) >= 2 ) // 生値でこれくらいずれたら更新(似非ヒステリシス)
|| ( --force_update_vol == 0 ) ) // ポーリング
if( abs( adc_raw_vol - vol_old ) >= 2 ) // 生値でこれくらいずれたら更新
{
vol_old = adc_raw_vol;
// レジスタ更新
vreg_twl[ REG_TWL_INT_ADRS_VOL ] = vol_old / ( 256 / 32 ); // ←adc値でよい
vreg_ctr[ VREG_C_SND_VOL ] = ( vol_old / 4 ); // 64段
// if( vreg_ctr[ VREG_C_SND_VOL ] != ( adc_raw_vol / 4 ) )
{
vol_old = adc_raw_vol;
// レジスタ更新
vreg_ctr[ VREG_C_SND_VOL ] = ( adc_raw_vol / 4 );
vreg_twl[ REG_TWL_INT_ADRS_VOL ] = adc_raw_vol / ( 256 / 32 ); // ←adc値でよい
// codecに伝える
iic_mcu_write_a_byte( IIC_SLA_CODEC, CODEC_REG_VOL, slider_to_codec[ vol_old / 4 ] );
// codecに伝える
iic_mcu_write_a_byte( IIC_SLA_CODEC, CODEC_REG_VOL, slider_to_codec[ adc_raw_vol / 4 ] );
#ifndef _MODEL_CTR_
iic_mcu_write_a_byte( IIC_SLA_DCP, 0, slider_to_codec[ ( 255 - vol_old ) / 4 ] );
iic_mcu_write_a_byte( IIC_SLA_DCP, 0, slider_to_codec[ ( 255 - adc_raw_vol ) / 4 ] ); // todo
#endif
// set_irq( VREG_C_IRQ0, REG_BIT_VR_SNDVOL_CHANGE ); // 割り込み廃止
force_update_vol = 10;
// set_irq( VREG_C_IRQ0, REG_BIT_VR_SNDVOL_CHANGE ); // 割り込み廃止
force_update_vol = 100;
}
}
{
// ポーリング
if( --force_update_vol == 0 )
{
vol_old = adc_raw_vol;
// レジスタ更新
// vreg_ctr[ VREG_C_SND_VOL ] = temp;
// vreg_twl[ REG_TWL_INT_ADRS_VOL ] = adc_raw_vol / ( 256 / 32 ); // ←adc値でよい
// codecに伝える
iic_mcu_write_a_byte( IIC_SLA_CODEC, CODEC_REG_VOL, slider_to_codec[ adc_raw_vol / 4 ] );
force_update_vol = 100;
}
}
}
// TUNE_LED ///////////////////////////////////
// ここで?仕様?
// memo E3仕様
{
switch ( vreg_ctr[VREG_C_LED_TUNE] )
{
case LED_TUNE_ILM_ON:
LED_duty_3d = vreg_ctr[VREG_C_LED_BRIGHT];
break;
case LED_TUNE_ILM_SVR:
LED_duty_3d = vreg_ctr[VREG_C_TUNE] / 16;
break;
case LED_TUNE_ILM_OFF:
default:
LED_duty_3d = 0;
break;
}
// switch ( vreg_ctr[VREG_C_LED_TUNE] )
// {
// case LED_TUNE_ILM_ON:
LED_duty_TUNE = vreg_ctr[VREG_C_LED_BRIGHT] / 32;
// break;
//
// case LED_TUNE_ILM_SVR:
// LED_duty_TUNE = vreg_ctr[VREG_C_TUNE] / 16;
// break;
//
// case LED_TUNE_ILM_OFF:
// default:
// LED_duty_TUNE = 0;
// break;
// }
}
adc_updated = 0;
}
@ -199,11 +201,18 @@ void tsk_adc( )
ADCEN = 1;
ADM = 0b00001011; // セレクトモード、昇圧、fCLK/6 ///ここから ↓
ADM = 0b00011011; // セレクトモード、章圧、fCLK/6 ///ここから ↓
ADPC = 0x06; // ADCポートのセレクト
ADS = ADC_SEL_TUNE;
nop8();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
ADCS = 1; // AD開始。 /// ここまで  までに1us=8clk以上開ける
ADIF = 0;
@ -246,7 +255,6 @@ static u8 getmean3( u8 * hist )
/* ========================================================
 
  
// todo 値が飛ぶことがある?
======================================================== */
__interrupt void int_adc( )
{
@ -255,11 +263,11 @@ __interrupt void int_adc( )
static u8 hist_bt_temp[3];
static u8 index;
// EI( );
EI( );
switch ( ADS )
{
/*
case ( ADC_SEL_AMB_BRIT ): // 環境明るさ
case ( ADC_SEL_AMB_BRIT ):
vreg_ctr[ VREG_C_AMBIENT_BRIGHTNESS ] = ADCRH;
break;
*/
@ -275,33 +283,24 @@ case ( ADC_SEL_AMB_BRIT ): //
case ( ADC_SEL_VOL ):
hist_snd_vol[index] = ADCRH;
#ifdef _MODEL_CTR_
if( system_status.model == MODEL_TS_BOARD )
{
adc_raw_vol = getmean3( hist_snd_vol );
}
else
{
adc_raw_vol = ( 255 - getmean3( hist_snd_vol ));
}
#ifdef _MODEL_CTR_JIKKI_
adc_raw_vol = ( 255 - getmean3( hist_snd_vol ));
#else
adc_raw_vol = getmean3( hist_snd_vol );
#endif
if( adc_raw_vol == 0 )
{
NOP();
}
// TWL用レジスタ(32段)の更新。アトミックな処理として扱わないと不都合が。
/// 割り込みはHorizonを通してコマンドを発行されるのを待てばよい
break;
case ( ADC_SEL_BATT_TEMP ):
hist_bt_temp[index] = ADCRH;
raw_adc_temperature = getmean3( hist_bt_temp );
renge_task_immed_add( BT_temp_update );
renge_task_immed_add( PM_bt_temp_update );
break;
case ( ADC_SEL_BATT_DET ):
// 呼ばれない
// vreg_ctr[ VREG_C_DBG_BATT_DET ] = ADCRH;
// todo
break;
}
@ -311,11 +310,13 @@ case ( ADC_SEL_AMB_BRIT ): //
if( ADS != ADC_SEL_BATT_TEMP )
{ // 電池判別は電源投入の一回のみ
ADS += 1; // 次のチャンネル
BT_TEMP_P = 1; // 電池温度監視スタート
ADIF = 0;
}
else
{
ADCEN = 0; // 止めてしまう
BT_TEMP_P = 0; // 電池温度監視スタート
adc_updated = 1;
index = ( index == 2 ) ? 0 : ( index + 1 );
}
@ -334,19 +335,25 @@ u8 get_adc( u8 ch )
ADIF = 0;
ADCEN = 1;
ADM = 0b00001011; // セレクトモード、昇圧、fCLK/6 ///ここから↓
ADCS = 0;
ADM = 0b00100011; // セレクトモード、昇圧、fCLK/6 ///ここから↓
ADPC = 0x06; // ADCポートのセレクト
ADS = ch;
nop8();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
ADCS = 1; // AD開始。 /// ここまで↑ に、1us以上開ける
ADMK = 0;
while( ADIF == 0 ){;}
temp = ADCRH;
ADCEN = 0;
ADMK = 0;
return ( temp );
}

View File

@ -1,76 +1,80 @@
#ifndef _bt_params_h_
#define _bt_params_h_
/* ========================================================
======================================================== */
const u8 BT_PARAM[][64] = {
// ID = 0 GND マクセル
{
0xAD, 0x30, 0xAE, 0x70, 0xB0, 0x00, 0xB3, 0x00,
0xB4, 0x70, 0xB5, 0xA0, 0xB7, 0x80, 0xBA, 0x00,
0xBB, 0x90, 0xBD, 0x00, 0xBE, 0x00, 0xBF, 0xF0,
0xC3, 0x00, 0xC5, 0xC0, 0xC8, 0x00, 0xCA, 0xC0,
0x04, 0x00, 0x12, 0x00, 0x0C, 0x10, 0x24, 0x00,
0x10, 0xD0, 0x1B, 0xF0, 0x0A, 0xF0, 0x08, 0xE0,
0x0C, 0xF0, 0x08, 0xC0, 0x08, 0xB0, 0x07, 0xF0,
0x0B, 0x00, 0x05, 0xD0, 0x02, 0x00, 0x09, 0x00
},
enum BATT_VENDER {
BT_PANASONIC, // open
BT_UNKNOWN1,
BT_UNKNOWN2,
BT_UNKNOWN3,
BT_UNKNOWN4,
BT_UNKNOWN5,
BT_UNKNOWN6, // gnd
BT_MAXELL
};
static const u8 BT_PARAM[][64] = {
// ID = 0 GND 白箱
/// パラメータ無し
{ // ID = 1 120 ohm
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
},
{ // ID = 2 360 hom
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
},
{ // ID = 3 750 ohm
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
},
{ // ID = 4 1.3kohm
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
},
{ // ID = 5 2.7kohm パナ
0xAD, 0x30, 0xAE, 0x70, 0xB0, 0x00, 0xB3, 0x00,
0xB4, 0x70, 0xB5, 0xA0, 0xB7, 0x80, 0xBA, 0x00,
0xAD, 0x30, 0xAE, 0x70, 0xB0, 0x00, 0xB3, 0x00,
0xB4, 0x70, 0xB5, 0xA0, 0xB7, 0x80, 0xBA, 0x00,
0xBB, 0x90, 0xBD, 0x00, 0xBE, 0x00, 0xBF, 0xF0,
0xC3, 0x00, 0xC5, 0xC0, 0xC8, 0x00, 0xCA, 0xC0,
0xBB, 0x90, 0xBD, 0x00, 0xBE, 0x00, 0xBF, 0xF0,
0xC3, 0x00, 0xC5, 0xC0, 0xC8, 0x00, 0xCA, 0xC0,
0x04, 0x00, 0x12, 0x00, 0x0C, 0x10, 0x24, 0x00,
0x10, 0xD0, 0x1B, 0xF0, 0x0A, 0xF0, 0x08, 0xE0,
0x04, 0x00, 0x12, 0x00, 0x0C, 0x10, 0x24, 0x00,
0x10, 0xD0, 0x1B, 0xF0, 0x0A, 0xF0, 0x08, 0xE0,
0x0C, 0xF0, 0x08, 0xC0, 0x08, 0xB0, 0x07, 0xF0,
0x0B, 0x00, 0x05, 0xD0, 0x02, 0x00, 0x09, 0x00
},
0x0C, 0xF0, 0x08, 0xC0, 0x08, 0xB0, 0x07, 0xF0,
0x0B, 0x00, 0x05, 0xD0, 0x02, 0x00, 0x09, 0x00
},
{ // ID = 6 8.2kohm
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
},
{ // ID = 7 マクセル
0xAD, 0x30, 0xAE, 0x70, 0xB0, 0x00, 0xB3, 0x00,
0xB4, 0x70, 0xB5, 0xA0, 0xB7, 0x80, 0xBA, 0x00,
0xBB, 0x90, 0xBD, 0x00, 0xBE, 0x00, 0xBF, 0xF0,
0xC3, 0x00, 0xC5, 0xC0, 0xC8, 0x00, 0xCA, 0xC0,
0x04, 0x00, 0x12, 0x00, 0x0C, 0x10, 0x24, 0x00,
0x10, 0xD0, 0x1B, 0xF0, 0x0A, 0xF0, 0x08, 0xE0,
0x0C, 0xF0, 0x08, 0xC0, 0x08, 0xB0, 0x07, 0xF0,
0x0B, 0x00, 0x05, 0xD0, 0x02, 0x00, 0x09, 0x00
}
// ID = 7 白箱
/// パラメータ無し
};
const unsigned char BT_PANA_RCOMP = 135;
// static const float BT_PANA_TEMPCOUP = 0.3;
// static const float BT_PANA_TEMPCODN = 0.5;
// 256倍してある
const unsigned char BT_PANA_TEMPCOUP = 77;
const unsigned char BT_PANA_TEMPCODN = 128;
static const unsigned char BT_PANA_RCOMP = 135;
static const float BT_PANA_TEMPCOUP = 0.3;
static const float BT_PANA_TEMPCODN = 0.5;
#endif

View File

@ -9,26 +9,30 @@ MEMORY ROM : (02000H, 03000H )
;;; セグメントの割当先設定
; ブートブロック0に割り当てる
MERGE LDR_CODE : =BCL0
MERGE LDR_CODL : =BCL0
MERGE @@LCODE : =BCL0 ; スタートアップルーチン
MERGE FSL_CODE : =BCL0 ; =FSL ; 謹製フラッシュライブラリ
;MERGE @@LCODEL : =BCL0
MERGE LDR_CODE: =BCL0
MERGE LDR_CODL: =BCL0
;MERGE @@LCODE : AT( 0E00H ) =BCL0 ; スタートアップルーチン
MERGE @@LCODE : =BCL0 ; スタートアップルーチン
;MERGE LDR_RINT:=BCL0
;MERGE LDR_CNST:=BCL0
MERGE LDR_CNSL:=BCL0
; 通常領域に置く
; 通常領域にあてる物達
MERGE ROM_CODE:=ROM
;MERGE ROM_CNST:=ROM
; ちょっと、困るんですが、こうしないと初期値がセットされない
MERGE @@CNST: =ROM
MERGE @@R_INIT: =ROM ; ROM以外に置きたいならスタートアップルーチンを要修正
MERGE @@R_INIT: =ROM
; 謹製フラッシュライブラリ
; MERGE FSL_CODE:=FSL
MERGE FSL_CODE:=BCL0
; マジックナンバー

View File

@ -19,7 +19,6 @@ enum poweron_reason_
NONE = 0,
PWSW,
RTC_ALARM,
EXT_POWER
};
@ -28,12 +27,13 @@ enum model_
MODEL_JIKKI = 0,
MODEL_TS_BOARD,
MODEL_SHIROBAKO,
MODEL_JIKKI_NOBATT,
MODEL_RESERVED1,
MODEL_RESERVED2,
MODEL_RESERVED3,
};
// タスクシステムの状態情報など
typedef struct
{
@ -43,12 +43,12 @@ typedef struct
unsigned char dipsw1:1;
unsigned char dipsw2:1;
unsigned char reboot:1;
unsigned char info_fullcolor:1;
enum model_ model;
enum model_ model;
}
system_status_;
extern system_status_ system_status;

View File

@ -1,35 +1,49 @@
#ifndef __config__
#define __config__
//#define _debug_
#define _debug_
//#define _debug_led_
#define MCU_VER_MAJOR 0x00
#define MCU_VER_MINOR 0x14
#define MCU_VER_MINOR 0x15
#define _OVERCLOCK_
//#define PM_CCIC_TIM
// 古い(C)電源ボード
//#define _PM_BUG_
//#define _PARRADIUM_
//#define _MODEL_TEG2_
// <20>ªTEG2 CPU <20>{ Type-T
//#define _MODEL_WM0_
//#define _MODEL_WM0_TEG2_CTRC_
//#define _MODEL_TS0_
// <20>ªTEG2 CPU <20>{ Type-C
//#define _MODEL_CTR_
// <20>ªTS board, WM1,1 TS-CTRC
#define _MODEL_CTR_NOTIFY_FULLCOLOR_
// <20>ªTS board, WM1,1 TS-CTRC
//#define _MODEL_CTR_TS_
// ↑FINAL SoC Type-C
#define _MODEL_CTR_JIKKI_
// “ÁŽêŽd—l //
//#define _SW_HOME_ENABLE_
#define _FOR_E3_
// ---------------------------------- //
#ifdef _MODEL_CTR_TS_
#ifdef _MODEL_CTR_JIKKI_
#endif
#endif
#ifdef _MODEL_CTR_TS_
#define _MODEL_CTR_
#endif
#ifdef _MODEL_CTR_JIKKI_
#define _MODEL_CTR_
#endif
// ---------------------------------- //
#ifdef _MODEL_TEG2_
@ -56,11 +70,4 @@
#define _SW_HOME_ENABLE_
#endif
#ifdef _MODEL_CTR_NOTIFY_FULLCOLOR_
#define _MODEL_CTR_
#define _PMIC_CTR_
#define _MCU_BSR_
#define _SW_HOME_ENABLE_
#endif
#endif

View File

@ -3,18 +3,8 @@
.nintendo
'09 Apr
======================================================== */
#include "config.h"
#ifdef _MCU_KE3_
#pragma interrupt INTIICA int_iic_ctr // CTR側
#else
// TSはマザボでテレコ、WMは回路図がテレコで結局一致…
#pragma interrupt INTIICA1 int_iic_ctr RB1
#endif
#include "incs.h"
#include "accero.h"
#ifdef _MCU_BSR_
// #ifdef _MODEL_TS0_ || _MODEL_WM0_
@ -78,7 +68,6 @@ __interrupt void int_iic_ctr( )
static u8 reg_adrs_internal;
static u8 tx_buf;
u8 rx_buf;
static u8 adrs_access_from;
EI();
@ -146,7 +135,6 @@ __interrupt void int_iic_ctr( )
case ( IIC_RCV_REG_ADRS ): // 2バイト目(レジスタアドレス)受信後に来る
// レジスタアドレス受信
reg_adrs = IICA;
adrs_access_from = reg_adrs;
tx_buf = vreg_ctr_read( reg_adrs ); // データの準備をしておく
if( reg_adrs != VREG_C_INFO )
{
@ -191,24 +179,15 @@ __interrupt void int_iic_ctr( )
vreg_ctr_after_read( reg_adrs ); // 読んだらクリアなどの処理
}
else
{ // 受信
{ // 受信
rx_buf = IICA;
vreg_ctr_write( reg_adrs, rx_buf );
WREL = 1;
}
// レジスタアドレスのインクリメント
/// アクセスポインタを進めない特殊なレジスタ
switch( adrs_access_from )
{
case( VREG_C_ACC_HOSU_HIST ):
case( VREG_C_INFO ):
case( VREG_C_FREE_DATA ):
case( VREG_C_LED_NOTIFY_DATA ):
case( VREG_C_LED_POW ):
break;
default:
iic_burst_state = 0; // 保険
//
if( ( reg_adrs != VREG_C_ACC_HOSU_HIST )
&& ( reg_adrs != VREG_C_INFO ) )
{ // この二つのレジスタは特殊なアクセス方法をする。アクセスポインタを進めない。
reg_adrs += 1;
}

View File

@ -7,7 +7,7 @@
#pragma di
#pragma ei
#pragma nop
#pragma inline // memcpy()をインライン展開する(の方が小さい!)
#pragma inline // memcpy()をインライン展開する
#include "incs.h"
#include "i2c_mcu.h"
@ -72,26 +72,28 @@ u8 iic_send_wo_dma_len;
u8 iic_mcu_bus_status; // 一文字リードの時はデータを返す。
// ステータスが必要ならこっちを呼んで
// ========================================================
void nop8()
{
// 実は nop11 位なのだが
}
static err iic_mcu_is_ready()
/* ========================================================
1
======================================================== */
u8 iic_mcu_read_a_byte( u8 SLA, u8 adrs )
{
u8 dat;
if( iic_mcu_initialized == 0 )
{
#ifdef _debug_
iic_mcu_start( );
#else
return( ERR_ERR );
while( 1 )
{
NOP();
}
#endif
}
@ -101,32 +103,8 @@ static err iic_mcu_is_ready()
NOP( );
}
iic_mcu_busy = 1;
return( ERR_SUCCESS );
}
/* ========================================================
1
======================================================== */
u8 iic_mcu_read_a_byte( u8 SLA, u8 adrs )
{
u8 dat;
#if 1
// ラッパー
if( iic_mcu_read( SLA, adrs, 1, &dat ) == ERR_SUCCESS )
{
iic_mcu_bus_status = ERR_OK;
}
else
{
iic_mcu_bus_status = ERR_NOSLAVE;
}
return ( dat );
#else
iic_mcu_is_ready();
iic_mcu_bus_status = ERR_OK;
// スタートコンディションとスレーブの呼び出し、レジスタアドレスの送信
if( iic_mcu_call_slave( SLA ) != 0 )
@ -162,7 +140,6 @@ u8 iic_mcu_read_a_byte( u8 SLA, u8 adrs )
IICIF10 = 0; // 後を濁さないこと
iic_mcu_busy = 0;
return ( dat );
#endif
}
@ -180,22 +157,33 @@ u8 iic_mcu_read_a_byte( u8 SLA, u8 adrs )
err iic_mcu_read( u8 slave, u8 adrs, u8 len, u8 * dest )
{
#if 1
if( iic_mcu_is_ready() != ERR_SUCCESS )
//*
// 使用中なら待つ
if( iic_mcu_initialized == 0 )
{
return( ERR_ERR );
}
;
#ifdef _debug_
iic_mcu_start( );
#else
// 使用中なら帰る
if( iic_mcu_initialized == 0 ){
return(0x80);
}
if( iic_mcu_busy != 0 ){
return( 3 );
}
while( 1 )
{
}
#endif
}
while( iic_mcu_busy )
{
NOP( );
}
/*/
// 使用中なら帰る
if( iic_mcu_initialized == 0 ){
return(0x80);
}
if( iic_mcu_busy != 0 ){
return( 3 );
}
//*/
iic_mcu_busy = 1;
// スタートコンディションとスレーブの呼び出し、レジスタアドレスの送信
if( iic_mcu_call_slave( slave ) != 0 )
{
@ -248,27 +236,31 @@ err iic_mcu_read( u8 slave, u8 adrs, u8 len, u8 * dest )
 iic_mcu_write 
======================================================== */
err iic_mcu_write_a_byte( u8 SLA, u8 adrs, u8 dat )
{
// ラッパー
static u8 temp; // 書きっぱなしで終了を見ずに関数を抜ける可能性が高いのでstatic
#if 0
// これをしないと、立て続けに書いたときに前のデータを破壊してしまう
if( iic_mcu_initialized == 0 )
{
#ifdef _debug_
iic_mcu_start( );
#else
while( 1 )
{
}
#endif
}
while( iic_mcu_busy )
{
NOP( );
}
iic_mcu_busy = 1;
#if 0
temp = dat;
iic_mcu_wo_dma = 1;
return ( iic_mcu_write( SLA, adrs, 1, &temp ) );
}
#else
// 文字の時はDMAとか起動しないでさっさと終わらせる
iic_mcu_is_ready();
// スタートコンディションとスレーブの呼び出し...
IICMK10 = 1;
if( iic_mcu_call_slave( SLA ) != 0 )
@ -303,11 +295,23 @@ err iic_mcu_write_a_byte( u8 SLA, u8 adrs, u8 dat )
******************************************************************************/
err iic_mcu_write( u8 slave, u8 adrs, u8 len, void * src )
{
if( iic_mcu_is_ready() != ERR_SUCCESS )
//*
// 使用中なら待つ
if( iic_mcu_initialized == 0 )
{
return( ERR_ERR );
#ifdef _debug_
iic_mcu_start( );
#else
while( 1 )
{
}
#endif
}
#if 0
while( iic_mcu_busy )
{
NOP( );
}
/*/
// 使用中なら帰る
if( iic_mcu_initialized == 0 ){
return(0x80);
@ -315,9 +319,9 @@ err iic_mcu_write( u8 slave, u8 adrs, u8 len, void * src )
if( iic_mcu_busy != 0 ){
return( 3 );
}
#endif
// スタートコンディションとスレーブの呼び出し...
//*/
iic_mcu_busy = 1;
// スタートコンディションとスレーブの呼び出し...
IICMK10 = 1;
IICIF10 = 0;
if( iic_mcu_call_slave( slave ) != 0 )
@ -341,7 +345,7 @@ err iic_mcu_write( u8 slave, u8 adrs, u8 len, void * src )
DEN1 = 1;
DSA1 = ( u8 ) ( &SIO10 );
DRA1 = &iic_send_work[0];
DRA1 = ( u16 ) iic_send_work;
DBC1 = len;
DMC1 = DRS | 8; // RAM -> SFR, 8bit, IRQ, IIC10
@ -357,14 +361,13 @@ err iic_mcu_write( u8 slave, u8 adrs, u8 len, void * src )
// DMAを使用しない //
// レジスタアドレスの送信
IICMK10 = 0;
SIO10 = adrs;
IICMK10 = 0;
iic_send_wo_dma_len = len;
p_iic_send_wo_dma_dat = src;
// 残りは割り込みルーチン内で
}
return ( ERR_SUCCESS );
}
@ -403,10 +406,34 @@ __interrupt void int_dma1( )
SOE0 = 0; // 受信の時はもっと前に「も」設定してる。(NACK出力)
SO0 = 0x0000 | TAUS_MASK; // SCL
nop8();
/*
NOP( );
NOP( );
NOP( );
NOP( );
#ifdef _OVERCLOCK_
NOP( );
NOP( );
NOP( );
NOP( );
NOP( );
#endif
*/
SO0 = 0x0400 | TAUS_MASK; // SCL
nop8();
/*
NOP( );
NOP( );
NOP( );
NOP( );
#ifdef _OVERCLOCK_
NOP( );
NOP( );
NOP( );
NOP( );
NOP( );
#endif
*/
SO0 = 0x0404 | TAUS_MASK;
}
IICMK10 = 1;
@ -440,10 +467,34 @@ __interrupt void int_iic10( )
SOE0 = 0; // 受信の時はもっと前に「も」設定してる。(NACK出力)
SO0 = 0x0000 | TAUS_MASK; // SCL
nop8();
/*
NOP( );
NOP( );
NOP( );
NOP( );
#ifdef _OVERCLOCK_
NOP( );
NOP( );
NOP( );
NOP( );
NOP( );
#endif
*/
SO0 = 0x0400 | TAUS_MASK; // SCL
nop8();
/*
NOP( );
NOP( );
NOP( );
NOP( );
#ifdef _OVERCLOCK_
NOP( );
NOP( );
NOP( );
NOP( );
NOP( );
#endif
*/
SO0 = 0x0404 | TAUS_MASK;
}
iic_mcu_wo_dma = 0;
@ -504,8 +555,20 @@ static err iic_mcu_send_a_byte( u8 dat )
static void iic_mcu_send_st( )
{
SO0 &= ~0x0004; // SDA
nop8();
nop8();
/*
NOP( );
NOP( );
NOP( );
NOP( );
#ifdef _OVERCLOCK_
NOP( );
NOP( );
NOP( );
NOP( );
NOP( );
#endif
*/
SO0 &= ~0x0400; // SCL
SOE0 = 0x0004; // ハード制御へ
@ -522,11 +585,35 @@ static void iic_mcu_send_re_st( )
{
ST0 |= 0x0004;
SO0 |= 0x0400 | TAUS_MASK; // ( SDA = H ), SCL -> H
nop8();
nop8();
/*
NOP( );
NOP( );
NOP( );
NOP( );
#ifdef _OVERCLOCK_
NOP( );
NOP( );
NOP( );
NOP( );
NOP( );
#endif
*/
SOE0 &= ~0x0004; // ( SCL = H ), SDA -> L
nop8();
nop8();
/*
NOP( );
NOP( );
NOP( );
NOP( );
#ifdef _OVERCLOCK_
NOP( );
NOP( );
NOP( );
NOP( );
NOP( );
#endif
*/
iic_mcu_send_st( );
}
@ -541,11 +628,35 @@ static void iic_mcu_send_sp( )
ST0 = 0x0004;
SOE0 = 0; // 受信の時はもっと前に「も」設定してる。(NACK出力)
SO0 = 0x0000 | TAUS_MASK; // SCL
nop8();
nop8();
/*
NOP( );
NOP( );
NOP( );
NOP( );
#ifdef _OVERCLOCK_
NOP( );
NOP( );
NOP( );
NOP( );
NOP( );
#endif
*/
SO0 = 0x0400 | TAUS_MASK; // SCL
nop8();
nop8();
/*
NOP( );
NOP( );
NOP( );
NOP( );
#ifdef _OVERCLOCK_
NOP( );
NOP( );
NOP( );
NOP( );
NOP( );
#endif
*/
SO0 = 0x0404 | TAUS_MASK;
}
@ -561,16 +672,29 @@ void iic_mcu_start( )
NOP( ); // 2clkもしくは、DSTn==0をポーリング
NOP( );
DEN1 = 0;
I2C_PU_on();
wait_ms( 10 ); // 立ち上がるのに50us位かかる
I2C_PU = 1;
SAU0EN = 1;
nop8();
nop8();
/*
NOP( );
NOP( );
NOP( );
NOP( );
#ifdef _OVERCLOCK_
NOP( );
NOP( );
NOP( );
NOP( );
NOP( );
#endif
*/
SPS0 = 0x0000; // シリアルユニットのクロック0。(8M/2)/1
SMR02 = bSMR0n_FIXEDBIT | bMD0n2; // 簡易I2Cに設定
SDR02 = 10 << 9; // ボーレート設定 8M/1/(x+1)/2
#ifdef _OVERCLOCK_
SDR02 = 12 << 9; // ボーレート設定 (8M/2)/1/(x+1)/2
#else
SDR02 = 5 << 9; // ボーレート設定 (8M/2)/1/(x+1)/2
#endif
SO0 = 0x0404 | TAUS_MASK; // 最初はHH
iic_mcu_busy = 0;
@ -604,7 +728,7 @@ void iic_mcu_stop( )
{;
} // DMA動作中はもう少し待つ
iic_mcu_send_re_st( ); // SCL,SDAをLLにする
I2C_PU_off();
I2C_PU = 0;
SAU0EN = 0;
iic_mcu_initialized = 0;
}

View File

@ -16,6 +16,7 @@ extern bit iic_mcu_wo_dma;
extern u8 iic_mcu_bus_status;
// ========================================================
err iic_mcu_read( u8 SLA, u8 adrs, u8 len, u8 * dest );
u8 iic_mcu_read_a_byte( u8 SLA, u8 adrs );
@ -23,7 +24,6 @@ u8 iic_mcu_read_a_byte( u8 SLA, u8 adrs );
err iic_mcu_write( u8 SLA, u8 adrs, u8 len, void * src );
err iic_mcu_write_a_byte( u8 SLA, u8 adrs, u8 dat );
// ↓その通信が完了したら解除されます。
#define iic_mcu_set_wo_dma() { while( iic_mcu_busy ){;} iic_mcu_wo_dma = 1; }

View File

@ -3,13 +3,6 @@
/*============================================================================*/
#include "config.h"
#ifdef _MCU_KE3_
#else
#pragma interrupt INTIICA0 int_iic_twl RB2
#endif
#include "incs.h"
#include "i2c_twl_defs.h"
@ -70,11 +63,10 @@ u16 tot;
// 注 ↓はマクロなので、returnはメインループに戻ります。
#define wait_next { \
tot = 0; \
tot = 0; \
while( IICAIF != 1 ){ \
if( SPD ){ \
LREL = 1; \
NOP(); \
return; \
} \
tot++; \
@ -106,8 +98,8 @@ __interrupt void int_iic_twl( )
wait_next; // 1バイト受信完了を待つ
// 2回目 R/W レジスタアドレス
IICAIF = 0;
temp = IICA;
IICAIF = 0;
WREL = 1;
vreg_adrs = adrs_table_twl_ext2int( temp );

View File

@ -12,7 +12,6 @@
#ifndef _incs_h_
#define _incs_h_
// ↓ 歩数計で_pc_とで切り替えてます
#define _mcu_
#include "jhl_defs.h"
@ -30,8 +29,8 @@
#include "accero.h"
#include "pm.h"
//=========================================================
err firm_update( );
#endif

View File

@ -34,5 +34,5 @@
//=========================================================
void firm_update( );
void firm_restore( );
err firm_update( );
err firm_restore( );

View File

@ -20,14 +20,9 @@
//#pragma interrupt INTP7 intp21_RFTx
//#endif
/*
acceroへ
#ifdef _MCU_BSR_
#pragma interrupt INTP23 intp23_ACC_ready RB3 // 加速度センサ、データ準備完了
#pragma interrupt INTP23 intp23_ACC_ready // 加速度センサ、データ準備完了
#endif
*/
//#pragma interrupt INTCMP0 fn_intcmp0
//#pragma interrupt INTCMP1 fn_intcmp1
@ -47,22 +42,15 @@
//#pragma interrupt INTSRE1 fn_intsre1
/*
.c
#ifdef _MCU_KE3_
#pragma interrupt INTIICA int_iic_ctr RB1 // CTR側
#pragma interrupt INTIICA int_iic_ctr // CTR側
#else
// TSはマザボでテレコ、WMは回路図がテレコで結局一致…
#pragma interrupt INTIICA1 int_iic_ctr RB1
#pragma interrupt INTIICA0 int_iic_twl
#pragma interrupt INTIICA1 int_iic_ctr
#endif
#ifdef _MCU_KE3_
#else
#pragma interrupt INTIICA0 int_iic_twl RB2
#endif
*/
//#pragma interrupt INTTM00 fn_inttm00
//#pragma interrupt INTTM01 fn_inttm01
//#pragma interrupt INTTM02 fn_inttm02
@ -79,75 +67,61 @@
//#pragma interrupt INTTM06 fn_inttm06
//#pragma interrupt INTTM07 fn_inttm07
//#define _irq_debug_
/****************************************************/
/* 未使用時のダミー関数定義 */
/****************************************************/
__interrupt void fn_intwdti( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_intlvi( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_intp0(){
#ifdef _irq_debug_
while( 1 )
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_intp1( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
} //
__interrupt void fn_intp2( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_intp3( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void intp21_RFTx( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
@ -159,223 +133,151 @@ __interrupt void intp21_RFTx( )
__interrupt void fn_intcmp0( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_intcmp1( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_intdma0( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
//__interrupt void fn_intdma1(){} // i2c_mcu.cにある
__interrupt void fn_intst0( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
/* __interrupt void fn_intcsi00(){} */
__interrupt void fn_intsr0( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
/* __interrupt void fn_intcsi01(){} */
__interrupt void fn_intsre0( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_intst1( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
/* __interrupt void fn_intcsi10(){} */
//__interrupt void fn_intiic10(){ while(1){} }
__interrupt void fn_intsr1( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_intsre1( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
//__interrupt void fn_intiica(){} // i2c.cにある
/* __interrupt void fn_inttm00(){} *//* sub.cにて定義 */
__interrupt void fn_inttm01( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_inttm02( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_inttm03( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
//__interrupt void fn_intad(){ while(1){} } // adc.c
__interrupt void fn_intrtc( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
//__interrupt void int_rtcint(){} // rtc.cにある
//__interrupt void fn_intkr(){} // main.c
__interrupt void fn_intmd( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_inttm04( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_inttm05( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_inttm06( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
__interrupt void fn_inttm07( )
{
#ifdef _irq_debug_
while( 1 )
{
NOP();
}
#endif
}
/* ========================================================
======================================================== */
__interrupt void int_kr( )
{
// 起きるだけ
}
/* ========================================================
ext dc
======================================================== */
__interrupt void intp4( )
{
// 起きるだけ
}
/* ========================================================
shell close
======================================================== */
__interrupt void intp5( )
{
// 起きるだけ
}

View File

@ -2,12 +2,9 @@
#define __jhl_defs_h__
typedef unsigned char u8;
typedef signed char s8;
typedef signed char s8;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned short ux16;
typedef signed short sx16;
typedef signed short s16;
typedef unsigned char err;

View File

@ -9,8 +9,6 @@
#include "led.h"
#ifdef _MODEL_CTR_NOTIFY_FULLCOLOR_
// ========================================================
// TPS0
@ -29,74 +27,13 @@
// ========================================================
static void led_pow_normal( );
static void led_pow_hotaru( );
static void led_pow_normal_old( );
static void led_pow_hotaru_old( );
// ========================================================
// お知らせLEDのパターンデータ
uni_info_LED info_LED;
// 赤LEDの電池残量LEDの点滅パターン
uni_led_red_batt_empty led_red_batt_empty;
// ========================================================
#define led_fade_to( now, goal ) now = fade_to( now, goal )
/* ========================================================
reg_ledをgoalになるまでグラデーションする
====================================================== */
u8 fade_to( u8 now, u8 goal )
{
if( now != goal )
{
if( now > goal )
{
now -= 1;
}
else
{
now += 1;
}
}
return( now );
}
// ========================================================
#define led_fade_to2( led, status ) \
led = fade_to2( status )
u8 fade_to2( st_LED_dim_status* status )
{
if( status->now != status->to )
{
if( abs(( status->to - status->now )) > abs(status->delta) )
{
status->now += status->delta;
}
else
{
status->now = status->to;
}
}
return( status->now / 128 );
}
// ========================================================
static const char MSG_MAIL[] = { 0b11110110, 0b11011010, 0b01101110, 0b10010100 };
#define MSG_SPD 60
// ↑255/3以下であること
// ========================================================
void LED_init( )
@ -135,12 +72,12 @@ void LED_init( )
TOE0 = 0b0000000011101110; // TOxをタイマーモジュールが制御
TS0 = 0b0000000011101111; // 動作開始
TDR00 = LED_BRIGHT_MAX - 1; // 周期 10bit
TDR00 = LED_BRIGHT_MAX - 1; // 10bit, 周期
if( system_status.reboot )
{
vreg_ctr[VREG_C_LED_POW] = LED_POW_ILM_AUTO;
LED_duty_pow_blu = LED_BRIGHT_MAX;
LED_duty_pow_H = LED_BRIGHT_MAX;
}
}
@ -181,103 +118,51 @@ enum LED_ILUM_MODE{
======================================================== */
void tsk_led_pow( )
{
// tsk_led_powを呼び出すrengeどんが、タスク関数の配列をリンク時
// に決めるてROMにもっているので、ここで分岐するしかない orz
if( system_status.info_fullcolor )
switch ( vreg_ctr[VREG_C_LED_POW] )
{
// お知らせランプフルカラー版 /////////////////////
switch ( vreg_ctr[VREG_C_LED_POW] )
// 自動切り替え
case ( LED_POW_ILM_AUTO ):
switch ( system_status.pwr_state )
{
// 自動切り替え
case ( LED_POW_ILM_AUTO ):
switch ( system_status.pwr_state )
{
case SLEEP:
led_pow_hotaru( );
break;
case ON:
led_pow_normal( );
break;
default:
break;
}
break;
case ( LED_POW_ILM_HOTARU ):
case SLEEP:
led_pow_hotaru( );
break;
case ( LED_POW_ILM_ON ):
default:
case ON:
led_pow_normal( );
break;
case ( LED_POW_ILM_OFF ):
led_fade_to( LED_duty_pow_blu, 0 );
LED_pow_red = 0;
break;
case ( LED_POW_ILM_ONLY_RED ):
LED_duty_pow_blu = 0;
LED_pow_red = 1;
break;
case ( LED_POW_ILM_ONLY_BLUE ):
LED_duty_pow_blu = LED_BRIGHT_MAX;
LED_pow_red = 0;
break;
}
}
else
{
// 旧仕様 /////////////////////////////////////////
switch ( vreg_ctr[VREG_C_LED_POW] )
{
// 自動切り替え
case ( LED_POW_ILM_AUTO ):
switch ( system_status.pwr_state )
{
case SLEEP:
led_pow_hotaru_old( );
break;
case ON:
led_pow_normal_old( );
break;
default:
break;
}
break;
case ( LED_POW_ILM_HOTARU ):
led_pow_hotaru_old( );
break;
case ( LED_POW_ILM_ON ):
default:
led_pow_normal_old( );
break;
case ( LED_POW_ILM_OFF ):
led_fade_to( LED_duty_old_pow_blu, 0 );
led_fade_to( LED_duty_old_pow_red, 0 );
break;
case ( LED_POW_ILM_ONLY_RED ):
LED_duty_old_pow_blu = 0;
LED_duty_old_pow_red = LED_BRIGHT_MAX;
case ( LED_POW_ILM_ONLY_BLUE ):
LED_duty_old_pow_blu = LED_BRIGHT_MAX;
LED_duty_old_pow_red = 0;
break;
}
break;
// 強制
case ( LED_POW_ILM_OFF ):
LED_duty_pow_H -= ( LED_duty_pow_H == 0x0000 ) ? 0 : 1;
LED_duty_pow_L -= ( LED_duty_pow_L == 0x0000 ) ? 0 : 1;
break;
case ( LED_POW_ILM_HOTARU ):
led_pow_hotaru( );
break;
case ( LED_POW_ILM_ON ):
default:
led_pow_normal( );
break;
case ( LED_POW_ILM_ONLY_RED ):
LED_duty_pow_H = 0x0000;
LED_duty_pow_L = LED_BRIGHT_MAX;
break;
case ( LED_POW_ILM_ONLY_BLUE ):
LED_duty_pow_H = LED_BRIGHT_MAX;
LED_duty_pow_L = 0x0000;
break;
}
}
@ -286,127 +171,50 @@ void tsk_led_pow( )
 
======================================================== */
static void led_pow_normal( )
{
static u8 delay;
static u8 red_blink_poi;
u8 temp;
if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_EMPTY )
{
// 赤点滅
led_fade_to( LED_duty_pow_blu, 0 );
// 赤の点滅パターンも指定できる
delay += 1;
if( delay < 16 ) // フレームの保持時間稼ぎ
{
return;
}
delay = 0;
if( ( led_red_batt_empty.bits & ( 1 << red_blink_poi )) != 1 )
{
LED_pow_red = 1;
LED_duty_notify_red = 255;
}
else
{
LED_pow_red = 0;
LED_duty_notify_red = 0;
}
red_blink_poi += 1;
if( red_blink_poi >= 32 )
{
red_blink_poi = 0;
}
}
else if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_LO )
{
// 赤点灯
led_fade_to( LED_duty_pow_blu, 0 );
LED_pow_red = 1;
return;
}
else
{
// 青点灯
led_fade_to( LED_duty_pow_blu, vreg_ctr[VREG_C_LED_BRIGHT] );
LED_pow_red = 0;
}
return;
}
/* ========================================================
 
======================================================== */
static void led_pow_normal_old( )
{
static u8 state;
static u8 red_blink_poi;
u8 temp;
if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_EMPTY )
if( vreg_ctr[VREG_C_BT_REMAIN] < 3 )
{
// 赤点滅
led_fade_to( LED_duty_pow_blu, 0 );
#if 0
state++;
if( state < 127 )
{
LED_pow_red = 0;
LED_duty_pow_H = 0x0000;
LED_duty_pow_L = 0x0000;
}
else
{
LED_pow_red = 1;
LED_duty_pow_L = vreg_ctr[VREG_C_LED_BRIGHT];
}
return;
#endif
led_fade_to( LED_duty_notify_grn, 0 );
led_fade_to( LED_duty_notify_blu, 0 );
state += 1;
if( state < 16 )
{
return;
}
state = 0;
if( ( led_red_batt_empty.bits & ( 1 << red_blink_poi )) != 1 )
{
LED_pow_red = 1;
LED_duty_notify_red = 255;
}
else
{
LED_pow_red = 0;
LED_duty_notify_red = 0;
}
red_blink_poi += 1;
if( red_blink_poi >= 32 )
{
red_blink_poi = 0;
}
}
else if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_LO )
else if( vreg_ctr[VREG_C_BT_REMAIN] < 12 )
{
// 赤点灯
led_fade_to( LED_duty_pow_blu, 0 );
LED_pow_red = 1;
if( LED_duty_pow_H != 0x0000 )
{ // 青フェードアウト
LED_duty_pow_H -= 1;
}
if( LED_duty_pow_L != vreg_ctr[VREG_C_LED_BRIGHT] )
{ // 赤フェードイン
LED_duty_pow_L += ( LED_duty_pow_L < vreg_ctr[VREG_C_LED_BRIGHT] ) ? 1 : -1;
}
return;
}
else
{
// 青点灯
led_fade_to( LED_duty_pow_blu, vreg_ctr[VREG_C_LED_BRIGHT] );
LED_pow_red = 0;
if( LED_duty_pow_H != vreg_ctr[VREG_C_LED_BRIGHT] )
{
LED_duty_pow_H += ( LED_duty_pow_H < vreg_ctr[VREG_C_LED_BRIGHT] ) ? 1 : -1;
}
if( LED_duty_pow_L != 0x0000 )
{
LED_duty_pow_L -= 1;
}
}
return;
@ -422,14 +230,41 @@ static void led_pow_hotaru( )
static u8 delay;
static u8 state;
static u16 blue_to;
static u16 red_to;
if( delay != 0 )
{
delay -= 1;
return;
}
else
{
delay = 10;
}
delay = 10;
if( LED_duty_pow_L != red_to )
{
if( LED_duty_pow_L > red_to )
{
LED_duty_pow_L -= 1;
}
else
{
LED_duty_pow_L += 2;
}
}
if( LED_duty_pow_H != blue_to )
{
if( LED_duty_pow_H > blue_to )
{
LED_duty_pow_H -= 1;
}
else
{
LED_duty_pow_H += 2;
}
}
switch ( state )
{
@ -437,23 +272,24 @@ static void led_pow_hotaru( )
case ( 0 ):
case ( 2 ):
case ( 4 ):
if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_LO )
if( vreg_ctr[VREG_C_BT_REMAIN] < 12 )
{
// 赤いとき
blue_to = 0;
LED_pow_red = 1;
red_to = vreg_ctr[VREG_C_LED_BRIGHT];
}
else
{
blue_to = vreg_ctr[VREG_C_LED_BRIGHT];
LED_pow_red = 0;
red_to = 0;
}
break;
default:
// フェードアウト
if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_LO )
if( vreg_ctr[VREG_C_BT_REMAIN] < 12 )
{
LED_pow_red = 0;
red_to = 2;
}
else
{
@ -462,107 +298,19 @@ static void led_pow_hotaru( )
break;
}
// LED更新
if( LED_duty_pow_blu != blue_to )
{
if( LED_duty_pow_blu > blue_to )
{
LED_duty_pow_blu -= 1;
}
else
{
LED_duty_pow_blu += 2;
}
}
if( LED_duty_pow_blu == blue_to )
if( ( LED_duty_pow_H == blue_to ) && ( LED_duty_pow_L == red_to ) )
{
state += 1;
}
return;
}
/* ========================================================
======================================================== */
static void led_pow_hotaru_old( )
{
static u8 delay;
static u8 state;
static u16 blue_to;
if( delay != 0 )
{
delay -= 1;
return;
}
delay = 10;
switch ( state )
{
// フェードイン
case ( 0 ):
case ( 2 ):
case ( 4 ):
if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_LO )
{
blue_to = 0;
LED_pow_red = 1;
}
else
{
blue_to = vreg_ctr[VREG_C_LED_BRIGHT];
LED_pow_red = 0;
}
break;
default:
// フェードアウト
if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_LO )
{
LED_pow_red = 0;
}
else
{
blue_to = 2;
}
break;
}
// LED更新
if( LED_duty_pow_blu != blue_to )
{
if( LED_duty_pow_blu > blue_to )
{
LED_duty_pow_blu -= 1;
}
else
{
LED_duty_pow_blu += 2;
}
}
if( LED_duty_pow_blu == blue_to )
{
state += 1;
}
return;
}
/* ========================================================
* 使 *
LED_Wifi 3
todo .old
todo
======================================================== */
void tsk_led_wifi( )
{
@ -578,15 +326,38 @@ void tsk_led_wifi( )
}
// 送信パルスのラッチ
if( WIFI_txLatch ) // 割り込みフラグそのものを使ってしまう
if( vreg_ctr[VREG_C_LED_WIFI] == WIFI_LED_TXAUTO )
{
if( WIFI_txLatch )
{
WIFI_txLatch = 0;
flag_wifi_TX = 2;
}
}
else
{
flag_wifi_TX = 0;
}
if( flag_wifi_TX != 0 )
switch ( vreg_ctr[VREG_C_LED_WIFI] )
{
case ( WIFI_LED_OFF ):
default:
LED_duty_WiFi = 0;
state_wifi_tx = 0;
remain_wifi_tx = 0;
break;
case ( WIFI_LED_ON ):
LED_duty_WiFi = vreg_ctr[VREG_C_LED_BRIGHT];
state_wifi_tx = 0;
remain_wifi_tx = 0;
break;
case ( WIFI_LED_TXAUTO ):
if( flag_wifi_TX != 0 ) // 短いパルスを捕まえるために、割り込みフラグを見る
{
vreg_ctr[ VREG_C_STATUS_1 ] |= REG_BIT_WIFI_TX;
// 送信パターン
switch ( state_wifi_tx )
{
@ -610,17 +381,12 @@ void tsk_led_wifi( )
else
{
// 送信フラグ待ち
vreg_ctr[ VREG_C_STATUS_1 ] &= ~REG_BIT_WIFI_TX;
if( vreg_ctr[VREG_C_LED_WIFI] == WIFI_LED_OFF )
{
LED_duty_WiFi = 0;
}
else
{
LED_duty_WiFi = vreg_ctr[VREG_C_LED_BRIGHT];
task_interval = 200;
return;
}
task_interval = 100;
return;
break;
}
}
@ -628,67 +394,123 @@ void tsk_led_wifi( )
/* ========================================================
LED
* 使 *
LED_Wifi2 P24
======================================================== */
void tsk_led_notify( )
{
// static u8 task_interval;
static u8 time_to_next_frame;
static u8 frame;
static st_LED_dim_status LED_dim_status_info_R, LED_dim_status_info_G, LED_dim_status_info_B;
static u8 task_interval;
static u8 flg_char_space;
static u8 state_notify_led; // 点灯パターンの進行具合
static u8 flag_wifi_TX;
if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_EMPTY )
if( task_interval-- != 0 )
{
// 電池切れが優先する
return;
}
// 次のフレームに進める?
if( time_to_next_frame == 0 )
switch ( vreg_ctr[VREG_C_LED_NOTIFY] )
{
time_to_next_frame = info_LED.info_LED.term;
case ( NOTIFY_LED_OFF ):
default:
LED_duty_NOTIFY = 0;
state_notify_led = 0;
flg_char_space = 0;
break;
frame += 1;
// 最後のフレームリピート
if( frame > NOTIFY_LED_TERM )
case ( NOTIFY_LED_ON ):
LED_duty_NOTIFY = vreg_ctr[VREG_C_LED_BRIGHT];
state_notify_led = 0;
flg_char_space = 0;
break;
case ( NOTIFY_LED_PTN0 ):
// ゆっくりバースト
switch ( state_notify_led )
{
if( !info_LED.info_LED.last_loop )
case ( 1 ):
case ( 3 ):
case ( 5 ):
LED_duty_NOTIFY = vreg_ctr[VREG_C_LED_BRIGHT];
break;
default:
LED_duty_NOTIFY = 0;
}
state_notify_led++;
if( state_notify_led == 16 )
{
state_notify_led = 0;
}
task_interval = 50;
return;
case ( NOTIFY_LED_PTN1 ):
// データテーブルに従って点滅
{
u8 dat;
task_interval = MSG_SPD; // 共通のため。場合によって上書き
if( flg_char_space != 0 )
{
frame = 0;
vreg_ctr[ VREG_C_LED_NOTIFY_FLAG ] &= ~REG_BIT_IN_LOOP;
LED_duty_NOTIFY = 0;
flg_char_space = 0;
return;
}
// データバッファの見る位置の更新
dat = ( MSG_MAIL[state_notify_led / 4] << ( ( state_notify_led % 4 ) * 2 ) ) & 0xC0;
if( dat == 0 )
{
state_notify_led = 0;
}
else
{
frame = NOTIFY_LED_TERM;
vreg_ctr[ VREG_C_LED_NOTIFY_FLAG ] |= REG_BIT_IN_LOOP;
state_notify_led += 1;
}
flg_char_space = 1;
if(( dat & 0b10000000 ) != 0 )
{
// 点灯はさせる
LED_duty_NOTIFY = vreg_ctr[VREG_C_LED_BRIGHT];
if(( dat & 0b01000000 ) == 0 )
{
// 短
// nothing to do
}
else
{
// 長
task_interval = ( MSG_SPD * 3 );
}
// 次は単語間休み、とかの判定をさせたかったが
/// 1バイトに2ビットずつデータが並んでおり、次のバイトに
/// またがるようなときが面倒なのでやめる
return;
}
else
{
if(( dat & 0b01000000 ) == 0 )
{
// 一文終了
task_interval = ( MSG_SPD * 3 );
}
else
{
// 単語間
// nothing to do
}
return;
}
}
if( frame < NOTIFY_LED_TERM )
{
LED_dim_status_info_R.to = info_LED.info_LED.red[frame] * 128;
LED_dim_status_info_G.to = info_LED.info_LED.grn[frame] * 128;
LED_dim_status_info_B.to = info_LED.info_LED.blu[frame] * 128;
// グラデーションのデルタを計算
LED_dim_status_info_R.delta = (( LED_dim_status_info_R.to - LED_dim_status_info_R.now ) ) / info_LED.info_LED.fade_time;
LED_dim_status_info_G.delta = (( LED_dim_status_info_G.to - LED_dim_status_info_G.now ) ) / info_LED.info_LED.fade_time;
LED_dim_status_info_B.delta = (( LED_dim_status_info_B.to - LED_dim_status_info_B.now ) ) / info_LED.info_LED.fade_time;
}
}
time_to_next_frame -= 1;
led_fade_to2( LED_duty_notify_red, &LED_dim_status_info_R );
led_fade_to2( LED_duty_notify_grn, &LED_dim_status_info_G );
led_fade_to2( LED_duty_notify_blu, &LED_dim_status_info_B );
}
/******************************************************//**
LED_Cam TO02
\n BLINK,*_PLUSE 1
@ -713,24 +535,24 @@ void tsk_led_cam( )
{
case ( CAM_LED_OFF ):
default:
LED_CAM = 0;
LED_duty_CAM = 0;
state_led_cam = 0;
break;
case ( CAM_LED_ON ):
LED_CAM = 1;
LED_duty_CAM = vreg_ctr[VREG_C_LED_BRIGHT];
state_led_cam = 0;
break;
case ( CAM_LED_BLINK ):
if( state_led_cam == 0 )
{
LED_CAM = 1;
LED_duty_CAM = vreg_ctr[VREG_C_LED_BRIGHT];
state_led_cam = 1;
}
else
{
LED_CAM = 0;
LED_duty_CAM = 0;
state_led_cam = 0;
}
task_interval = 250;
@ -739,7 +561,7 @@ void tsk_led_cam( )
case ( CAM_LED_ON_PLUSE ):
if( state_led_cam == 0 )
{
LED_CAM = 1;
LED_duty_CAM = vreg_ctr[VREG_C_LED_BRIGHT];
state_led_cam = 1;
task_interval = 250;
}
@ -752,7 +574,7 @@ void tsk_led_cam( )
case ( CAM_LED_OFF_PLUSE ):
if( state_led_cam == 0 )
{
LED_CAM = 0;
LED_duty_CAM = 0;
state_led_cam = 1;
task_interval = 250;
}
@ -765,19 +587,19 @@ void tsk_led_cam( )
case ( CAM_LED_BY_TWL ):
switch ( vreg_twl[ REG_TWL_INT_ADRS_CAM ] ){ // switchのネストとか…
case( TWL_CAMLED_OFF ):
LED_CAM = 0;
LED_duty_CAM = 0;
state_led_cam = 0;
break;
case( TWL_CAMLED_BLINK ):
if( state_led_cam == 0 )
{
LED_CAM = 1;
LED_duty_CAM = vreg_ctr[VREG_C_LED_BRIGHT];
state_led_cam = 1;
}
else
{
LED_CAM = 0;
LED_duty_CAM = 0;
state_led_cam = 0;
}
task_interval = 250;
@ -786,7 +608,7 @@ void tsk_led_cam( )
case( TWL_CAMLED_ON ):
case( TWL_CAMLED_DEF_ON ):
default:
LED_CAM = 1;
LED_duty_CAM = vreg_ctr[VREG_C_LED_BRIGHT];
state_led_cam = 1;
break;
}
@ -794,4 +616,3 @@ void tsk_led_cam( )
return;
}
#endif

View File

@ -1,41 +1,22 @@
#ifndef __led__
#define __led__
// ====================================
// LED_DUTY
#define LED_duty_pow_blu TDR05
#define LED_duty_WiFi TDR02
#define LED_duty_3d TDR01
#define LED_duty_notify_red TDR07
#define LED_duty_notify_grn TDR03
#define LED_duty_notify_blu TDR06
// これらはduty変えられません
#define LED_pow_red P7.5
#define LED_CAM P4.2
// 旧仕様
// LED_DUTY
#define LED_duty_old_pow_blu TDR06
#define LED_duty_old_pow_red TDR07
#define LED_duty_old_WiFi TDR03
#define LED_duty_old_NOTIFY TDR05
#define LED_duty_old_CAM TDR02
#define LED_duty_old_3d TDR01
#define LED_duty_pow_L TDR07
#define LED_duty_pow_H TDR06
#define LED_duty_WiFi TDR03
#define LED_duty_NOTIFY TDR05
#define LED_duty_CAM TDR02
#define LED_duty_TUNE TDR01
// wifi2はPWMできません。
#define LED_CHARGE P2.4
#define NOTIFY_LED_TERM 32
#define LED_BRIGHT_MAX 0x00FF
// ====================================
#ifdef _MCU_BSR_ // 電波送信パルス
#define WIFI_txLatch PIF21
@ -69,7 +50,10 @@ enum LED_MODE_TUNE
enum
{
WIFI_LED_OFF = 0,
WIFI_LED_ON
WIFI_LED_ON,
WIFI_LED_TXAUTO,
WIFI_LED_PTN0,
WIFI_LED_PTN1
};
@ -97,51 +81,10 @@ enum
// お知らせLED調光関係 //
typedef struct{
u8 term; // 1フレーム何チック
u8 fade_time; // 何チックで次のフレームの色に達するか
u8 last_loop; // 最終フレームを
u8 resv1;
u8 red[32];
u8 grn[32];
u8 blu[32];
}st_info_LED;
typedef union{
st_info_LED info_LED;
u8 bindata[ sizeof( st_info_LED ) ];
}uni_info_LED;
extern uni_info_LED info_LED;
// 赤LED 点滅向け //
typedef struct{
u8 dats[4];
}st_u8s4;
typedef union{
unsigned long bits;
st_u8s4 dats;
}uni_led_red_batt_empty;
extern uni_led_red_batt_empty led_red_batt_empty;
/*
LED
*/
typedef struct{
sx16 to;
sx16 delta;
sx16 now; // 小数点以下を覚えておかなくてはならないため
}st_LED_dim_status;
// ====================================
void LED_init( );
void LED_stop( );
extern void tsk_led_cam();
#endif

View File

@ -57,6 +57,7 @@ static fsl_u08 fsl_MK2H_bak_u08; /* }
void FSL_Open( void );
void FSL_Close( void );
void hdwinit( void );
void power_save( );
static void hdwinit2( );
extern void main_loop( );
@ -69,49 +70,40 @@ void main( )
while( 1 )
{
WDT_Restart( );
if( RTCEN ) // これは書き替えたときにしか使えない
if( RTCEN )
{
system_status.reboot = 1;
}
else if( ( RESF & 0x10 ) != 0) // WDRF,WDTでリセット
{
system_status.reboot = 1;
#ifdef _PMIC_TWL_
// 暴走してしまうので再起動させる
PM_reset_ast();
/// hdwinit2ないでリセット解除される。続きに続行してよい頭痛が痛い的
#endif
vreg_ctr[ VREG_C_MCU_STATUS ] |= REG_BIT_STATUS_WDT_RESET;
// set_irq( VREG_C_IRQ0, REG_BIT_IRQ_WDT_RESET );
// ↑I2Cの初期化後に行う
hdwinit2( );
}
else
{
u8 my_resf = RESF; // ←読むと消え、生存区間の関係
if( ( my_resf & ( 0x10 | 0x80 ) ) != 0 )
// 0x10 : WDRF,WDTでリセット
// 0x80 : TRAP
{
if( ( my_resf & 0x10 ) != 0 )
{
IRQ0_neg; // 一瞬上げて落とし直す。
#ifdef _PMIC_TWL_
// 暴走してしまうので再起動させる
PM_reset_ast();
/// hdwinit2 内で解除する
#endif
vreg_ctr[ VREG_C_MCU_STATUS ] |= REG_BIT_STATUS_WDT_RESET;
// set_irq( VREG_C_IRQ0, REG_BIT_IRQ_WDT_RESET );
// ↑I2Cの初期化後に行う
}
system_status.reboot = 1;
}
else
{
// 通常の電源投入
u8 pwup_delay0 = 0;
u8 pwup_delay1 = 0;
u8 pwup_delay0 = 0;
u8 pwup_delay1 = 0;
do
{ // 電池接続時、16ms待ってみる(チャタリング対策)
pwup_delay0 += 1;
do
{ // 電池接続時、16ms待ってみる(チャタリング対策)
pwup_delay0 += 1;
do
{
pwup_delay1 += 1;
}
while( pwup_delay1 != 0 ); // u16にするとコンパイラが怒るんだが…。
{
pwup_delay1 += 1;
}
while( pwup_delay0 != 0 );
while( pwup_delay1 != 0 ); // u16にするとコンパイラが怒るんだが…。
}
hdwinit2( );
while( pwup_delay0 != 0 );
hdwinit2( );
}
// ファームの整合性チェック //
@ -126,11 +118,6 @@ void main( )
comp += ( *( __far u8 * )( MGC_LOAD + i ) == *( u8 * )( MGC_FOOT + i ) ) ? 0 : 1;
}
if( *( u8 * )( MGC_FOOT ) == 0xFF ) // 消去済のまま
{
comp += 1;
}
if( comp != 0 )
{
// ファームリストアを試みる
@ -146,6 +133,30 @@ void main( )
/* ========================================================
======================================================== */
__interrupt void int_kr( )
{
}
/* ========================================================
ext dc
======================================================== */
__interrupt void intp4( )
{
}
/* ========================================================
shell close
======================================================== */
__interrupt void intp5( )
{
}
// ========================================================
@ -158,7 +169,11 @@ void hdwinit( void )
#ifdef _MCU_BSR_
OSMC = 0x01; /* 隠しレジスタ */
#endif
#ifdef _OVERCLOCK_
CKC = 0b00001000; /* CPU/周辺クロック=fMAIN、fMAIN=fMX、fCLK=fMX */
#else
// CKC デフォルトでよい
#endif
/*--- 低電圧検出回路の設定 ---*/
/* リセット解除時のデフォルトは、オプション・バイトにて指定される */
@ -185,12 +200,12 @@ void hdwinit2( )
P14 = 0b00000001;
#endif
#ifdef _MODEL_TS0_
P0 = 0b00000011;
P0 = 0b00000001;
P3 = 0b00000111; // 簡易I2Cは出力ラッチを1にする
P14 = 0b00000000;
#endif
#ifdef _MODEL_CTR_
P0 = 0b00000011;
P0 = 0b00000001;
P3 = 0b00000111; // 簡易I2Cは出力ラッチを1にする
P14 = 0b00000000;
#endif
@ -202,43 +217,6 @@ void hdwinit2( )
P14 = 0b00000000;
}
#ifdef _MCU_BSR_
PM20 = 0b11111100;
#else
PM8 = 0b11111111;
#endif
#ifdef _MCU_BSR_
P20 = 0b00000000;
#else
P8 = 0b00000000;
#endif
#ifdef _MCU_BSR_
# ifdef _MODEL_CTR_
# ifdef _SW_HOME_ENABLE_
PU20 = 0b00010101;
# else
PU20 = 0b00000101;
# endif
# else
PU20 = 0b00000100;
# endif
if( !INFO_LED_IS_FULLCOLOR_n )
{
system_status.info_fullcolor = 1;
}
else
{
system_status.info_fullcolor = 0;
}
INFO_LED_IS_FULLCOLOR_PM = 0;
INFO_LED_IS_FULLCOLOR_PU = 0;
#endif
#ifdef _MCU_BSR_
PM0 = 0b11111111; // BSRマイコンでは、reset1は監視のみになる。
#else
@ -254,6 +232,13 @@ void hdwinit2( )
P6 = 0b00000000;
P7 = 0b01000000;
P12 = 0b00000000;
#ifdef _MCU_BSR_
P20 = 0b00000000;
#else
P8 = 0b00000000;
#endif
P15 = 0b00000000;
@ -261,11 +246,12 @@ void hdwinit2( )
PM2 = 0b11101001;
#ifdef _PMIC_CTR_
PM4 = 0b11110011;
PM4 = 0b11110111;
#else
PM4 = 0b11111011;
#endif
PM5 = 0b11110010;
PM5 = 0b11110011;
PM6 = 0b11111100; // I2CのラインがL出力になってしまうが、システムがOFFなのでかまわない
#ifdef _PMIC_CTR_
PM7 = 0b01011111;
@ -275,6 +261,16 @@ void hdwinit2( )
PM12 = 0b11111111; // 32kHzクロックのピン設定はどっちでもよい
PM15 = 0b11111111;
#ifdef _MCU_BSR_
#ifdef _MODEL_CTR_
PM20 = 0b11111101;
#else
PM20 = 0b11111100;
#endif
#else
PM8 = 0b11111111;
#endif
// プルアップ /////////////////////////////////////////
PU0 = 0b00000000; // バッテリ認証後にそれぞれセット
PU1 = 0b00000000;
@ -285,14 +281,22 @@ void hdwinit2( )
PU12 = 0b00000000;
PU14 = 0b00000000;
#ifdef _MCU_BSR_
#ifdef _MODEL_CTR_
#ifdef _SW_HOME_ENABLE_
PU20 = 0b00010001;
#else
PU20 = 0b00000001;
#endif
#else
PU20 = 0b00000000;
#endif
#endif
// ポート入力モード・レジスタ設定 /////////////////////
// [0:通常入力バッファ 1:TTL入力バッファ]
#if 0
// デフォルト値
PIM3 = 0b00000000;
PIM7 = 0b00000000;
#endif
// ポート出力モード・レジスタ設定
// [0:通常出力モード 1:N-chオープン・ドレーン出力]
@ -317,17 +321,16 @@ void hdwinit2( )
MK2L = 0xFF;
#endif
#if 0
// デフォルト値
PR00 = 0xFFFF; /* 割り込み優先順位、全て低位(LV3) */
PR01 = 0xFFFF;
PR10 = 0xFFFF;
PR11 = 0xFFFE;
// PR11H = 0b11111111;
// PR11L = 0b11111110;
PR02L = 0xFF;
PR12L = 0xFF;
#endif
PR00L = 0b11111111; /* 割り込み優先順位、全て低位(LV3) */
PR10L = 0b11111111;
PR00H = 0b11111111;
PR10H = 0b11111111;
PR01L = 0b11111111;
PR11L = 0b11111110;
PR01H = 0b11111111;
PR11H = 0b11111111;
PR02L = 0b11111111;
PR12L = 0b11111111;
/*--- 外部割込の有効エッジ設定 ---*/
#ifdef _MCU_BSR_

View File

@ -0,0 +1,4 @@
#include "jhl_defs.h"
err firm_update( );

View File

@ -7,13 +7,13 @@
// V0.5 (ニセ0.1改)
#pragma section @@CNSTL MGC_LOAD AT 0x0FF6
__far const unsigned char MGC_LOAD[] = __TIME__;
__far static const unsigned char MGC_LOAD[] = __TIME__;
#pragma section @@CNST MGC_MIMI AT 0x2100
const unsigned char MGC_HEAD[] = __TIME__;
static const unsigned char MGC_HEAD[] = __TIME__;
#pragma section @@CNST MGC_TAIL AT 0x4FF6
const unsigned char MGC_TAIL[] = __TIME__;
static const unsigned char MGC_TAIL[] = __TIME__;
// 0Dまでこれを使用
@ -55,11 +55,11 @@ __far static const unsigned char MGC_LOAD[] =
// V0.4以降
#pragma section @@CNSTL MGC_LOAD AT 0x0FF6
__far const unsigned char MGC_LOAD[] = __TIME__;
__far static const unsigned char MGC_LOAD[] = __TIME__;
#pragma section @@CNST MGC_MIMI AT 0x2100
const unsigned char MGC_HEAD[] = __TIME__;
static const unsigned char MGC_HEAD[] = __TIME__;
#pragma section @@CNST MGC_TAIL AT 0x47F6
const unsigned char MGC_TAIL[] = __TIME__;
static const unsigned char MGC_TAIL[] = __TIME__;
*/

View File

@ -15,8 +15,6 @@
#include "led.h"
#include "adc.h"
#include "pool.h"
// ========================================================
static void read_dipsw( );
@ -24,9 +22,10 @@ static void read_dipsw( );
// ========================================================
system_status_ system_status;
uni_pool pool;
bit update;
u16 pool[256]; // アップデート時のワークエリア 兼 歩数計データ
/* ========================================================
loader.c
======================================================== */
@ -41,6 +40,8 @@ void main_loop( void )
iic_mcu_start( );
EI( );
PM_init();
if( system_status.reboot )
{
#ifdef _PMIC_TWL_
@ -58,6 +59,9 @@ void main_loop( void )
system_status.pwr_state = OFF_TRIG;
}
#ifdef _PARRADIUM_
system_status.pwr_state = OFF;
#endif
vreg_ctr_init( );
vreg_twl_init( );

View File

@ -1,11 +1,11 @@
/* ********************************************************
3
********************************************************* */
#pragma mul
#pragma div
#pragma bcd
#pragma MUL
#pragma BCD
#include "incs.h"
#include <math.h>
@ -13,25 +13,13 @@
#include "accero.h"
#include "pedometer.h"
#include "pedo_lpf_coeff.h"
#include "pool.h"
// ========================================================
static void hosu_increment();
// ========================================================
u16 get_long_hour();
extern uni_pool pool;
// ========================================================
#define _use_my_sqrt_
#ifdef _use_my_sqrt_
unsigned long my_sqrt();
#endif
extern u16 pool[];
@ -57,23 +45,19 @@ void pedometer()
u8 i;
signed long temp1,temp2,temp3;
signed long temp4,temp5,temp6;
u16 sx16 = abs( (u16)vreg_ctr[VREG_C_ACC_XH] * 256 + vreg_ctr[VREG_C_ACC_XL] );
u16 sy16 = abs( (u16)vreg_ctr[VREG_C_ACC_YH] * 256 + vreg_ctr[VREG_C_ACC_YL] );
u16 sz16 = abs( (u16)vreg_ctr[VREG_C_ACC_ZH] * 256 + vreg_ctr[VREG_C_ACC_ZL] );
// ベクトルのノルム
#ifdef _mcu_
# ifndef _use_my_sqrt_
norm_hist[ hist_indx & TAP-1 ] = sqrt( (long)sx16 * ( sx16 / 2 ) +
(long)sy16 * ( sy16 / 2 ) +
(long)sz16 * ( sz16 / 2 )
);
# else
norm_hist[ hist_indx & TAP-1 ] = my_sqrt( (long)sx16 * ( sx16 / 2 ) +
(long)sy16 * ( sy16 / 2 ) +
(long)sz16 * ( sz16 / 2 )
);
# endif
#endif
#ifdef _pc_
@ -218,7 +202,6 @@ static void hosu_increment()
// 空白の時間を考慮する。1時間以上放置されたなど。
u16 now_hour;
u8 now_year;
u8 now_min;
// 時計を止める必要が有るので↓は一気に行って下さい
DI();
@ -228,7 +211,6 @@ static void hosu_increment()
last_hour = HOUR; // 履歴読み出し時に使用。BCDのままでよい
last_day = DAY;
last_month = MONTH;
now_min = MIN;
now_hour = get_long_hour();
// RWAIT = 0; ↑で行っています
// EI(); 〃
@ -261,26 +243,13 @@ static void hosu_increment()
last_hour_fny = now_hour;
// 実際にインクリメント
if( pool[ p_record ] == HOSU_NODATA )
{
u8 temp;
temp = p_record;
if( now_min < vreg_ctr[ VREG_C_ACC_HOSU_HOUR_BOUNDARY ] )
{
temp -= 1;
if( PEDOMETER_LOG_SIZE >= temp )
{
temp = PEDOMETER_LOG_SIZE -1;
}
}
if( pool.vreg_c_ext.pedo_log[ temp ] == HOSU_NODATA )
{
pool.vreg_c_ext.pedo_log[ temp ] = 1;
}
else if( pool.vreg_c_ext.pedo_log[ temp ] != HOSU_MAX )
{
pool.vreg_c_ext.pedo_log[ temp ] += 1;
}
pool[ p_record ] = 1;
}
else if( pool[ p_record ] != HOSU_MAX )
{
pool[ p_record ] += 1;
}
}
}
@ -293,20 +262,16 @@ static void hosu_increment()
======================================================== */
void fill_hosu_hist_hours( u16 hours )
{
if( hours > PEDOMETER_LOG_SIZE )
if( hours > 255 )
{
hours = PEDOMETER_LOG_SIZE;
hours = 0;
}
// 空白の数時間の設定
do
{
p_record += 1;
if( PEDOMETER_LOG_SIZE >= p_record )
{
p_record = 0;
}
pool.vreg_c_ext.pedo_log[ p_record ] = 0;
pool[ p_record ] = 0;
hours -= 1;
}
while( hours != 0 );
@ -320,11 +285,12 @@ void fill_hosu_hist_hours( u16 hours )
======================================================== */
void clear_hosu_hist()
{
u8 hours = PEDOMETER_LOG_SIZE;
u8 hours = 0;
// ó”Ì<E2809A>”ŽžŠÔÌ<E2809A>Ýè
do
{
pool[ hours ] = 0xFFFF;
hours -= 1;
pool.vreg_c_ext.pedo_log[ hours ] = 0xFFFF;
}
while( hours != 0 );
vreg_ctr[ VREG_C_ACC_HOSU_L ] = 0;
@ -383,7 +349,7 @@ u8 hosu_read( )
return( 0xAA ); // reserved. dummy
default:
temp = pool.vreg_c_ext.pedo_log[ p_record_buffer ];
temp = pool[ p_record_buffer ];
if( record_read_msb_lsb == 0 )
{
dat = (u8)( temp & 0x00FF );
@ -391,14 +357,7 @@ u8 hosu_read( )
else
{
dat = (u8)(( temp >> 8 ) & 0x00FF );
if( p_record_buffer == 0 )
{
p_record_buffer = PEDOMETER_LOG_SIZE-1;
}
else
{
p_record_buffer -= 1;
}
p_record_buffer -= 1;
}
record_read_msb_lsb += 1;
return( dat );
@ -412,7 +371,7 @@ u8 hosu_read( )
u16 long_hour
======================================================== */
const u16 DAYS_FROM_HNY[] = {
static const u16 DAYS_FROM_HNY[] = {
0,
0, 31, 31+28, 59+31, 90+30,
120+31, 151+30, 181+31, 212+31, 243+30,
@ -450,102 +409,3 @@ u16 get_long_hour()
return( long_hour );
}
# ifdef _use_my_sqrt_
// ========================================================
// 高速?平方根アルゴリズム
// ========================================================
#if 0
// 拝借もと
// ttp://www.finetune.co.jp/~lyuka/technote/fract/sqrt_hypot.html
/* NAME
* sqrtl - square root function
* SYNOPSYS
* long
* sqrtl(long x)
* DISCRIPTIONS
* The sqrtl() function compute the non-negative square root of x.
* ERROR
* Below 1/2 LSB.
* SEE ALSO
* sqrt(3), http://www.finetune.co.jp/~lyuka/fract/sqrt_hypot.html
* COPYRIGHT
* Copyright 2002, Takayuki HOSODA. All rights reserved.
*/
unsigned long my_sqrt( unsigned long a )
{
unsigned long x;
unsigned long t;
unsigned long s;
unsigned char scale;
x = a;
if (x > 0) {
scale = 0;
if (x < 0x8000) {
x <<= 16;
scale = 8;
a = x;
}
x >>= 8;
s = 8;
for (t = 0x400000L; x < t; t >>= 2)
s--;
t = 88;
t <<= s;
x *= 22;
s += 5;
x >>= s; // -3.1e-2 < err < +2.9e-2
/* 打ち切り
s = a;
t += x;
x = s;
s /= t;
s += t;
s >>= 1; // -4.8e-4 < err <= 0
t = x;
x /= s;
x += s;
x >>= 1; // -1.2e-7 < err <= 0
s = x;
s++;
s *= x;
if (t > s) // adjust LSB
x++;
*/
if (scale) {
x += 127;
x >>= 8;
}
}
return x;
}
#endif
#if 1
// 拝借もと
// ttp://www001.upp.so-net.ne.jp/y_yutaka/labo/math_algo/math_algo.html
unsigned long my_sqrt(unsigned long x)
{
unsigned long s, t;
if (x <= 0) return 0;
s = 1;
t = x;
while (s < t)
{
s <<= 1;
t >>= 1;
}
do
{
t = s;
s = (x / s + s) >> 1;
} while (s < t);
return t;
}
#endif
#endif

View File

@ -2,21 +2,98 @@
#define _pedo_
// =========================================================
void hosu_read_end( );
u8 hosu_read( );
void fill_hosu_hist_hours( u16 );
void clear_hosu_hist();
// =========================================================
#define TAP 64
#define FIL_COEFF_QUANT 10
static const s8 lpf_coeff[]={
/*
Window Function Algorithm LPF
Sampling Frequency = 100.0
cutoff1 = 6.0000000
Tap Count =64
Kaiser Constant = 7.000000
Quantized by 11 [bits]
*/
/* 0,// [0]
0,
0,
0,
0,
0,
0,
0,
*/
1,// 8
2,
2,
3,
3,
2,
0,
-2,
-5,// 16
-9,
-13,
-16,
-16,
-13,
-6,
4,
18,// 24
37,
56,
77,
95,
110,
119,
122,
119,// 32
110,
95,
77,
56,
37,
18,
4,
-6,// 40
-13,
-16,
-16,
-13,
-9,
-5,
-2,
0,// 48
2,
3,
3,
2,
2,
1,
/*
0,
0,// 56
0,
0,
0,
0,
0,
0,
0
*/
};
// */
// =========================================================
void pedometer();
// =========================================================
#define PEDOMETER_LOG_SIZE ( 24 * 7 )
// =========================================================
static void hosu_increment();
#endif

File diff suppressed because it is too large Load Diff

View File

@ -2,20 +2,12 @@
#define __PM__
#define IIC_SLA_PMIC 0x84
#define IIC_SLA_BT_GAUGE 0x6C
#define BATT_TH_LO 8
#define BATT_TH_EMPTY 3
#define VCOM_DEFAULT_T 92
#define VCOM_DEFAULT_B 95
//=========================================================
enum PMIC_REG_ADRS
{
@ -42,20 +34,12 @@ enum BT_GAUGE_REG_ADRS
BT_GAUGE_REG_COMMAND = 0xFE
};
typedef enum
enum BT_VENDER
{
BT_VENDER_MAXELL = 0, // ƒVƒ‡<C692>[ƒg
BT_VENDER_1, // 120
BT_VENDER_2, // 360
BT_VENDER_3, // 750
BT_VENDER_4, // 1.3k
BT_VENDER_PANA = 5, // 2.7k
BT_VENDER_6, // 8.2k
BT_VENDER_OPEN = 7, // open
BT_VENDER_NOT_CHECKED = 0xFF,
}BT_VENDER;
BT_VENDER_SHIROBAKO = 0,
BT_VENDER_PANA = 3,
BT_VENDER_MAXELL = 7
};
//=========================================================
@ -82,7 +66,7 @@ typedef enum
#define PM_REG_BIT_VDD50A ( 1 << 4 )
// 0x02 pw cnt2
#define PM_REG_BIT_VDDLCD 0x07
#define PM_REG_BIT_VDDLCD 0x07
#define PM_REG_BIT_LCD_VCS ( 0x01 << 4 )
#define PM_REG_BIT_LCD_TCOM ( 0x01 << 3 )
@ -99,9 +83,9 @@ typedef enum
#define PM_REG_BIT_VDD_PWM 0b00000000
#define DELAY_PM_TW_PWUP 16 + 2
#define DELAY_PM_TSS_50B_AND_TCOM 17 + 1
#define DELAY_PM_5V_TO_TCOM 17 + 1
#define DELAY_PM_TW_PWUP 16
#define DELAY_PM_TSS_50B_AND_TCOM 17
#define DELAY_PM_5V_TO_TCOM 17
#define DELAY_PM_TCOM_TO_VCS 3
#define DELAY_PM_VCS_TO_BL ( 17 + 5 )
#define DELAY_PM_LCD_OFF ( 50 + 1 )
@ -109,25 +93,20 @@ typedef enum
//=========================================================
extern u8 raw_adc_temperature;
extern BT_VENDER battery_manufacturer;
//=========================================================
err PM_sys_pow_on( );
err PM_sys_pow_off( );
err PM_bt_auth( );
void PM_init( );
err PM_LCD_vcom_set( );
err PM_LCD_on( );
void PM_LCD_off( );
err PM_BL_set( u8 );
void BT_init( );
void BT_get_left();
task_status_immed BT_temp_update( );
task_status_immed PM_bt_temp_update( );
task_status_immed tski_vcom_set( );
task_status_immed tski_PM_LCD_on();
task_status_immed tski_PM_LCD_off();
@ -156,9 +135,17 @@ task_status_immed tski_PM_BL_set();
#define PM_VDD_normMode() ( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_POW_SAVE, PM_REG_BIT_VDD1P_1R15 | PM_REG_BIT_VDD_PWM ))
#define PM_VDD_ecoMode() ( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_POW_SAVE, PM_REG_BIT_VDD1P_0R90 | PM_REG_BIT_VDD_AUTO ))
#else
// {”Ôƒ`ƒbƒvÒ¿
#ifdef _PM_BUG_
#define PM_VDD_ecoMode() ( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_POW_SAVE, PM_REG_BIT_VDD1P_0R90 | PM_REG_BIT_VDD_AUTO ))
#define PM_VDD_normMode() ( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_POW_SAVE, PM_REG_BIT_VDD1P_1R10 | PM_REG_BIT_VDD_PWM ))
#else
#define PM_VDD_ecoMode() ( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_POW_SAVE, PM_REG_BIT_VDD1P_1R05 | PM_REG_BIT_VDD_AUTO ))
#define PM_VDD_normMode() ( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_POW_SAVE, PM_REG_BIT_VDD1P_1R05 | PM_REG_BIT_VDD_PWM ))
#endif
#endif
// ‚Ù‚© //

View File

@ -193,16 +193,11 @@ err renge_task_immed_run(){
else
#endif
{
u8 temp;
temp = tasks_immed[ list_id ]();
DI();
if( temp == ERR_SUCCESS )
if( tasks_immed[ list_id ]() == ERR_SUCCESS )
{
tasks_immed[ list_id ] = TSK_IMM_DELETED_;
}
last_task_id = list_id;
EI();
}
}
#ifdef _renge_test_
@ -226,6 +221,12 @@ err renge_task_immed_run(){
if( last_task_id != 0xFF )
{
u8 i,j;
#ifdef _renge_test_
if ( tasks_immed[ 1 ] != 0 ){
NOP();
}
#endif
// リスト前詰め
i = 0; // 前詰め後リストの最後尾
@ -253,6 +254,7 @@ err renge_task_immed_run(){
}
}
#endif
EI();
break;
}
if( tasks_immed[ j ] != TSK_IMM_DELETED_ )
@ -285,6 +287,7 @@ err renge_task_immed_run(){
// リストの最後だった
}
}
DI();
// ここまでで完全に前詰めされている
for( j = 0; j < TASK_IMMED_RUN_LIST_MAX; j++ )
@ -292,6 +295,7 @@ err renge_task_immed_run(){
if( tasks_immed[ j ] == TSK_IMM_EMPTY_ )
{
#ifdef _renge_test_
NOP();
j += 1;
for( ; j < TASK_IMMED_RUN_LIST_MAX; j++ )
{
@ -304,15 +308,13 @@ err renge_task_immed_run(){
break;
// リストの最後
}
DI();
if( tasks_immed[ j ] == TSK_IMM_DELETED_ )
{
tasks_immed[ j ] = TSK_IMM_EMPTY_;
}
EI();
}
EI();
}
EI();
}
}
#if 0
@ -345,7 +347,11 @@ void wait_ms( u8 ms ){
// まだ適当です!
while( ms != 0 ){
ms--;
#ifdef _OVERCLOCK_
fine = 860;
#else
fine = 430;
#endif
while( fine != 0 ){
fine -= 1;
}

View File

@ -29,8 +29,7 @@ typedef unsigned char err;
// ************************************
typedef enum{
ERR_SUCCESS = 0,
ERR_ERR,
ERR_SYSTEM_OFF
ERR_ERR
}ERR;

View File

@ -50,10 +50,11 @@ tasklist.each{|dat|
}
conf << "\n"
conf << "const void ( *tasks[ TSK_LAST ] )() = {\n"
conf << "static const task_status ( *tasks[ TSK_LAST ] )() = {\n"
tasklist.each{|dat|
conf << " tsk_" << dat << ",\n"
}
conf << " };\n"
conf << "\n#endif\n"
conf << "\n\n#endif\n"

View File

@ -1,40 +1,39 @@
/*スクリプトによる自動生成です。手動で書き換えない方がよいです*/
#ifndef __renge_task__
#define __renge_task__
#include "renge_defs.h"
enum {
TSK_SW, TSK_ADC, TSK_BATT, TSK_LED_POW, TSK_LED_WIFI, TSK_LED_NOTIFY, TSK_LED_CAM, TSK_MISC, TSK_STATUS, TSK_DEBUG, TSK_DEBUG2, TSK_SYS, TSK_LAST
};
extern void tsk_sw();
extern void tsk_adc();
extern void tsk_batt();
extern void tsk_led_pow();
extern void tsk_led_wifi();
extern void tsk_led_notify();
extern void tsk_led_cam();
extern void tsk_misc();
extern void tsk_status();
extern void tsk_debug();
extern void tsk_debug2();
extern void tsk_sys();
const void ( *tasks[ 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_debug,
tsk_debug2,
tsk_sys,
};
#endif
/*スクリプトによる自動生成です。手動で書き換えない方がよいです*/
#ifndef __renge_task__
#define __renge_task__
#include "renge_defs.h"
enum {
TSK_SW, TSK_ADC, TSK_BATT, TSK_LED_POW, TSK_LED_WIFI, TSK_LED_NOTIFY, TSK_LED_CAM, TSK_MISC_STAT, TSK_DEBUG, TSK_DEBUG2, TSK_SYS, TSK_LAST
};
extern void tsk_sw();
extern void tsk_adc();
extern void tsk_batt();
extern void tsk_led_pow();
extern void tsk_led_wifi();
extern void tsk_led_notify();
extern void tsk_led_cam();
extern void tsk_misc_stat();
extern void tsk_debug();
extern void tsk_debug2();
extern void tsk_sys();
static const task_status ( *tasks[ TSK_LAST ] )() = {
tsk_sw,
tsk_adc,
tsk_batt,
tsk_led_pow,
tsk_led_wifi,
tsk_led_notify,
tsk_led_cam,
tsk_misc_stat,
tsk_debug,
tsk_debug2,
tsk_sys,
};
#endif

View File

@ -5,8 +5,7 @@ led_pow
led_wifi
led_notify
led_cam
misc
status
misc_stat
debug
debug2
sys

View File

@ -15,7 +15,6 @@
#include "fsl_user.h"
#include "i2c_ctr.h"
#include "pool.h"
// ========================================================
@ -25,7 +24,6 @@ const u8 fsl_low_voltage_u08 = 1;
// 自己フラッシュパラメータ
#define SAM_BLOCK_SIZE 1024
// ↓256バイト以上はまとめてかけません。
#define SELF_UPDATE_BUFF_SIZE 256
#define SELF_UPDATE_SPLIT_WRITE_NUM ( SAM_BLOCK_SIZE / SELF_UPDATE_BUFF_SIZE )
#define SAM_WORD_SIZE 4
@ -38,6 +36,8 @@ const u8 fsl_low_voltage_u08 = 1;
#ifdef _MCU_BSR_
#define ACKD ACKD1
#define ACKE ACKE1
#define COI COI1
@ -69,15 +69,15 @@ const u8 fsl_low_voltage_u08 = 1;
// ========================================================
static void FSL_Open( void );
static void FSL_Close( void );
void firm_restore( );
err firm_restore( );
static err my_FSL_Init();
static err firm_duplicate( u8 block_src, u8 block_dest );
static err firm_duplicate( __far u8 * p_rom, u8 block_dest );
// ========================================================
extern uni_pool pool;
extern u16 pool[];
// 0.D以降 新アップデータ向け
@ -93,7 +93,7 @@ extern uni_pool pool;
    NG  
======================================================== */
void firm_update( )
err firm_update( )
{
u8 target_block;
u8 split_write_count; // ブロックへちまちま書き込むカウンタ
@ -102,12 +102,11 @@ void firm_update( )
my_FSL_Init();
/* ファームのバックアップ
( FIRM_SIZE)
0x2000 - 0x4FFF
0x5000 - 0x7FFF ( 20 - 31)
*/
firm_duplicate( FIRM_TOP,
UPDATE_BLOCK_LAST +1 );
firm_duplicate( ( __far u8 * ) 0x2000,
( 0x5000 / 0x0400 ) );
// 全ブロック削除 /////////////////////////////////////
// 電源断を判定するため、最初に全クラスタ消去する
@ -135,51 +134,46 @@ void firm_update( )
&& ( !SPD ) );
split_write_count += 1 )
{
u8* p_buffer = &pool.self_update_work[0];
u16 buff_written_size = 0;
u8* p_buffer = pool;
u8 buffer_fill = 0;
WDT_Restart( );
// I2Cから書き込みデータをバッファにためる
do
{
while( !IICAIF && !SPD )
{
WDT_Restart( );
}
while( !IICAIF && !SPD ){;}
IICAIF = 0;
*p_buffer = IICA;
WREL = 1;
p_buffer += 1;
buff_written_size += 1;
buffer_fill += 1;
}
while( ( buff_written_size != SELF_UPDATE_BUFF_SIZE )
&& !SPD );
while( ( buffer_fill != ( u8 ) SELF_UPDATE_BUFF_SIZE ) && !SPD );
// 書き込み
// 最後だと、ゴミをパディングするが別にかまわない
if( FSL_Write( ( fsl_u32 ) ( target_block * SAM_BLOCK_SIZE
+ split_write_count * SELF_UPDATE_BUFF_SIZE ),
( fsl_u08 ) ( SELF_UPDATE_BUFF_SIZE / SAM_WORD_SIZE ) )
+
split_write_count *
SELF_UPDATE_BUFF_SIZE ),
( fsl_u08 ) ( SELF_UPDATE_BUFF_SIZE / SAM_WORD_SIZE ) )
!= FSL_OK )
{
// 書き込み後のチェックエラー
// リストア
firm_duplicate( UPDATE_BLOCK_LAST +1,
FIRM_TOP );
FSL_ForceReset();
// 戻ってこない //
// リブートののち、リストア
// FSL_ForceReset(); // リセット
FSL_SwapBootCluster( );
// FSL_Close( );
return ( ERR_ERR );
}
}
// 1ブロック書き込み完了。内部ベリファイを行う
if( FSL_IVerify( target_block ) != FSL_OK ){
// 再度消去→書き込み ベリファイを繰り返すだけじゃダメでした... todo…
// リストア
firm_duplicate( UPDATE_BLOCK_LAST +1,
FIRM_TOP );
FSL_ForceReset();
// 戻ってこない //
// todo 再度消去→書き込み ベリファイを繰り返すだけじゃダメでした...
NOP();
}
if( SPD )
@ -202,18 +196,19 @@ void firm_update( )
}
if( comp == 0 )
{
// OK!
FSL_InvertBootFlag( );
FSL_SwapBootCluster( ); // リセットせずに頭から。FSL_Closeは不要
// FSL_ForceReset(); // リセット
// FSL_SwapActiveBootCluster(); // ←スワップされてしまうので、続けられず暴走!
// 戻ってこない //
}
else
{
// データ(マジックナンバーしか見てない)エラー
// リストア
firm_duplicate( UPDATE_BLOCK_LAST,
FIRM_TOP );
FSL_ForceReset(); // リセット
// データエラー
// リブートののち、リストア
// FSL_ForceReset(); // リセット
FSL_SwapBootCluster( );
// FSL_Close( );
// 戻ってこない //
}
}
@ -228,7 +223,7 @@ void firm_update( )
 
======================================================== */
void firm_restore( )
err firm_restore( )
{
my_FSL_Init();
@ -236,14 +231,17 @@ void firm_restore( )
0x4800 - 0x7FFF ( 18 - 27)
0x2000 - 0x47FF ( 8 - 17)
*/
firm_duplicate( UPDATE_BLOCK_LAST +1,
firm_duplicate( ( __far u8 * ) 0x5000,
FIRM_TOP );
// todo
//  リストア失敗したら、LEDちかちかとかさせて、サービス送りにしてもらう
// リブート
FSL_InvertBootFlag( );
// スワップは不要です!
FSL_SwapBootCluster();
// FSL_ForceReset( );
return ( ERR_SUCCESS );
}
@ -268,7 +266,9 @@ static void FSL_Open( void )
MK2H = FSL_MK2H_MASK; /* } */
#endif
while( DST1 ){;} // DMA停止
// 何か前準備?
// todo DMAを止める
while( DST1 ){;}
DEN1 = 0;
MK0 = 0xFFFF;
@ -308,14 +308,11 @@ static void FSL_Close( void )
my_FSL_Initをあらかじめ実行する必要があります
======================================================== */
//static err firm_duplicate( __far u8 * p_rom,
// u8 block_dest )
static err firm_duplicate( u8 block_src,
u8 block_dest )
static err firm_duplicate( __far u8 * p_rom,
u8 block_dest )
{
u8 target_block;
u8 split_write_count; // ブロックへちまちま書き込むカウンタ
__far u8* p_src = ( __far u8* )( block_src * 0x400 );
// 書き込み先ブロックの数だけ繰り返す
for( target_block = block_dest;
@ -334,28 +331,29 @@ static err firm_duplicate( u8 block_src,
split_write_count < SELF_UPDATE_SPLIT_WRITE_NUM;
split_write_count += 1 )
{
u16 buff_written_size;
u8 buffer_fill;
u8* p_buff;
// 書き込みデータをバッファにためる
buff_written_size = 0;
p_buff = &pool.self_update_work[0];
buffer_fill = 0;
p_buff = pool;
do
{
*p_buff = *p_src;
p_src += 1;
*p_buff = *p_rom;
p_rom += 1;
p_buff += 1;
buff_written_size +=1;
buffer_fill +=1;
}
while( buff_written_size != SELF_UPDATE_BUFF_SIZE );
while( buffer_fill != ( u8 ) SELF_UPDATE_BUFF_SIZE );
// 書き込み
if( FSL_Write( ( fsl_u32 ) ( target_block * SAM_BLOCK_SIZE
+ split_write_count * SELF_UPDATE_BUFF_SIZE ),
( fsl_u08 ) ( SELF_UPDATE_BUFF_SIZE / SAM_WORD_SIZE ) )
+
split_write_count *
SELF_UPDATE_BUFF_SIZE ),
( fsl_u08 ) ( SELF_UPDATE_BUFF_SIZE / SAM_WORD_SIZE ) )
!= FSL_OK )
{
// todo リカバリ? //
FSL_Close( );
return ( ERR_ERR );
}
@ -363,7 +361,7 @@ static err firm_duplicate( u8 block_src,
// 1ブロック書き込み完了。内部電圧チェックを行う
while( FSL_IVerify( target_block ) != FSL_OK ){
// todo 失敗時?
// todo
;
}
}
@ -383,7 +381,7 @@ static err my_FSL_Init()
DI( );
FSL_Open( ); // 割り込み禁止など
FSL_Init( &pool.self_update_work[0] ); // ライブラリ初期化。割り込み中断考慮せず
FSL_Init( pool ); // ライブラリ初期化。割り込み中断考慮せず
FSL_ModeCheck( ); // ライトプロテクトチェック。失敗することを考慮せず
return( ERR_SUCCESS );
@ -394,12 +392,11 @@ task_status_immed tski_mcu_reset()
{
// 普通に再起動
my_FSL_Init();
FSL_SwapBootCluster();
FSL_ForceReset(); // リセット
FSL_Close( );
// FSL_SwapBootCluster();
FSL_ForceReset(); // リセット
// 保険? //
// WDTE = 0xAA; // WDTで再起動テスト向け
WDTE = 0xAA; // WDTで再起動テスト向け
return( ERR_SUCCESS ); // no reach
}

View File

@ -8,30 +8,26 @@
#include "i2c_twl.h"
#include "i2c_ctr.h"
#include "led.h"
#include "accero.h"
#include "pm.h"
#include "rtc.h"
//=========================================================
#define INTERVAL_TSK_SW 8
#define CLICK_THRESHOLD 2
#define INTERVAL_TSK_SW 16
#define CLICK_THRESHOLD 1
#define HOLD_THREASHOLD (u8)( 600 / INTERVAL_TSK_SW )
#ifdef _FOR_E3_
#define HOLD_THREASHOLD (u8)( 800 / INTERVAL_TSK_SW )
#else
#define HOLD_THREASHOLD (u8)( 2000 / INTERVAL_TSK_SW )
#endif
//=========================================================
u8 SW_pow_count;
bit SW_pow_mask;
u8 SW_home_count, SW_wifi_count;
u8 SW_pow_count, SW_home_count, SW_wifi_count;
bit SW_pow_mask, SW_home_mask, SW_wifi_mask;
bit SW_HOME_n;
//=========================================================
// 押した時間を数える。押しっぱなしでも0に戻らない
// maskが非0の時は、一度離すまで無視する
@ -51,24 +47,6 @@ bit SW_HOME_n;
}
#define chk_clicked( button, count, irq_bit_name ) \
if( !button ) \
{ \
if( count <= CLICK_THRESHOLD ) \
{ \
count += 1; \
} \
if( count == CLICK_THRESHOLD ) \
{ \
set_irq( VREG_C_IRQ0, irq_bit_name ); \
} \
} \
else \
{ \
count = 0; \
}
/* ========================================================
@ -76,14 +54,24 @@ bit SW_HOME_n;
======================================================== */
void tsk_sw( )
{
static u16 cnt_force_off = 0;
static u8 cnt_force_off = 0;
static u8 task_interval = 0;
switch ( system_status.pwr_state )
{
case ( ON_TRIG ):
case ( OFF_TRIG ):
SW_pow_count = 0;
SW_wifi_count = 0;
SW_home_count = 0;
cnt_force_off = 0;
break;
case ( ON_TRIG ):
// 電源投入
SW_pow_mask = 1;
SW_home_mask = 1;
SW_wifi_mask = 1;
break;
}
if( task_interval-- != 0 )
@ -95,6 +83,7 @@ void tsk_sw( )
task_interval = (u8)( INTERVAL_TSK_SW / SYS_INTERVAL_TICK );
}
switch ( system_status.pwr_state )
{
case ( ON ):
@ -102,10 +91,9 @@ void tsk_sw( )
case ( BT_CHARGE ):
case ( OFF ):
// 電源スイッチの監視 //
count_sw_n( SW_POW_n, SW_pow_count, SW_pow_mask ); // ボタン押し時間のカウント
if( SW_POW_n )
{
if( SW_pow_count == CLICK_THRESHOLD )
if( ( CLICK_THRESHOLD < SW_pow_count ) && ( SW_pow_count <= HOLD_THREASHOLD ) )
{
#ifdef _SW_HOME_ENABLE_
set_irq( VREG_C_IRQ0, REG_BIT_SW_POW_CLICK );
@ -121,45 +109,81 @@ void tsk_sw( )
#else
set_irq( VREG_C_IRQ0, REG_BIT_SW_HOME_HOLD );
#endif
cnt_force_off = 1;
}
else if( SW_pow_count == (u8)( 1000 / INTERVAL_TSK_SW ))
{ // todo
vreg_ctr[ VREG_C_LED_POW ] = LED_POW_ILM_ONLY_RED;
system_status.pwr_state = OFF_TRIG;
renge_task_interval_run_force = 1;
}
if( cnt_force_off != 0 )
// 電源OFF割り込みを入れたが…
if( ( vreg_ctr[VREG_C_IRQ0] & REG_BIT_SW_POW_HOLD ) != 0 )
{
#ifdef _FOR_E3_
if( ++cnt_force_off == ( 200 / INTERVAL_TSK_SW ) )
#else
if( ++cnt_force_off == ( 4000 / INTERVAL_TSK_SW ) )
#endif
{
// タイムアウトによる強制OFF
cnt_force_off = 0;
cnt_force_off += 1;
if( cnt_force_off >= 13 )
{ // …返事がない。強制的に切る。
vreg_ctr[ VREG_C_LED_POW ] = LED_POW_ILM_ONLY_RED;
system_status.pwr_state = OFF_TRIG;
renge_task_interval_run_force = 1;
}
}
else
{
cnt_force_off = 0;
}
#ifdef _SW_HOME_ENABLE_
// HOME スイッチ //
switch( system_status.model )
{
# ifdef _MODEL_CTR_
#ifdef _MODEL_CTR_
case( MODEL_JIKKI ):
SW_HOME_n = SW_HOME_n_JIKKI;
break;
# endif
#endif
case( MODEL_TS_BOARD ):
case( MODEL_SHIROBAKO ):
SW_HOME_n = SW_HOME_n_TSBOARD;
break;
default:
SW_HOME_n = 1; // 放されてる状態
SW_HOME_n = 1;
}
if( SW_HOME_n )
{
if( ( CLICK_THRESHOLD < SW_home_count ) && ( SW_home_count <= HOLD_THREASHOLD ) )
{
set_irq( VREG_C_IRQ0, REG_BIT_SW_HOME_CLICK );
}
}
else if( SW_home_count == HOLD_THREASHOLD )
{
set_irq( VREG_C_IRQ0, REG_BIT_SW_HOME_HOLD );
}
chk_clicked( SW_HOME_n, SW_home_count, REG_BIT_SW_HOME_CLICK );
#endif
// wifi sw //
chk_clicked( SW_WIFI_n, SW_wifi_count, REG_BIT_SW_WIFI_CLICK );
if( SW_wifi_count == CLICK_THRESHOLD )
{
set_irq( VREG_C_IRQ0, REG_BIT_SW_WIFI_CLICK );
}
break;
}
// ボタン押し時間のカウント
/*
if( ( system_status.pwr_state == ON )
|| ( system_status.pwr_state == OFF )
|| ( system_status.pwr_state == BT_CHARGE ) )
*/
{
count_sw_n( SW_POW_n, SW_pow_count, SW_pow_mask );
#ifdef _SW_HOME_ENABLE_
count_sw_n( SW_HOME_n, SW_home_count, SW_home_mask );
#endif
count_sw_n( SW_WIFI_n, SW_wifi_count, SW_wifi_mask );
}
return;
}

View File

@ -1,7 +1,7 @@
#ifndef _sw_
#define _sw_
extern u8 SW_pow_count;
extern bit SW_pow_mask;
extern u8 SW_pow_count, SW_home_count, SW_wifi_count;
extern bit SW_pow_mask, SW_home_mask, SW_wifi_mask;
#endif

View File

@ -7,6 +7,8 @@
#include "renge.h"
#include "pm.h"
#include "accero.h"
/* ========================================================
======================================================== */
@ -19,7 +21,7 @@ void tsk_debug( )
if( system_status.pwr_state == ON_TRIG ){
#ifdef _MODEL_WM0_
P5.0 = 1; // /WL_RST に配線されています
PM_CHG_TIMEOUT_DISABLE(); // /WL_RST に配線されています
#endif
#ifndef _MODEL_CTR_
iic_mcu_write_a_byte( IIC_SLA_DCP, 0x08, 0x80 ); // ACR<43>©0x80 Šö”­ƒ<C692>[ƒhÖ
@ -35,16 +37,12 @@ void tsk_debug( )
return;
}
// 7セグ 4バイト版
# define IIC_SLA_DBG_MONITOR 0x44
u8 temp_debug_3;
void tsk_debug2( )
{
u8 str[4];
if( ( system_status.pwr_state == ON ) || ( system_status.pwr_state == SLEEP ) )
{
/*
@ -68,7 +66,9 @@ void tsk_debug2( )
// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 1, vreg_ctr[ VREG_C_STATUS ] );
// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 0, vreg_ctr[ VREG_C_ACC_ZH ] );
// iic_mcu_write( IIC_SLA_DBG_MONITOR, 0, 4, &str[0] );
// memo E3用
iic_mcu_write( 0x24, 0, 4, &str[0] );
// iic_mcu_write( IIC_SLA_DBG_MONITOR, 0, 4, &str[0] );
}
return;
}

View File

@ -44,23 +44,21 @@
// ========================================================
bit twl_ver_read;
// ========================================================
#define INTERVAL_TSK_MISC_STAT 4
/* ========================================================
======================================================== */
void tsk_misc( )
void tsk_misc_stat( )
{
/*
static u8 interval_task_misc = 0;
static u8 interval_task_misc_stat = 0;
static u8 state_old; // ステータス変化検出→割り込み の為
#ifdef _BL_INDEPENDENT_
static u8 state2_old;
#endif
u8 diff;
if( interval_task_misc_stat != 0 )
{
@ -71,49 +69,78 @@ void tsk_misc( )
{
interval_task_misc_stat = ( INTERVAL_TSK_MISC_STAT / SYS_INTERVAL_TICK );
}
*/
//#ifdef _MCU_KE3_
// KE3では必須です。
/* ========================================================
BSRマイコンはaccero.cで割り込みルーチンからタスク登録します
======================================================== */
// 割り込みの取りこぼし?
if( ( vreg_ctr[VREG_C_ACC_CONFIG] & 0x03 ) != 0x00 )
set_bit( SHELL_OPEN, vreg_ctr[VREG_C_STATUS], REG_BIT_ST_SHELL_OPEN );
// ステータスレジスタ関係 → 割り込み //
if( ( system_status.pwr_state == ON ) || ( system_status.pwr_state == SLEEP ) )
{
if( ACC_VALID == 1 )
// pm.c で、その場で行います。
// REG_BIT_LCD_ON/OFF
// REG_BIT_BL_ON/OFF
// REG_BIT_BT_DC_CONNECT/DISC
diff = vreg_ctr[VREG_C_STATUS] ^ state_old;
if( diff != 0 )
{
if( renge_task_immed_add( tsk_cbk_accero ) == ERR_SUCCESS ){
NOP();
state_old = vreg_ctr[VREG_C_STATUS];
if( diff & REG_BIT_BATT_CHARGE )
{
// 充電状態に以下略
if( vreg_ctr[VREG_C_STATUS] & REG_BIT_BATT_CHARGE )
{
set_irq( VREG_C_IRQ1, REG_BIT_BT_CHG_START );
}
else
{
set_irq( VREG_C_IRQ1, REG_BIT_BT_CHG_STOP );
}
}
if( diff & REG_BIT_ST_SHELL_OPEN )
{
// 蓋の開け閉め
if( vreg_ctr[VREG_C_STATUS] & REG_BIT_ST_SHELL_OPEN )
{
set_irq( VREG_C_IRQ0, REG_BIT_SHELL_OPEN );
}
else
{
set_irq( VREG_C_IRQ0, REG_BIT_SHELL_CLOSE );
}
}
}
//#ifdef _MCU_KE3_
// KE3では必須です。
/* ========================================================
BSRマイコンはaccero.cで割り込みルーチンからタスク登録します
======================================================== */
// 割り込みの取りこぼし?
if( ( vreg_ctr[VREG_C_ACC_CONFIG] & 0x03 ) != 0x00 )
{
if( ACC_VALID )
{
if( renge_task_immed_add( tsk_cbk_accero ) == ERR_SUCCESS ){
NOP();
}
}
}
}
//#endif
if( system_status.pwr_state == ON )
{
/* ========================================================
PM互換レジスタへの書き込み
...
todo
======================================================== */
// 割り込みの取りこぼし?
if( !PM_IRQ_n ){
renge_task_immed_add( ntr_pmic_comm );
NOP();
}
/* ========================================================
TWLランチャーが起動したことをCTRが知りたいらしい
======================================================== */
if( twl_ver_read )
{
twl_ver_read = 0;
set_irq( VREG_C_IRQ2, REG_BIT_TWL_VER_READ );
}
}
return;
}
@ -157,16 +184,14 @@ task_status_immed do_command0( )
FCRAM_RST_neg;
PM_reset_neg();
RESET2_neg;
// 起動時以外はリセット不要
/*
/*
// CODEC 不定レジスタ初期化
wait_ms( 100 );
{
u8 codec_reg_init[3] = { 0,0,0 };
iic_mcu_write( IIC_SLA_CODEC, CODEC_REG_PM, 3, codec_reg_init );
iic_mcu_write( IIC_SLA_CODEC, CODEC_REG_PM, 3, codec_reg_init );
}
*/
*/
}
}
@ -190,6 +215,9 @@ extern u8 iic_burst_state;
======================================================== */
task_status_immed tski_mcu_info_read()
{
u8 temp;
if( SPD )
{
goto end;
@ -208,7 +236,7 @@ task_status_immed tski_mcu_info_read()
{
IICAIF = 0;
}
switch( iic_burst_state++ ){
case( 0 ): // 本体種類識別
IICA = (u8)system_status.model;
@ -219,7 +247,9 @@ task_status_immed tski_mcu_info_read()
break;
case( 2 ): // 電池メーカーの識別
IICA = battery_manufacturer;
BT_DET_P = 1;
IICA = ( u8 ) ( get_adc( ADC_SEL_BATT_DET ) >> 5 );
BT_DET_P = 0;
break;
case( 3 ): // ガスゲージバージョン

View File

@ -13,7 +13,7 @@
#include "rtc.h"
#include "sw.h"
#include "adc.h"
#include "self_flash.h"
//=========================================================
@ -40,9 +40,10 @@ void tsk_sys( )
case OFF: //-------------------------------------------------------
// スイッチ操作などで割り込みが発生し、スリープが解除されるとここに来ます。
#ifndef _PARRADIUM_
switch ( system_status.poweron_reason )
{
case( NONE ):
default:
// スイッチで電源on
if( SW_pow_count != 0 )
@ -53,14 +54,14 @@ void tsk_sys( )
{
timeout += 1;
}
if( timeout > 100 )
if( timeout > 127 )
{
system_status.pwr_state = OFF_TRIG; // スイッチはノイズだった。寝る。
renge_task_interval_run_force = 1;
return;
}
if( SW_pow_count < 10 )
if( SW_pow_count < 3 )
{
// もう少しスイッチの様子を見る
return;
@ -69,44 +70,32 @@ void tsk_sys( )
system_status.poweron_reason = PWSW;
break;
default:
case ( RTC_ALARM ):
break;
}
SW_pow_mask = 1;
timeout = 0;
BT_DET_P = 1; // チャージに時間が掛かるので先に上げておく
BT_TEMP_P = 1;
// 電源投入 //
iic_mcu_start( );
BT_init( ); // 実機やバッテリの判定、電池残量ICの設定
if( system_status.model == MODEL_JIKKI_NOBATT )
{
renge_task_interval_run_force = 1;
system_status.pwr_state = OFF_TRIG;
return;
}
// 残量チェック
BT_get_left(); // 先に、BT_init()が実行されている必要があります。(大丈夫)
if( vreg_ctr[VREG_C_BT_REMAIN] < 5 )
{
renge_task_interval_run_force = 1;
system_status.pwr_state = OFF_TRIG;
return;
}
// ↓で電池残量ICの起動待ちウェイトなどがあります。
PM_init( ); // 電池残量ICの設定
if( PM_sys_pow_on( ) != ERR_SUCCESS )
{ // 電源起動不可エラー
renge_task_interval_run_force = 1;
iic_mcu_stop( );
system_status.pwr_state = OFF_TRIG;
return;
}
PM_CHG_TIMEOUT_ENABLE();
// IRQ0_active;
#else
vreg_ctr[ VREG_C_STATUS_1 ] |= REG_BIT_GASGAUGE_ERR;
system_status.poweron_reason = PWSW;
#endif // _PARADDIUM_
PM_LCD_vcom_set( ); // LCDの対向電圧値など書き込み
#ifdef _PMIC_TWL_
@ -122,24 +111,17 @@ void tsk_sys( )
{
// とりあえず、LED消灯状態で起動させる
vreg_ctr[VREG_C_LED_POW] = LED_POW_ILM_OFF;
// todo?
}
system_status.pwr_state = ON_TRIG;
// ここまで来ると、電源投入確定 //
// ここまで来ると、電源投入確定
break;
case ON_TRIG: //-------------------------------------------------------
LED_init( );
PU5 = 0b00000010; // 1:PM_CHARGE
PU7 = 0b00011101; // 4:SW_WIFI 3:SW_PWSW 2:PM_IRQ 0:PM_EXTDC_n
#ifdef _MODEL_CTR_
# ifdef _SW_HOME_ENABLE_
PU20 = 0b00010000; // SW_HOME
# else
PU20 = 0b00000000;
# endif
#endif
PU7 = 0b00011101; // 4:SW_WIFI 3:SW_PWSW 2:PM_IRQ 0:PM_EXTDC_n
IIC_ctr_Init( );
if( ( vreg_ctr[ VREG_C_MCU_STATUS ] & REG_BIT_STATUS_WDT_RESET )
@ -153,21 +135,6 @@ void tsk_sys( )
{
set_irq( VREG_C_IRQ0, REG_BIT_IRQ_WDT_RESET );
}
{
// WDTリセット時、I2Cの初期化まで割り込み保留
// ほんとはここにべた書きしたくないが...
if( ( vreg_ctr[ VREG_C_MCU_STATUS ] & REG_BIT_STATUS_WDT_RESET )
/*
if( vreg_ctr[ VREG_C_IRQ0 ]
| vreg_ctr[ VREG_C_IRQ0 ]
| vreg_ctr[ VREG_C_IRQ0 ]
| vreg_ctr[ VREG_C_IRQ0 ]
*/
!= 0 )
{
set_irq( VREG_C_IRQ0, REG_BIT_IRQ_WDT_RESET );
}
}
IIC_twl_Init( );
RTC_32k_on( );
@ -178,9 +145,6 @@ void tsk_sys( )
MK0 = INT_MSK0_RSV;
MK1 = INT_MSK1_RSV;
iic_mcu_start();
#ifdef _MCU_BSR_
// MK2 = ~( INT_MSK2_IIC_TWL | INT_MSK2_WIFI_TX_BSR | INT_MSK2_CODEC_PMIRQ );
// PMK21 = 0; // wifi 使わない
@ -235,11 +199,12 @@ void tsk_sys( )
case OFF_TRIG: //---------------------------------------
// LED消灯を待つ
vreg_ctr[VREG_C_LED_POW] = LED_POW_ILM_OFF;
if( LED_duty_pow_blu != 0 )
if(( LED_duty_pow_H != 0 ) || ( LED_duty_pow_L != 0 ))
{
return;
}
PM_CHG_TIMEOUT_ENABLE();
LED_stop( );
IIC_ctr_Stop( );
IIC_twl_Stop( );
@ -260,43 +225,52 @@ void tsk_sys( )
#ifdef _PMIC_TWL_
PM_TEG_LCD_dis( 1 );
#endif
while( iic_mcu_busy )
{;
// IRQ0_deactive;
// pullup_off(); ↓
{
PU5 = 0b00000011; // PM_CHG,PM_CHGERR
PU7 = 0b00011001; // SW_WiFi,PWSWI,PM_EXTTDC
}
PM_sys_pow_off( );
KRM = ( KR_SW_POW ); // Mask ではなく、Modeなのだそうだ。紛らわしい
// intp20系は後ほど
MK0 = ~( INT_MSK0_EXTDC );
MK1 = ~( INT_MSK1_KR | INT_MSK1_RTCALARM | INT_MSK1_RTCINTVAL );
MK2L = 0b11111111;
// PU5 そのまま
PU7 = 0b00001001; // PWSWI,PM_EXTTDC,( IRQ0_deactive(), PM_IRQ_deactive )
PU20 = 0x00; // SW_HOME 停止
IF0 = 0;
IF1 = 0;
IF2 = 0;
PM_sys_pow_off( );
timeout = 0;
system_status.pwr_state = BT_CHARGE;
SW_pow_mask = 1;
SW_pow_count = 0;
SW_wifi_count = 0;
// no break //
case BT_CHARGE:
system_status.pwr_state = OFF;
if( !PM_EXTDC_n )
{
// アダプタ有り:充電温度監視
BT_TEMP_P = 1;
// 電源on
if( ( SW_pow_count > 3 ) || ( SW_wifi_count > 3 )
|| ( system_status.poweron_reason == RTC_ALARM ) )
{
system_status.pwr_state = OFF; // 若干抵抗有るが...
renge_task_interval_run_force = 1;
KRMK = 1;
return;
}
return;
}
else
{
// 省電力へ移行
LED_CHARGE = 0;
BT_TEMP_P = 0;
while( RWST )
{;}
@ -305,29 +279,31 @@ void tsk_sys( )
// 割り込み待ちで寝る //
RTCIMK = 1;
#ifndef _PARRADIUM_
# ifdef _MCU_BSR_
#ifdef _MCU_BSR_
CKC = 0b00001001;
OSMC = 0x00;
# endif
#endif
STOP( );
#ifdef _MCU_BSR_
OSMC = 0x01;
CKC = 0b00001000;
#endif
#endif
RTCIMK = 0;
// 起きる //
// 起きる条件は
// ・KeyReturn割り込み電源ボたん
// ・RTCアラーム
// ・アダプタ挿抜
if( PM_EXTDC_n )
{
SW_pow_mask = 0;
}
# ifdef _MCU_BSR_
OSMC = 0x01;
CKC = 0b00001000;
# endif
RTCIMK = 0;
system_status.pwr_state = OFF; //
renge_task_interval_run_force = 1;
KRMK = 1;
return;
}
return;
default:
while( 1 )
@ -345,65 +321,31 @@ void tsk_sys( )
PMICが電源異常で止めたか確認
**********************************************************/
static void chk_emergencyExit(){
static u8 shirobako_power_control_count;
if( shirobako_power_control_count == 0 ) // PM_chk_LDSW() はI2C_mを使用し、高コスト
#ifndef _PARRADIUM_
if( !RESET1_n )
{
if( !RESET1_n )
if( PM_chk_LDSW( ) == 0 )
{
// リセットが下がってる
if( PM_chk_LDSW( ) == 0 )
{
// PMICが異常終了判断をした
system_status.pwr_state = OFF_TRIG;
renge_task_interval_run_force = 1;
}
else
{
// 白箱の仕業
shirobako_power_control_count = 1;
}
}
}
else
{
if( shirobako_power_control_count == 240 )
// デバッガが何かした。reset1を解除するまでは無視
{
if( RESET1_n )
{
shirobako_power_control_count = 0;
}
}else if( shirobako_power_control_count == 200 )
// デバッガが何かしたいらしい
{
// 白箱は電源を切りたいらしい
// PMICが異常終了判断をした
system_status.pwr_state = OFF_TRIG;
renge_task_interval_run_force = 1;
shirobako_power_control_count = 240;
}
else
{
if( !RESET1_n )
{
shirobako_power_control_count += 1;
}
else
{
// リセットをかけたらしい
iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_BL, 0 );
vreg_ctr[VREG_C_STATUS] = ( vreg_ctr[VREG_C_STATUS] & 0b10011111 );
vreg_ctr[VREG_C_COMMAND0] |= REG_BIT_RESET1_REQ;
renge_task_immed_add( do_command0 );
shirobako_power_control_count = 240;
}
// デバッガなりがリセットをかけた
iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_BL, 0 );
vreg_ctr[VREG_C_STATUS] = ( vreg_ctr[VREG_C_STATUS] & 0b10011111 );
vreg_ctr[VREG_C_COMMAND0] |= REG_BIT_RESET1_REQ;
renge_task_immed_add( do_command0 );
}
}
}
#endif
}
/* ========================================================
CPUからのスリープ要求
 

View File

@ -10,41 +10,41 @@
#ifdef _debug_
// 8ドットのLED
# define IIC_SLA_8LEDS 0x42
# define IIC_8LEDS_REG_DO 1
# define IIC_8LEDS_REG_DI 2
# define IIC_8LEDS_REG_DIR 3
#define IIC_SLA_8LEDS 0x42
#define IIC_8LEDS_REG_DO 1
#define IIC_8LEDS_REG_DI 2
#define IIC_8LEDS_REG_DIR 3
// 7セグ 4バイト版
# define IIC_SLA_DBG_MONITOR 0x44
#define IIC_SLA_DBG_MONITOR 0x44
#endif
#ifdef _debug_led_
# define DBG_LED_on { PM2.4 = 0; P2.4 = 1; }
# define DBG_LED_off { PM2.4 = 1; P2.4 = 0; }
# define DBG_LED_toggle ( P2.4 ^= 1 )
#define DBG_LED_WIFI_2_on { PM2.4 = 0; P2.4 = 1; }
#define DBG_LED_WIFI_2_off { PM2.4 = 1; P2.4 = 0; }
#define DBG_LED_WIFI_2_toggle ( P2.4 ^= 1 )
#else
# define DBG_LED_on ;
# define DBG_LED_off ;
# define DBG_LED_toggle ;
#define DBG_LED_WIFI_2_on ;
#define DBG_LED_WIFI_2_off ;
#define DBG_LED_WIFI_2_toggle ;
#endif
#ifdef _PMIC_TWL_
# define PM_TEG_PWSW P7.5 // TEGのみ
# define PM_TEG_LCD_dis( val ) ( P7.6 = val ) // TEGのみ
#define PM_TEG_PWSW P7.5 // TEG‚Ì‚Ý
#define PM_TEG_LCD_dis( val ) ( P7.6 = val ) // TEG‚Ì‚Ý
#else
# define SLP_ACK P7.7
#define SLP_ACK P7.7
#endif
#define IIC_SLA_CODEC 0xA4
#define IIC_SLA_ACCEL 0x30 // ST LIS331DLH
#define IIC_SLA_ACCEL 0x30 // ST LIS331DLH
// PMxは0で出力モード
@ -84,7 +84,11 @@
#define RESET2_ast { P0.1 = 0; PM0.1 = 0; }
#define RESET2_neg { PM0.1 = 1; }
#ifndef _PARRADIUM_
#define SLP_REQ P12.0
#else
#define SLP_REQ 0
#endif
// FCRAM
#ifdef _MODEL_TEG2_
@ -115,11 +119,11 @@
// INTP6
#ifndef _MODEL_CTR_
#define SND_DEPOP_SND_MUTE P7.7 = 1
#define SND_DEPOP_SND_ENABLE P7.7 = 0
#define SND_DEPOP_ACT P7.6 = 1
#define SND_DEPOP_DEACT P7.6 = 0
#else
#define SND_DEPOP_SND_MUTE ;
#define SND_DEPOP_SND_ENABLE ;
#define SND_DEPOP_ACT ;
#define SND_DEPOP_DEACT ;
#endif
// PM
@ -135,7 +139,6 @@
// 充電せよ(out)
#ifdef _PMIC_CTR_
// 負論理です。注意。
#define BT_CHG_ENABLE() ( P4.3 = 0 )
#define BT_CHG_DISABLE() ( P4.3 = 1 )
#else
@ -143,6 +146,14 @@
#define BT_CHG_DISABLE() ( P4.2 = 1 )
#endif
#ifdef PM_CCIC_TIM
#define PM_CHG_TIMEOUT_ENABLE() ( P5.0 = 0 )
#define PM_CHG_TIMEOUT_DISABLE() ( P5.0 = 1 )
#else
#define PM_CHG_TIMEOUT_ENABLE() ;
#define PM_CHG_TIMEOUT_DISABLE() ;
#endif
// 充電中(in)
#define BT_CHG_n P5.1
@ -161,8 +172,10 @@
// WiFi
#ifndef _TEG_
#define WL_TX P20.3 // INTP21
#define WL_RX P20.2 // INTP20
#else
#define WL_TX P20.3 // INTP21
#define WL_RX P20.2 // INTP20
#endif
//#define LED_CAM P1.0 // TO02
@ -174,36 +187,7 @@
#define LED_CHARGE P2.4
#ifdef _MODEL_TEG2_
#define I2C_PU_on() P5.3 = 1
#define I2C_PU_off() P5.3 = 0
#endif
#ifdef _MODEL_TS0_
#define I2C_PU_on() P5.3 = 1
#define I2C_PU_off() P5.3 = 0
#endif
#ifdef _MODEL_WM0_
#define I2C_PU_on() P5.3 = 1
#define I2C_PU_off() P5.3 = 0
#endif
#ifdef _MODEL_CTR_
// P5.3 に加え、P5.5, P140 P141
// P140が出力専用なので...
#define I2C_PU_on() { PM5.3 = 1; PM3.3 = 1; P14 |= 0x03; P5.3 = 1; PM5.3 = 0; P3.3 = 1; PM3.3 = 0; }
#define I2C_PU_off() { PM5.3 = 1; PM3.3 = 1; P14 &= ~0x03; P5.3 = 0; PM5.3 = 0; P3.3 = 0; PM3.3 = 0; }
#endif
#ifdef _MODEL_CTR_
#define GYRO_CS_ENABLE() P5.0 = 0
#define GYRO_CS_DISABLE() P5.0 = 1
#else
#define GYRO_CS_ENABLE() ;
#define GYRO_CS_DISABLE() ;
#endif
#define I2C_PU P5.3
//#define I2C_M_SDA P3.1 // SDA10
//#define I2C_M_SCL P3.2 // SCL10
@ -236,7 +220,7 @@
#define ACCEL_INT1 P2.5
#endif
#ifdef _MODEL_TS0_
#ifdef _MODEL_TS0_ || _MODEL_CTR_
#define ACC_VALID P20.5
#define ACCEL_INT1 P2.5
#endif
@ -253,21 +237,16 @@
#endif
#define DBG_M_n P2.1
#define DBG_P_n P2.2
#define KR_SW_POW ( 1 << 3 )
#define KR_SW_WIFI ( 1 << 4 )
#define INFO_LED_IS_FULLCOLOR_n P20.2
#define INFO_LED_IS_FULLCOLOR_PM PM20.2
#define INFO_LED_IS_FULLCOLOR_PU PU20.2
///////////////////////////////////////////////////////////
#define INT_MSK0_IIC_M_DMA 0b0001000000000000
#define INT_MSK0_SHELL 0b0000000010000000
#define INT_MSK0_EXTDC 0b0000000001000000

View File

@ -9,20 +9,22 @@ CTR MCU I2C
#include "led.h"
#include "accero.h"
#include "pm.h"
#include "pool.h"
#include <fsl.h>
#include "fsl_user.h"
extern u8 mcu_info_read(); // task_misc.c
extern u8 iic_burst_state;
// ********************************************************
u8 vreg_ctr[VREG_C_ENDMARK_];
bit irq_readed; // AAA型のため。
extern bit update;
extern u16 pool[];
// ********************************************************
extern task_status_immed tski_firm_update();
@ -62,12 +64,15 @@ void vreg_ctr_init( )
// を使用しないと、I2C_mcu使用中でエラー終了した場合にリトライしません。
void vreg_ctr_write( u8 adrs, u8 data )
{
if( adrs >= VREG_C_ENDMARK_ )
return;
switch ( adrs )
{
case ( VREG_C_MCU_STATUS ):
vreg_twl[ REG_TWL_INT_ADRS_MODE ] = ( ( data & 0xC0 ) >> 6 );
vreg_ctr[adrs] = data;
vreg_twl[ REG_TWL_INT_ADRS_MODE ] = ( ( data & 0xC0 ) >> 6 );
break;
case ( VREG_C_VCOM_T ):
@ -81,6 +86,7 @@ void vreg_ctr_write( u8 adrs, u8 data )
vreg_ctr[adrs] = data;
break;
case ( VREG_C_DBG3 ):
vreg_ctr[adrs] = data;
if( ( vreg_ctr[VREG_C_DBG1] == 'j' )
&& ( vreg_ctr[VREG_C_DBG2] == 'h' )
&& ( data == 'l' ) )
@ -88,7 +94,6 @@ void vreg_ctr_write( u8 adrs, u8 data )
renge_task_immed_add( tski_firm_update );
IICAMK = 1;
}
vreg_ctr[adrs] = data;
break;
case ( VREG_C_IRQ_MASK0 ):
@ -100,11 +105,11 @@ void vreg_ctr_write( u8 adrs, u8 data )
break;
case ( VREG_C_COMMAND0 ):
vreg_ctr[adrs] |= data;
if( data != 0 )
{
renge_task_immed_add( do_command0 );
}
vreg_ctr[adrs] |= data;
break;
case ( VREG_C_COMMAND2 ):
@ -123,8 +128,8 @@ void vreg_ctr_write( u8 adrs, u8 data )
/// 今のところさらに細かくは分けないけど…
if(( data & REG_BITS_CMD_BL ) != 0 )
{
renge_task_immed_add( tski_PM_BL_set );
vreg_ctr[adrs] = ( data & REG_BITS_CMD_BL );
renge_task_immed_add( tski_PM_BL_set );
}
break;
@ -152,37 +157,37 @@ void vreg_ctr_write( u8 adrs, u8 data )
vreg_ctr[adrs] = data;
break;
case ( VREG_C_FREE_0 ):
case ( VREG_C_FREE_1 ):
case ( VREG_C_FREE_2 ):
case ( VREG_C_FREE_3 ):
case ( VREG_C_FREE_4 ):
case ( VREG_C_FREE_5 ):
case ( VREG_C_FREE_6 ):
case ( VREG_C_FREE_7 ):
case ( VREG_C_FREE_8 ):
case ( VREG_C_FREE_9 ):
case ( VREG_C_FREE_A ):
case ( VREG_C_FREE_B ):
case ( VREG_C_FREE_C ):
case ( VREG_C_FREE_D ):
case ( VREG_C_FREE_E ):
case ( VREG_C_FREE_F ):
vreg_ctr[adrs] = data;
break;
case ( VREG_C_LED_BRIGHT ):
vreg_ctr[adrs] = data;
break;
case ( VREG_C_LED_POW ):
if( iic_burst_state == 0 )
{
vreg_ctr[adrs] = data;
iic_burst_state += 1;
}
else if( iic_burst_state < 5 )
{
led_red_batt_empty.dats.dats[ iic_burst_state -1 ] = data;
iic_burst_state += 1;
}
break;
case ( VREG_C_LED_WIFI ):
case ( VREG_C_LED_CAM ):
case ( VREG_C_LED_TUNE ):
case ( VREG_C_LED_NOTIFY ):
vreg_ctr[adrs] = data & 0x0F;
break;
case ( VREG_C_LED_NOTIFY_DATA ):
if( iic_burst_state < sizeof( uni_info_LED ) )
{
info_LED.bindata[ iic_burst_state ] = data;
iic_burst_state += 1;
}
/// 非同期で動いているためここでは書かない。
// 予約するだけでstopで書く
case ( VREG_C_RTC_SEC ):
@ -211,18 +216,18 @@ void vreg_ctr_write( u8 adrs, u8 data )
break;
case ( VREG_C_RTC_COMP ):
SUBCUD = data;
vreg_ctr[adrs] = data;
SUBCUD = data;
break;
case ( VREG_C_RTC_ALARM_MIN ):
rtc_alarm_dirty = 1;
vreg_ctr[adrs] = ( data & 0x7F );
rtc_alarm_dirty = 1;
break;
case ( VREG_C_RTC_ALARM_HOUR ):
rtc_alarm_dirty = 1;
vreg_ctr[adrs] = ( data & 0x3F );
rtc_alarm_dirty = 1;
break;
// 書くだけでよい
@ -240,13 +245,13 @@ void vreg_ctr_write( u8 adrs, u8 data )
case ( VREG_C_ACC_CONFIG ):
renge_task_immed_add( acc_hosu_set );
vreg_ctr[adrs] = data;
renge_task_immed_add( acc_hosu_set );
break;
case ( VREG_C_ACC_R_ADRS ):
renge_task_immed_add( acc_read );
vreg_ctr[adrs] = data;
renge_task_immed_add( acc_read );
break;
case ( VREG_C_ACC_W_ADRS ):
@ -254,8 +259,8 @@ void vreg_ctr_write( u8 adrs, u8 data )
break;
case ( VREG_C_ACC_W_BUF ):
renge_task_immed_add( acc_write );
vreg_ctr[adrs] = data;
renge_task_immed_add( acc_write );
break;
case ( VREG_C_ACC_HOSU_L ):
@ -271,40 +276,20 @@ void vreg_ctr_write( u8 adrs, u8 data )
}
break;
case ( VREG_C_ACC_HOSU_HOUR_BOUNDARY ):
vreg_ctr[adrs] = data;
break;
case ( VREG_C_FREE_ADRS ):
vreg_ctr[adrs] = data;
break;
case ( VREG_C_FREE_DATA ):
if( vreg_ctr[ VREG_C_FREE_ADRS ] < VREG_C_FREE_SIZE )
{
pool.vreg_c_ext.vreg_c_free[ vreg_ctr[ VREG_C_FREE_ADRS ] ] = data;
vreg_ctr[ VREG_C_FREE_ADRS ] += 1;
}
break;
case ( VREG_C_COMMAND3 ):
vreg_ctr[adrs] = data;
switch ( data )
{
case ( 'r' ):
// 割り込みルーチンからFSLライブラリを呼ぶのは禁止のため
renge_task_immed_add( tski_mcu_reset );
break;
// renge_task_immed_add( tski_mcu_reset );
// break;
case ( 'w' ):
// WDTで再起動テスト向け
WDTE = 0xAA;
break;
}
vreg_ctr[adrs] = data;
break;
default:
break;
}
return;
}
@ -333,10 +318,6 @@ u8 vreg_ctr_read( u8 adrs )
{
return( hosu_read() );
}
else if( adrs == VREG_C_FREE_DATA )
{
return( pool.vreg_c_ext.vreg_c_free[ vreg_ctr[VREG_C_FREE_ADRS]++ ] );
}
else if( adrs == VREG_C_RTC_SEC_FINE_L )
{
rsub_temp = RSUBC;
@ -348,9 +329,6 @@ u8 vreg_ctr_read( u8 adrs )
}
else if( adrs == VREG_C_INFO )
{
// I2C_mを使うので、ここからでは割り込みが使えなくて困る
// なのでタスク登録する。
// 強制的にI2C_2割り込みをマスクする
renge_task_immed_add( tski_mcu_info_read );
IICAMK = 1;
return( 0x4A );
@ -373,6 +351,7 @@ u8 vreg_ctr_read( u8 adrs )
// I2C仮想レジスタから読まれて何かするレジスタ
void vreg_ctr_after_read( u8 adrs )
{
// 割り込みフラグはリードでクリア
switch( adrs )
{
@ -415,14 +394,14 @@ void set_irq( u8 irqreg, u8 irq_flg )
{
u8 tot;
// DI();
DI();
if( ( vreg_ctr[ irqreg + 8 ] & irq_flg ) == 0 ){
vreg_ctr[ irqreg ] |= irq_flg;
IRQ0_neg; // 一瞬上げて...
IRQ0_neg; // 一瞬上げて落とし直す。
// EI();
tot = 0;
while( !IRQ0 && ( ++tot != 0 ) ){;} // O.D.なのでちゃんとあがるのを待つ IRQ_mcu がLに縛られてると困る(基板不良)
IRQ0_ast; // 落とし直す。
IRQ0_ast;
}
// EI();
EI();
}

View File

@ -4,8 +4,12 @@
#include "config.h"
#define REG_BIT__SYS_MODE0 0b01000000
#define REG_BIT_MCU_FIRMBROKEN 0b10000000
// VREG_C_MCU_STATUS
#define REG_BIT_STATUS_WDT_RESET ( 1 << 1 )
#define REG_BIT_STATUS_WDT_RESET ( 1 << 1 )
#define REG_BIT_RTC_BLACKOUT ( 1 << 0 )
@ -23,15 +27,17 @@
// VREG_C_STATUS_X
// 未使用 ( 1 << 6 )
// 未使用 ( 1 << 5 )
#define REG_BIT_WIFI_TX ( 1 << 4 )
// twl bl のミラー[1: ( 1 << 3 )
// 0]( 1 << 2 )
// 未使用 ( 1 << 4 )
// 未使用 ( 1 << 3 )
// 未使用 ( 1 << 2 )
#define REG_BIT_ACCERO_ERR ( 1 << 1 )
#define REG_BIT_GASGAUGE_ERR ( 1 << 0 )
// VREG_C_IRQ0
#define REG_BIT_VR_SNDVOL_CHANGE ( 1 << 7 )
#define REG_BIT_IRQ_WDT_RESET ( 1 << 7 )
#define REG_BIT_IRQ_WDT_RESET ( 1 << 7 )
#define REG_BIT_SHELL_OPEN ( 1 << 6 )
#define REG_BIT_SHELL_CLOSE ( 1 << 5 )
#define REG_BIT_SW_WIFI_CLICK ( 1 << 4 )
@ -51,7 +57,6 @@
#define REG_BIT_BT_DC_DISC ( 1 << 0 )
// VREG_C_IRQ2
#define REG_BIT_TWL_VER_READ ( 1 << 7 )
#define REG_BIT_TWL_SNDVOL_CHANGE ( 1 << 6 )
#define REG_BIT_TWL_BL_U_ON ( 1 << 5 )
#define REG_BIT_TWL_BL_U_OFF ( 1 << 4 )
@ -120,11 +125,6 @@
#define REG_BIT_TWL_REQ_RESET ( 1 << 0 )
// VREG_C_LED_NOTIFY_FLAG
#define REG_BIT_IN_LOOP ( 1 << 0 )
/*
#define REG_BIT_ ( 1 << 7 )
@ -193,8 +193,7 @@ enum VREG_C
VREG_C_LED_WIFI,
VREG_C_LED_CAM,
VREG_C_LED_TUNE,
VREG_C_LED_NOTIFY_DATA,
VREG_C_LED_NOTIFY_FLAG,
VREG_C_LED_NOTIFY,
VREG_C_RTC_SEC = 0x30,
VREG_C_RTC_MIN,
@ -233,18 +232,30 @@ enum VREG_C
VREG_C_ACC_HOSU_H,
VREG_C_ACC_HOSU_SETTING,
VREG_C_ACC_HOSU_HIST = 0x4F,
VREG_C_ACC_HOSU_HOUR_BOUNDARY = 0x50,
// とりあえず15バイトのスキマ
VREG_C_FREE_ADRS = 0x60,
VREG_C_FREE_DATA,
// VREG_C_AMBIENT_BRIGHTNESS = 0x60,
// 歩数計の評価のため...
VREG_C_FREE_0 = 0x50,
VREG_C_FREE_1,
VREG_C_FREE_2,
VREG_C_FREE_3,
VREG_C_FREE_4,
VREG_C_FREE_5,
VREG_C_FREE_6,
VREG_C_FREE_7,
VREG_C_FREE_8,
VREG_C_FREE_9,
VREG_C_FREE_A,
VREG_C_FREE_B,
VREG_C_FREE_C,
VREG_C_FREE_D,
VREG_C_FREE_E,
VREG_C_FREE_F,
VREG_C_ENDMARK_
};
#define VREG_C_INFO 0x7F
// VREG_C_AMBIENT_BRIGHTNESS = 0xXX,
/*
VREG_C_PM_INFO, // 未使用

View File

@ -5,11 +5,10 @@ TWL
======================================================== */
#include "incs.h"
#include "jhl_defs.h"
#include "led.h"
#include "vreg_twl.h"
#include "vreg_ctr.h"
#include "renge\renge_task_intval.h"
// ========================================================
#define TWL_REG_VER_INFO 0x35
@ -19,9 +18,6 @@ TWL
u8 vreg_twl[_REG_TWL_INT_ADRS_ENDMARK];
extern bit twl_ver_read;
/* ========================================================
¼zƒŒƒWƒXƒ^Ì<EFBFBD>Šú»
======================================================== */
@ -95,9 +91,6 @@ u8 vreg_twl_read( u8 phy_adrs )
switch( phy_adrs ){
case( REG_TWL_INT_ADRS_VER_INFO ):
// set_irq( VREG_C_IRQ2, REG_BIT_TWL_VER_READ ); // 速度的に無理なので
twl_ver_read = 1;
return( TWL_REG_VER_INFO );
case( REG_TWL_INT_ADRS_POWER_INFO ):
@ -141,8 +134,8 @@ u8 adrs_table_twl_ext2int( u8 img )
case( REG_TWL_ADRS_IRQ ): return( REG_TWL_INT_ADRS_IRQ );
case( REG_TWL_ADRS_COMMAND ): return( REG_TWL_INT_ADRS_COMMAND );
case( REG_TWL_ADRS_POWER_INFO ): return( REG_TWL_INT_ADRS_POWER_INFO );
case( REG_TWL_ADRS_VOL ): return( REG_TWL_INT_ADRS_VOL );
case( REG_TWL_ADRS_CAM ): return( REG_TWL_INT_ADRS_CAM );
case( REG_TWL_ADRS_VOL ): return( REG_TWL_INT_ADRS_VOL );
case( REG_TWL_ADRS_TEMP0 ): return( REG_TWL_INT_ADRS_TEMP0 );
case( REG_TWL_ADRS_VER_INFO ): return( REG_TWL_INT_ADRS_VER_INFO );
case( REG_TWL_ADRS_MODE ): return( REG_TWL_INT_ADRS_MODE );

View File

@ -102,12 +102,12 @@ enum REG_TWL_ADRS_INT
#define reg_wifi_led_blink ( vregs[ REG_TWL_INT_ADRS_WIFI ] & 0x02 )
typedef enum {
typedef enum twl_camLed_mode_{
TWL_CAMLED_OFF,
TWL_CAMLED_ON,
TWL_CAMLED_BLINK,
TWL_CAMLED_DEF_ON
}twl_camLed_mode;
}camLed_mode;
/* ========================================================================= */
@ -116,7 +116,7 @@ void vreg_twl_write( u8 adrs, u8 data );
u8 adrs_table_twl_ext2int( u8 img );
u8 vreg_twl_read( u8 phy_adrs );
extern task_status_immed command_from_twl( );
task_status_immed command_from_twl( );
// 読んだらクリアなどの処理

View File

@ -3,7 +3,7 @@ C:\WINDOWS\system32\cmd.exe /c touch magic.c
Compilation complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\magic.asm
Assembly complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\lk78k0r.exe" -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -obsr.lmf "..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r\s0rm.rel" -go85h,0FC00h,1024 -gi0FFFFFFFFFFFFFFFFFFFFh -pbsr_k0r.map -nkd -gb7EFBFFh -b"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib" -bcl0rdm.lib -bcl0rm.lib -bcl0rmf.lib -i"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r" -dbsr_mcu.dr -s -w0 loader.rel pm.rel i2c_ctr.rel main.rel magic.rel WDT.rel i2c_mcu.rel i2c_twl.rel ini_VECT.rel led.rel rtc.rel vreg_ctr.rel vreg_twl.rel adc.rel renge.rel accero.rel self_flash.rel reboot.rel sw.rel task_debug.rel task_misc.rel task_sys.rel pedo_alg_thre_det2.rel
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\lk78k0r.exe" -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -obsr.lmf "..\..\..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r\s0rm.rel" -go85h,0FC00h,1024 -gi0FFFFFFFFFFFFFFFFFFFFh -pbsr_k0r.map -nkd -gb7EFBFFh -b"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib" -bcl0rdm.lib -bcl0rm.lib -bcl0rmf.lib -i"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r" -dbsr_mcu.dr -s -w0 loader.rel pm.rel i2c_ctr.rel main.rel magic.rel WDT.rel i2c_mcu.rel i2c_twl.rel ini_VECT.rel led.rel rtc.rel vreg_ctr.rel vreg_twl.rel adc.rel renge.rel accero.rel self_flash.rel reboot.rel sw.rel task_debug.rel task_misc.rel task_sys.rel pedo_alg_thre_det2.rel
Link complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\oc78k0r.exe" -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -o.\bsr.hex -nu -ki bsr.lmf
Object Conversion Complete, 0 error(s) and 0 warning(s) found.

View File

@ -4,10 +4,10 @@ Target=IDK0R32G
[Configuration]
Chip=uPD79F0104
Internal Rom=32KB
Internal Ram=1536KB
Internal Ram=1536B
Clock=Target
Sub Clock=Target
Peripheral Break=0x1
Peripheral Break=0x3
Firm Clock=System
Flash Programming=Permit
Low-voltage Flash Rewriting=On
@ -22,8 +22,8 @@ SubClock=None
[Mapping]
Count=0
[Main]
Geometry=-1211, 40, 1200, 882
Window=Max
Geometry=-1285, 68, 1219, 1099
Window=Normal
MDI_MAX=OFF
Button=ON
Mode=Auto
@ -33,10 +33,10 @@ Coverage=OFF
Timer=OFF
Tracer=OFF
[Load File]
Dir=.
Dir=..\yav-mcu-basara\
SaveFilter=0
Start=0
End=0
Start=0xffF00
End=0xfffff
LoadFilter=5
Offset=0
Object=ON
@ -55,7 +55,7 @@ HighSpeed1=OFF
CPU Reset1=ON
Symbol Reset1=ON
[View File]
Dir=.
Dir=..\yav-mcu-basara\
Filter=Source
[Debugger Option]
Source Path=".;renge"
@ -78,10 +78,10 @@ Symbol Type=OFF
Language=C
Kanji=SJIS
[Source]
Geometry=4, 9, 871, 684
Geometry=376, 104, 707, 899
Window=Normal
DispStart=387
CaretPos=388,0
DispStart=41
CaretPos=88,0
Mode=Normal
DispFile=
Address1=
@ -100,7 +100,7 @@ Address13=
Address14=
Address15=
Address16=
Data1=
Data1=iic_mcu_initialized
Data2=
Data3=
Data4=
@ -140,10 +140,10 @@ SaveStart=
SaveEnd=
Accumulative=ON
[Assemble]
Geometry=19, 497, 600, 400
Geometry=674, 20, 600, 400
Window=Normal
DispStart=18910
CaretPos=18910,27
DispStart=688
CaretPos=688,27
Address1=
Address2=
Address3=
@ -185,18 +185,18 @@ SaveRange=Screen
SaveStart=
SaveEnd=
[Memory]
Geometry=373, 24, 550, 682
Window=Normal
Boundary=163
Geometry=632, 59, 578, 791
Window=Hide
Boundary=0
Format=Hex
Mode=Byte
Endian=Little
Endian=
Ascii=OFF
Idtag=OFF
Address=
DispStart=00004F70
CaretPosData=20, 255
CaretPosAscii=53248, 256
CaretPosData=0, 0
CaretPosAscii=0, 0
Address1=
Address2=
Address3=
@ -251,12 +251,12 @@ Destination=0
[I/O Port]
Line=0
[Stack]
Geometry=0, 0, 0, 0
Geometry=525, 527, 400, 399
Window=Hide
Boundary=0
Boundary=13762687
Mode=Proper
[Sfr]
Geometry=613, 51, 596, 915
Geometry=0, 0, 396, 1089
Window=Hide
Address1=
Address2=
@ -280,7 +280,7 @@ Attribute=Show
Sort=Unsort
Pickup=OFF
SelectSort=Address
Last Name=IF0
Last Name=P0
Line=531
L1=P0
L2=P1
@ -814,8 +814,8 @@ L529=IICWL1
L530=IICWH1
L531=SVA1
[Local Variable]
Geometry=697, 793, 400, 300
Window=Normal
Geometry=864, 668, 400, 259
Window=Hide
Boundary=13041851
Mode=Proper
[Trace View]
@ -866,22 +866,22 @@ SaveRange=Screen
SaveStart=
SaveEnd=
[Register]
Geometry=1338, 10, 250, 519
Window=Normal
Geometry=0, 0, 250, 400
Window=Hide
Mode=Hex
Boundary=174
Boundary=62
Pickup=OFF
Name=Functional
Register Bank=0
RP0=3
RP1=3
RP2=3
RP3=3
PC=3
SP=3
PSW=7
ES=3
CS=3
RP0=1
RP1=1
RP2=1
RP3=1
PC=1
SP=1
PSW=1
ES=1
CS=1
[Event Manager]
Geometry=0, 0, 0, 0
Window=Hide
@ -957,75 +957,36 @@ Detail=OFF
Last Name=
Count=0
[Variable]
Geometry=884, 10, 440, 793
Window=Normal
Boundary=13762700
0=.list_id,P,N,A,+,1
1=.psw,P,R,A,+,1
2=.tasks_immed,P,N,A,+,1
Line=3
Geometry=1104, 23, 463, 624
Window=Hide
Boundary=17629364
Line=0
[Quick Watch]
0=IICA1,P,A,1
1=TRC1,P,A,1
2=P7.5,P,A,1
3=PM7.6,P,A,1
4=PM7.5,P,A,1
5=PM12.0,P,A,1
6=P12.0,P,A,1
7=iic_mcu_bus_status,P,A,1
8=temp,P,A,1
9=adc_raw_vol,P,A,1
10=force_update_adc,P,A,1
11=DMAMK1,P,A,1
12=DMAIF1,P,A,1
13=tasks_immed,P,A,1
14=list_id,P,A,1
15=psw,P,A,1
0=
1=
2=
3=
4=
5=
6=
7=
8=
9=
10=
11=
12=
13=
14=
15=
[Software Break]
Geometry=1085, 803, 500, 296
Window=Normal
Geometry=857, 296, 391, 360
Window=Hide
Width=150 30 200 100
Name0=Swb00001
Address0=task_misc.c#_tski_mcu_info_read+0x3d
Address0=accero.c#es_F0038+0x6
Window0=ASM
Status0=ON
Name1=Swb00002
Address1=task_misc.c#_tski_mcu_info_read+0x56
Window1=ASM
Status1=ON
Name2=Swb00003
Address2=task_misc.c#_tski_mcu_info_read+0x56
Window2=ASM
Status2=ON
Name3=Swb00005
Address3=task_misc.c#_tski_mcu_info_read+0x56
Window3=ASM
Status3=ON
Name4=Swb00004
Address4=task_misc.c#_tski_mcu_info_read+0x21
Window4=ASM
Status4=ON
Name5=Swb00015
Address5=pm.c#_ntr_pmic_comm+0x32
Window5=ASM
Status5=ON
Name6=Swb00011
Address6=loader.c#_main+0x1b
Window6=ASM
Status6=ON
Name7=Swb00008
Address7=rtc.c#_RTC_init+0x1
Window7=ASM
Status7=ON
Name8=Swb00006
Address8=loader.c#_main+0x74
Window8=ASM
Status8=ON
Name9=Swb00007
Address9=loader.c#_main+0x71
Window9=ASM
Status9=ON
Count=10
Count=1
[Reset]
Debugger=ON
Symbol=OFF

File diff suppressed because it is too large Load Diff

View File

@ -7,20 +7,17 @@ FrameCY=1044
OpenFile1=renge\renge.h,0,502,637,1746,1394,29,16,29,0
OpenFile2=jhl_defs.h,0,250,539,1494,1265,0,10,8,0
OpenFile3=renge\\renge_defs.h,0,293,307,1537,1033,18,37,18,0
OpenFile4=renge\renge_defs.h,0,667,22,1514,748,0,16,0,0
OpenFile5=task_sys.c,0,330,330,1574,1056,0,172,37,0
OpenFile6=loader.c,0,296,307,1286,923,20,214,20,0
OpenFile7=pm.h,0,254,446,1244,1062,0,115,0,0
OpenFile8=sw.c,0,574,367,1818,1093,43,36,43,0
OpenFile9=vreg_ctr.h,0,632,184,1876,910,8,40,25,0
OpenFile10=pedo_alg_thre_det2.c,0,132,132,1376,858,0,12,0,0
OpenFile11=adc.c,0,286,286,1530,1012,0,145,0,0
OpenFile12=self_flash.c,0,154,154,1398,880,7,365,7,0
OpenFile13=ProjectWindow
OpenFile4=task_sys.c,0,330,330,1574,1056,0,172,37,0
OpenFile5=loader.c,0,296,307,1286,923,20,214,20,0
OpenFile6=pm.h,0,254,446,1244,1062,0,115,0,0
OpenFile7=sw.c,0,574,367,1818,1093,43,36,43,0
OpenFile8=ProjectWindow
PrjPos=0,2,754,3,253
OpenFile14=magic.c,0,323,248,1567,974,0,17,0,0
OpenFile15=config.h,0,288,71,1532,797,18,2,21,0
OpenFile16=OutputWindow
OpenFile9=vreg_ctr.h,0,632,184,1876,910,13,2,13,0
OpenFile10=renge\renge_defs.h,0,667,22,1514,748,22,10,22,0
OpenFile11=config.h,0,448,88,1424,828,0,28,0,0
OpenFile12=adc.c,0,88,88,1332,814,68,185,68,0
OpenFile13=OutputWindow
OutputPos=0,572,1038,46,1104
ActivePRJ=yav_mcu_bsr.prj
[ProjectWindow]

View File

@ -1,7 +1,7 @@
[SdbInfo]
Ver=5
[loader.c]
T=4bb93708
T=4bf0e7c4
1=incs_loader.h
2=fsl.h
3=fsl_user.h
@ -11,21 +11,21 @@ T=4bb93708
7=rtc.h
8=reboot.h
[pm.c]
T=4bb92f33
T=4bf0d1dd
1=incs.h
2=adc.h
3=led.h
4=pm.h
5=renge\renge.h
6=batt_params.h
7=..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h
7=..\..\..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h
8=fsl_user.h
[i2c_ctr.c]
T=4bb92f33
T=4bf0d1dd
1=incs.h
2=accero.h
[main.c]
T=4bb92f33
T=4bf0d1dd
1=incs_loader.h
2=WDT.h
3=rtc.h
@ -34,54 +34,54 @@ T=4bb92f33
6=led.h
7=adc.h
[magic.c]
T=4bb94d0f
T=4bf1442e
1=config.h
[WDT.c]
T=4bb92f33
T=4bf0d1dd
1=incs_loader.h
[i2c_mcu.c]
T=4bb92f33
T=4bf0d1dd
1=incs.h
2=i2c_mcu.h
[i2c_twl.c]
T=4bb92f33
T=4bf0d1dd
1=incs.h
2=i2c_twl_defs.h
[ini_VECT.c]
T=4bb92f33
T=4bf0d1dd
1=config.h
[led.c]
T=4bb92f33
T=4bf0d1dd
1=incs.h
2=led.h
[rtc.c]
T=4bb92f33
T=4bf0d1dd
1=incs.h
[vreg_ctr.c]
T=4bb92f33
T=4bf0d1dd
1=incs.h
2=vreg_ctr.h
3=rtc.h
4=led.h
5=accero.h
6=pm.h
7=..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h
7=..\..\..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h
8=fsl_user.h
[vreg_twl.c]
T=4bb92f33
T=4bf0d1dd
1=incs.h
2=jhl_defs.h
3=vreg_twl.h
4=vreg_ctr.h
5=renge\renge_task_intval.h
[adc.c]
T=4bb92f33
T=4bf145d5
1=incs.h
2=adc.h
3=pm.h
4=led.h
[renge\renge.c]
T=4bb92f32
T=4bf0d1db
1=renge\renge.h
2=renge\renge_task_intval.h
3=renge\renge_task_immediate.h
@ -90,20 +90,20 @@ T=4bb92f32
6=user_define.h
7=bsr_system.h
[accero.c]
T=4bb92f33
T=4bf0d1dd
1=incs.h
2=..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\inc78k0r\math.h
2=..\..\..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\inc78k0r\math.h
[self_flash.c]
T=4bb92f33
T=4bf0d1dd
1=incs_loader.h
2=..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h
2=..\..\..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h
3=fsl_user.h
4=i2c_ctr.h
[reboot.c]
T=4bb92f33
T=4bf0d1dd
1=incs_loader.h
[sw.c]
T=4bb92f33
T=4bf0d1dd
1=incs.h
2=i2c_twl.h
3=i2c_ctr.h
@ -112,13 +112,13 @@ T=4bb92f33
6=pm.h
7=rtc.h
[task_debug.c]
T=4bb92f33
T=4bf0e594
1=incs.h
2=renge\renge.h
3=pm.h
4=accero.h
[task_misc.c]
T=4bb92f33
T=4bf0d1dd
1=incs.h
2=renge\renge.h
3=pm.h
@ -126,7 +126,7 @@ T=4bb92f33
5=adc.h
6=i2c_mcu.h
[task_sys.c]
T=4bb92f33
T=4bf0dadc
1=incs.h
2=i2c_twl.h
3=i2c_ctr.h
@ -137,13 +137,13 @@ T=4bb92f33
8=sw.h
9=adc.h
[pedo_alg_thre_det2.c]
T=4bb92f33
T=4bf0d1dd
1=incs.h
2=..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\inc78k0r\math.h
2=..\..\..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\inc78k0r\math.h
3=accero.h
4=pedometer.h
[incs_loader.h]
T=4bb92f33
T=4bf0d1dd
1=jhl_defs.h
2=user_define.h
3=bsr_system.h
@ -154,49 +154,49 @@ T=4bb92f33
8=i2c_mcu.h
9=WDT.h
[jhl_defs.h]
T=4bb92f33
T=4bf0d1dd
1=config.h
[config.h]
T=4bb9687f
T=4bf0e3aa
[user_define.h]
T=4bb92f33
T=4bf0d1dd
[bsr_system.h]
T=4bb92f33
T=4bf0d1dd
[renge\renge.h]
T=4bb92f32
T=4bf0d1db
1=renge\renge_defs.h
2=renge\renge_task_immediate.h
[renge\renge_defs.h]
T=4bb92f32
T=4bf0d1db
[renge\renge_task_immediate.h]
T=4bb92f32
T=4bf0d1db
1=renge\renge_defs.h
[vreg_ctr.h]
T=4bb92f33
T=4bf0d1dd
1=config.h
[vreg_twl.h]
T=4bb92f33
T=4bf0d1dd
[loader.h]
T=4bb92f33
T=4bf0d1dd
1=jhl_defs.h
[i2c_mcu.h]
T=4bb92f33
T=4bf0d1dd
[WDT.h]
T=4bb92f33
T=4bf0d1dd
[fsl.h]
T=4bb92f33
T=4bf0d1dd
[fsl_user.h]
T=4bb92f33
T=4bf0d1dd
[i2c_ctr.h]
T=4bb92f33
T=4bf0d1dd
[pm.h]
T=4bb92f33
T=4bf0d1dd
[rtc.h]
T=4bb92f33
T=4bf0d1dd
[reboot.h]
T=4bb92f33
T=4bf0d1dd
[incs.h]
T=4bb92f33
T=4bf0d1dd
1=jhl_defs.h
2=user_define.h
3=bsr_system.h
@ -207,28 +207,28 @@ T=4bb92f33
8=rtc.h
9=accero.h
[accero.h]
T=4bb92f33
T=4bf0d1dd
1=jhl_defs.h
2=pedometer.h
[pedometer.h]
T=4bb92f33
T=4bf0d1dd
[adc.h]
T=4bb92f33
T=4bf0d1dd
1=jhl_defs.h
[led.h]
T=4bb92f33
T=4bf0d1dd
[batt_params.h]
T=4bb92f33
[..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h]
T=49a3bd4e
T=4bf0d1dd
[i2c_twl_defs.h]
T=4bb92f33
T=4bf0d1dd
[renge\renge_task_intval.h]
T=4bb92f32
T=4bf0d1db
1=renge\renge_defs.h
[..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\inc78k0r\math.h]
T=45f12258
[i2c_twl.h]
T=4bb92f33
T=4bf0d1dd
[sw.h]
T=4bb92f33
T=4bf0d1dd
[..\..\..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h]
T=49a3bd4e
[..\..\..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\inc78k0r\math.h]
T=45f12258