git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@11 013db118-44a6-b54f-8bf7-843cb86687b1

This commit is contained in:
fujita_ryohei 2009-09-29 10:31:26 +00:00
parent 4f86e7aa2d
commit 9453e8fbfe
33 changed files with 1360 additions and 975 deletions

View File

@ -41,17 +41,15 @@
#define ACC_BITS_ALL_AXIS_ON 7 #define ACC_BITS_ALL_AXIS_ON 7
#define VREG_BITMASK_ACC_CONF0_HOSU 1 #define VREG_BITMASK_ACC_CONF_HOSU ( 1 << 1 )
#define VREG_BITMASK_ACC_CONF1_ACQ 3 #define VREG_BITMASK_ACC_CONF_ACQ ( 1 << 0 )
// ======================================================== // ========================================================
u8 hosu_mode = 0; task_interval tsk_soft_int();
/*
0: power down âŽ~
1: ®Ťě
*/
/* ======================================================== /* ========================================================
@ -66,17 +64,14 @@ task_status_immed tsk_cbk_accero(){ //
// 加速度センサデータレジスタへの反映 // 加速度センサデータレジスタへの反映
iic_mcu_read( IIC_SLA_ACCEL, ( ACC_REG_X | 0x80 ), 6, &vreg_ctr[VREG_C_ACC_XL] ); iic_mcu_read( IIC_SLA_ACCEL, ( ACC_REG_X | 0x80 ), 6, &vreg_ctr[VREG_C_ACC_XL] );
if(( vreg_ctr[ VREG_C_ACC_CONFIG ] & VREG_BITMASK_ACC_CONF1_ACQ ) == 1 ){ if(( vreg_ctr[ VREG_C_ACC_CONFIG ] & ( VREG_BITMASK_ACC_CONF_ACQ | VREG_BITMASK_ACC_CONF_HOSU ) ) != 0 ){
vreg_ctr[ VREG_C_IRQ1 ] |= REG_BIT_ACC_DAT_RDY; set_irq( VREG_C_IRQ1, REG_BIT_ACC_DAT_RDY );
if( ( vreg_ctr[ VREG_C_IRQ_MASK1 ] & REG_BIT_ACC_DAT_RDY ) == 0 ){
IRQ0_ast;
}
} }
} }
// 歩数計 offでなければ、電源off中でも計測 // 歩数計 offでなければ、電源off中でも計測
if(( vreg_ctr[ VREG_C_ACC_CONFIG_HOSU ] & VREG_BITMASK_ACC_CONF0_HOSU ) != 0 ){ if(( vreg_ctr[ VREG_C_ACC_CONFIG ] & VREG_BITMASK_ACC_CONF_HOSU ) != 0x00 ){
if(( vreg_ctr[ VREG_C_ACC_CONFIG ] & VREG_BITMASK_ACC_CONF1_ACQ ) == 0x01 ){ if(( vreg_ctr[ VREG_C_ACC_CONFIG ] & VREG_BITMASK_ACC_CONF_ACQ ) != 0x00 ){
// 歩数計アルゴリズム 100Hz版 // 歩数計アルゴリズム 100Hz版
}else{ }else{
// 同 省電力版 // 同 省電力版
@ -131,17 +126,25 @@ task_status_immed acc_hosu_set(){
return( ERR_SUCCESS ); // とりあえず、タスクは削除しなくてはならない return( ERR_SUCCESS ); // とりあえず、タスクは削除しなくてはならない
} }
str_send_buf[1] = 0x00; // ...<2E>B str_send_buf[1] = 0x10; // ctrl2 HPF:normal, filterd, HPF for IRQ : dis/dis, HPF coeff:norm
str_send_buf[2] = 0x02; #ifdef _MCU_WM0_
str_send_buf[3] = 0x80; str_send_buf[2] = 0x10; // 3 IRQ pol :Active HI, Drive:Pushpull,
if( (( vreg_ctr[ VREG_C_ACC_CONFIG_HOSU ] & VREG_BITMASK_ACC_CONF0_HOSU ) == 0 ) // IRQ2flg latch: auto clear after read, IRQ2 conf: IRQ( fall,shock,...)
&& (( vreg_ctr[ VREG_C_ACC_CONFIG ] & VREG_BITMASK_ACC_CONF1_ACQ ) == 0 ) ){ // 1 : auto clear after read, conf: data ready
#else
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
#endif
str_send_buf[3] = 0x80; // ctrl3 block update:enable, MSB first, scale: +-2G(default), selftest: dis
if(( vreg_ctr[ VREG_C_ACC_CONFIG ] & ( VREG_BITMASK_ACC_CONF_HOSU | VREG_BITMASK_ACC_CONF_ACQ ) ) == 0 ){
// 完全停止 // 完全停止
str_send_buf[0] = ( ACC_BITS_PM_PDN << ACC_bP_PM0 | 0 << ACC_bP_DR0 | ACC_BITS_ALL_AXIS_ON ); str_send_buf[0] = ( ACC_BITS_PM_PDN << ACC_bP_PM0 | 0 << ACC_bP_DR0 | ACC_BITS_ALL_AXIS_ON );
} }
else else
{ {
if(( vreg_ctr[ VREG_C_ACC_CONFIG ] & VREG_BITMASK_ACC_CONF1_ACQ ) == 0x01 ){ if(( vreg_ctr[ VREG_C_ACC_CONFIG ] & VREG_BITMASK_ACC_CONF_ACQ ) != 0x00 ){
// 100Hz 自動取り込み // 100Hz 自動取り込み
str_send_buf[0] = ( ACC_BITS_PM_NORM << ACC_bP_PM0 | ACC_BITS_DR_100Hz << ACC_bP_DR0 | ACC_BITS_ALL_AXIS_ON ); str_send_buf[0] = ( ACC_BITS_PM_NORM << ACC_bP_PM0 | ACC_BITS_DR_100Hz << ACC_bP_DR0 | ACC_BITS_ALL_AXIS_ON );
}else{ }else{
@ -153,3 +156,43 @@ task_status_immed acc_hosu_set(){
return( ERR_SUCCESS ); return( ERR_SUCCESS );
} }
/* ========================================================
I2Cが使用中かもしれないので
======================================================== */
__interrupt void intp23_ACC_ready(){
if( ( vreg_ctr[ VREG_C_ACC_CONFIG ] & 0x03 ) != 0x00 ){
if(( system_status.pwr_state == ON ) || ( system_status.pwr_state == SLEEP ) ){
if( ACC_VALID ){
renge_task_immed_add( tsk_cbk_accero );
}
}
}
}
/* ========================================================
todo : // 本物のマイコンなら、割り込みでタスクを登録
======================================================== */
task_interval tsk_soft_int(){
if( ( vreg_ctr[ VREG_C_ACC_CONFIG ] & 0x03 ) != 0x00 ){
if(( system_status.pwr_state == ON ) || ( system_status.pwr_state == SLEEP ) ){
// Hエッジ検出
// pin = ( pin << 1 ) + ( ACC_VALID? 1: 0 );
// if( ( pin & 0x03 ) == 0x01 ){
if( ACC_VALID ){
renge_task_immed_add( tsk_cbk_accero );
}
}
return( 0 );
}
return( 248 );
}

View File

@ -28,16 +28,15 @@ bit adc_updated;
======================================================== */ ======================================================== */
task_interval tsk_adc(){ task_interval tsk_adc(){
static u8 old_tune; static u8 old_tune;
static u8 old_sndvol;
static u8 sndvol_codec; static u8 sndvol_codec;
// static u8 bt_temp_old; static u8 bt_temp_old;
if(( system_status.pwr_state == ON ) if(( system_status.pwr_state == ON )
|| ( system_status.pwr_state == SLEEP )){ || ( system_status.pwr_state == SLEEP )){
if( adc_updated ){ if( adc_updated ){
#if 0 #if 0
tune Vol tune
// tune // tune
if( abs( old_tune - vreg_ctr[ VREG_TUNE ] ) >= 4 ){ if( abs( old_tune - vreg_ctr[ VREG_TUNE ] ) >= 4 ){
old_tune = vreg_ctr[ VREG_TUNE ]; old_tune = vreg_ctr[ VREG_TUNE ];
@ -46,22 +45,31 @@ task_interval tsk_adc(){
IRQ0_ast; IRQ0_ast;
} }
} }
#endif
// Volume // Volume
if( abs( old_sndvol - vreg_ctr[ VREG_C_SND_VOL ] ) >= 4 ){ {
old_sndvol = vreg_ctr[ VREG_C_SND_VOL ]; static u8 class_old;
vreg_ctr[ VREG_C_IRQ0 ] |= REG_BIT_VR_SNDVOL_CHANGE; u8 class;
if( ( vreg_ctr[ VREG_C_IRQ_MASK0 ] & REG_BIT_VR_SNDVOL_CHANGE ) == 0 ){ static u8 direction = 0; // 0:上り方向
IRQ0_ast; u8 comp; // 補正値
class = ( vreg_ctr[ VREG_C_SND_VOL ] + ( ( direction != 0 )? 0: 2 ) ) / ( 200 / 8 ) ;
if( class != class_old ){
direction = ( class > class_old )? 0: 1;
class_old = class;
set_irq( VREG_C_IRQ0, REG_BIT_VR_SNDVOL_CHANGE );
} }
} }
#endif
// codecÉ“`‚¦‚é // codecÉ“`‚¦‚é
if( vreg_ctr[ VREG_C_SND_VOL ] != sndvol_codec ){ if( vreg_ctr[ VREG_C_SND_VOL ] != sndvol_codec ){
sndvol_codec = vreg_ctr[ VREG_C_SND_VOL ]; sndvol_codec = vreg_ctr[ VREG_C_SND_VOL ];
#ifndef _CODEC_CTR_ #ifndef _CODEC_CTR_
iic_mcu_write_a_byte( IIC_SLA_DCP, 0, sndvol_codec ); iic_mcu_write_a_byte( IIC_SLA_DCP, 0, sndvol_codec );
// iic_mcu_write_a_byte( IIC_SLA_DCP, 0, (u8)((unsigned int)sndvol_codec * 4 / 5 ) );
#else #else
ÈñÆ©·é ÈñÆ©·é
iic_mcu_write_a_byte( IIC_SLA_CODEC, REG_ADRS_CODEC_VOL, sndvol_codec ); iic_mcu_write_a_byte( IIC_SLA_CODEC, REG_ADRS_CODEC_VOL, sndvol_codec );
@ -71,17 +79,31 @@ task_interval tsk_adc(){
} }
ADCEN = 1; ADCEN = 1;
ADM = 0b00011011; // セレクトモード、章圧、fCLK/6 ///ここから ADM = 0b00011011; // セレクトモード、章圧、fCLK/6 ///ここから
ADPC = 0x06; // ADCポートのセレクト ADPC = 0x06; // ADCポートのセレクト
ADS = ADC_SEL_TUNE; ADS = ADC_SEL_TUNE;
// NOP(); // NOP();
ADCS = 1; // AD開始。 /// ここまでに、1us以上開ける ADCS = 1; // AD開始。 /// ここまでに、1us以上開ける
ADIF = 0; ADIF = 0;
ADMK = 0; ADMK = 0;
LED_duty_TUNE = ((u16)( vreg_ctr[ VREG_C_TUNE ] ) << 2);
// TUNE_LED ここかよ!
switch( vreg_ctr[ VREG_C_LED_TUNE ] ){
case( 1 ): // 点灯
LED_duty_TUNE = 0;
break;
case( 2 ): //
LED_duty_TUNE = LED_BRIGHT_MAX - vreg_ctr[ VREG_C_TUNE ];
break;
default: // 消灯
LED_duty_TUNE = vreg_ctr[ VREG_C_LED_BRIGHT ];
break;
}
return( 8 ); return( 8 );
} }
} }
@ -132,11 +154,7 @@ __interrupt void int_adc(){
break; break;
case( ADC_SEL_VOL ): case( ADC_SEL_VOL ):
temp = ADCRH; hist_snd_vol[ index ] = ADCRH;
if( temp > 200 ){
temp = 200;
}
hist_snd_vol[ index ] = temp;
vreg_ctr[ VREG_C_SND_VOL ] = getmean3( hist_snd_vol ); vreg_ctr[ VREG_C_SND_VOL ] = getmean3( hist_snd_vol );
break; break;

View File

@ -25,6 +25,7 @@ typedef struct{
unsigned char dipsw0 :1; unsigned char dipsw0 :1;
unsigned char dipsw1 :1; unsigned char dipsw1 :1;
unsigned char dipsw2 :1; unsigned char dipsw2 :1;
unsigned char reboot :1;
}system_status_; }system_status_;
extern system_status_ system_status; extern system_status_ system_status;

View File

@ -3,13 +3,16 @@
#define _debug_ #define _debug_
// #define _debug_led_
#define MCU_VER_MAJOR 0; #define MCU_VER_MAJOR 0;
#define MCU_VER_MINOR 3; #define MCU_VER_MINOR 4;
#define _MODEL_TEG2_ //#define _MODEL_TEG2_
//#define _MODEL_WM0_ //#define _MODEL_WM0_
//#define _MODEL_TS0_ #define _MODEL_TS0_
//#define _MODEL_CTR_ //#define _MODEL_CTR_
@ -31,12 +34,13 @@
#define _MCU_BSR_ #define _MCU_BSR_
#endif #endif
/*
#ifdef _MODEL_CTR_ #ifdef _MODEL_CTR_
#define _PMIC_CTR_ #define _PMIC_CTR_
#define _MCU_BSR_ #define _MCU_BSR_
#define _CODEC_CTR_ #define _CODEC_CTR_
#endif #endif
*/
#endif #endif

View File

@ -17,8 +17,7 @@
#ifdef _MCU_BSR_ #ifdef _MCU_BSR_
#ifdef 1 // #ifdef _MODEL_TS0_ || _MODEL_WM0_
//#ifdef _MODEL_WM0_
// ワーキングモデルはI2Cが逆 // ワーキングモデルはI2Cが逆
#define ACKD ACKD1 #define ACKD ACKD1
@ -28,7 +27,6 @@
#define IICAPR0 IICAPR10 #define IICAPR0 IICAPR10
#define IICRSV IICRSV1 #define IICRSV IICRSV1
#define IICA IICA1 #define IICA IICA1
#define IICAEN IICA1EN
#define IICAIF IICAIF1 #define IICAIF IICAIF1
#define IICAMK IICAMK1 #define IICAMK IICAMK1
#define IICAPR1 IICAPR11 #define IICAPR1 IICAPR11
@ -47,38 +45,9 @@
#define WREL WREL1 #define WREL WREL1
#define WTIM WTIM1 #define WTIM WTIM1
#define TRC TRC1 #define TRC TRC1
#define SMC SMC1
#else
#define ACKD ACKD0
#define ACKE ACKE0
#define COI COI0
#define IICAEN IICA0EN
#define IICAPR0 IICAPR00
#define IICRSV IICRSV0
#define IICA IICA0
#define IICAEN IICA0EN
#define IICAIF IICAIF0
#define IICAMK IICAMK0
#define IICAPR1 IICAPR10
#define IICCTL0 IICCTL00
#define IICE IICE0
#define IICF IICF0
#define IICS IICS0
#define IICWH IICWH0
#define IICWL IICWL0
#define LREL LREL0
#define SPD SPD0
#define SPIE SPIE0
#define STCEN STCEN0
#define STD STD0
#define SVA SVA0
#define WREL WREL0
#define WTIM WTIM0
#endif
#endif #endif
@ -118,11 +87,13 @@ __interrupt void int_iic_ctr(){
rtc_unlock(); rtc_unlock();
// IRQレジスタリードで、割り込みピンの設定 // レジスタリードで、割り込みピンの設定
IRQ0_neg; IRQ0_neg;
if(! (( vreg_ctr[ VREG_C_IRQ0 ] == 0 ) if(! (( vreg_ctr[ VREG_C_IRQ0 ] == 0 )
&& ( vreg_ctr[ VREG_C_IRQ1 ] == 0 ) && ( vreg_ctr[ VREG_C_IRQ1 ] == 0 )
&& ( vreg_ctr[ VREG_C_IRQ2 ] == 0x02 )) ){ // 暫定 && ( vreg_ctr[ VREG_C_IRQ2 ] == 0 )
&& ( vreg_ctr[ VREG_C_IRQ3 ] == 0 )
) ){
IRQ0_ast; IRQ0_ast;
} }
@ -291,8 +262,10 @@ void IIC_ctr_Init( void ){
WTIM = 1; // 自動でACKを返した後clkをLに固定する WTIM = 1; // 自動でACKを返した後clkをLに固定する
ACKE = 1; // ダメCPUは無視して次の通信をはじめるかもしれないんで早くclkを開放しないといけない ACKE = 1; // ダメCPUは無視して次の通信をはじめるかもしれないんで早くclkを開放しないといけない
IICWL = 6; // L期間の長さ IICWH = 8;
IICWH = 5; IICWL = 10; // L期間の長さ
SMC = 1;
IICAMK = 0; // 割り込みを許可 IICAMK = 0; // 割り込みを許可

View File

@ -272,12 +272,14 @@ err iic_mcu_write( u8 slave, u8 adrs, u8 len, u8* src ){
iic_mcu_busy = 1; iic_mcu_busy = 1;
// スタートコンディションとスレーブの呼び出し... // スタートコンディションとスレーブの呼び出し...
IICMK10 = 1; IICMK10 = 1;
IICIF10 = 0;
if( iic_mcu_call_slave( slave ) != 0 ){ if( iic_mcu_call_slave( slave ) != 0 ){
iic_mcu_busy = 0; iic_mcu_busy = 0;
EI(); EI();
return( ERR_NAK ); return( ERR_NAK );
} }
IICIF10 = 0;
if( !iic_mcu_wo_dma ){ if( !iic_mcu_wo_dma ){
// DMAを使用する通常 // DMAを使用する通常
@ -302,7 +304,6 @@ err iic_mcu_write( u8 slave, u8 adrs, u8 len, u8* src ){
// DMAを使用しない // // DMAを使用しない //
// レジスタアドレスの送信 // レジスタアドレスの送信
IICIF10 = 0;
SIO10 = adrs; SIO10 = adrs;
IICMK10 = 0; IICMK10 = 0;
@ -322,32 +323,15 @@ err iic_mcu_write( u8 slave, u8 adrs, u8 len, u8* src ){
DMA転送が終わっただけでI2Cの転送は終わってません DMA転送が終わっただけでI2Cの転送は終わってません
======================================================== */ ======================================================== */
__interrupt void int_dma1(){ __interrupt void int_dma1(){
u8 hoge; IICIF10 = 0;
hoge = IICIF10;
DMAMK1 = 1; DMAMK1 = 1;
DEN1 = 0; DEN1 = 0;
IICMK10 = 0; IICMK10 = 1;
while(( SSR02 & TSF0 ) != 0 ){ while(( SSR02L & TSF0 ) != 0 ){;
NOP();
} }
// 最後のバイト転送後、I2C割り込みが発生する // 最後のバイト転送後、I2C割り込みが発生する
} // ↓
/* ========================================================
IIC MCUのバイト送出完了割り込み
======================================================== */
__interrupt void int_iic10(){
if( iic_mcu_wo_dma ){
// DMA使用せず、転送途中
if( iic_send_wo_dma_len != 0 ){
SIO10 = *p_iic_send_wo_dma_dat;
p_iic_send_wo_dma_dat++;
iic_send_wo_dma_len--;
return;
}
}
// 共通(最終バイト送信完了) // 共通(最終バイト送信完了)
IICMK10 = 1; IICMK10 = 1;
// ISR中で外の関数を呼ぶのは都合が悪いので展開 // ISR中で外の関数を呼ぶのは都合が悪いので展開
@ -369,6 +353,45 @@ __interrupt void int_iic10(){
} }
iic_mcu_wo_dma = 0; iic_mcu_wo_dma = 0;
iic_mcu_busy = 0; iic_mcu_busy = 0;
}
/* ========================================================
IIC MCUのバイト送出完了割り込み
======================================================== */
__interrupt void int_iic10(){
if( iic_mcu_wo_dma ){
// DMA使用せず、転送途中
if( iic_send_wo_dma_len != 0 ){
SIO10 = *p_iic_send_wo_dma_dat;
p_iic_send_wo_dma_dat++;
iic_send_wo_dma_len--;
return;
}
iic_mcu_wo_dma = 0;
}
// 共通(最終バイト送信完了)
IICMK10 = 1;
// ISR中で外の関数を呼ぶのは都合が悪いので展開
// iic_mcu_send_sp();
{
ST0 = 0x0004;
SOE0 = 0; // 受信の時はもっと前に「も」設定してる。(NACK出力)
SO0 = 0x0000 | TAUS_MASK; // SCL
NOP();
NOP();
NOP();
NOP();
SO0 = 0x0400 | TAUS_MASK; // SCL
NOP();
NOP();
NOP();
NOP();
SO0 = 0x0404 | TAUS_MASK;
}
iic_mcu_busy = 0;
} }
@ -503,6 +526,8 @@ void iic2m_bus_reset(){
======================================================== */ ======================================================== */
void iic_mcu_start(){ void iic_mcu_start(){
DST1 = 0;
DEN1 = 0;
I2C_PU = 1; I2C_PU = 1;
SAU0EN = 1; SAU0EN = 1;
NOP(); // 4clkあける NOP(); // 4clkあける
@ -533,5 +558,3 @@ void iic_mcu_stop(){
SAU0EN = 0; SAU0EN = 0;
iic_mcu_initialized = 0; iic_mcu_initialized = 0;
} }

View File

@ -10,9 +10,7 @@
extern u8 vreg_twl[]; extern u8 vreg_twl[];
#ifdef _MCU_BSR_ #ifdef _MCU_BSR_
//#ifdef _MODEL_TS0_ || _MODEL_WM0_
//#ifdef _MODEL_WM0_
#ifdef 1
// ワーキングモデルはI2Cが逆 // ワーキングモデルはI2Cが逆
#define ACKD ACKD0 #define ACKD ACKD0
@ -22,10 +20,9 @@ extern u8 vreg_twl[];
#define IICAPR0 IICAPR00 #define IICAPR0 IICAPR00
#define IICRSV IICRSV0 #define IICRSV IICRSV0
#define IICA IICA0 #define IICA IICA0
#define IICAEN IICA0EN
#define IICAIF IICAIF0 #define IICAIF IICAIF0
#define IICAMK IICAMK0 #define IICAMK IICAMK0
#define IICAPR1 IICAPR10 #define IICAPR1 IICAPR01
#define IICCTL0 IICCTL00 #define IICCTL0 IICCTL00
#define IICE IICE0 #define IICE IICE0
#define IICF IICF0 #define IICF IICF0
@ -40,36 +37,8 @@ extern u8 vreg_twl[];
#define SVA SVA0 #define SVA SVA0
#define WREL WREL0 #define WREL WREL0
#define WTIM WTIM0 #define WTIM WTIM0
#define SMC SMC0
#else
#define ACKD ACKD1
#define ACKE ACKE1
#define COI COI1
#define IICAEN IICA1EN
#define IICAPR0 IICAPR10
#define IICRSV IICRSV1
#define IICA IICA1
#define IICAEN IICA1EN
#define IICAIF IICAIF1
#define IICAMK IICAMK1
#define IICAPR1 IICAPR11
#define IICCTL0 IICCTL10
#define IICE IICE1
#define IICF IICF1
#define IICS IICS1
#define IICWH IICWH1
#define IICWL IICWL1
#define LREL LREL1
#define SPD SPD1
#define SPIE SPIE1
#define STCEN STCEN1
#define STD STD1
#define SVA SVA1
#define WREL WREL1
#define WTIM WTIM1
#endif
#endif #endif
#ifndef _MCU_BSR_ #ifndef _MCU_BSR_
@ -202,8 +171,10 @@ void IIC_twl_Init( void ){
WTIM = 1; // 自動でACKを返した後clkをLに固定する WTIM = 1; // 自動でACKを返した後clkをLに固定する
ACKE = 1; // ダメCPUは無視して次の通信をはじめるかもしれないんで早くclkを開放しないといけない ACKE = 1; // ダメCPUは無視して次の通信をはじめるかもしれないんで早くclkを開放しないといけない
IICWL = 6; // LŠúŠÔÌ·³<E2809A>i<EFBFBD>H<EFBFBD>j IICWH = 8;
IICWH = 5; IICWL = 10; // L期間の長さ
SMC = 1;
IICAMK = 0; // 割り込みを許可 IICAMK = 0; // 割り込みを許可

View File

@ -9,7 +9,6 @@
#pragma section @@CODE ROM_CODE #pragma section @@CODE ROM_CODE
//#pragma section @@CNST ROM_CNST //#pragma section @@CNST ROM_CNST
//========================================================= //=========================================================
#ifndef _incs_h_ #ifndef _incs_h_
#define _incs_h_ #define _incs_h_

View File

@ -17,6 +17,9 @@
#pragma interrupt INTP7 intp21_RFTx #pragma interrupt INTP7 intp21_RFTx
#endif #endif
#ifdef _MCU_BSR_
#pragma interrupt INTP23 intp23_ACC_ready // 加速度センサ、データ準備完了
#endif
//#pragma interrupt INTCMP0 fn_intcmp0 //#pragma interrupt INTCMP0 fn_intcmp0
//#pragma interrupt INTCMP1 fn_intcmp1 //#pragma interrupt INTCMP1 fn_intcmp1

View File

@ -18,5 +18,26 @@ typedef unsigned char err;
} \ } \
} }
#if 0
// マスクされてたら、フラグは立てるが、割り込みは入れない。
#define set_irq( irqreg, bitpos ) \
{ \
vreg_ctr[ irqreg ] |= bitpos; \
if( ( vreg_ctr[ irqreg+8 ] & bitpos ) == 0 ){ \
IRQ0_ast; \
} \
}
#endif
// マスクされてたら、フラグも立てず、割り込みも入れない。
#define set_irq( irqreg, bitpos ) \
{ \
if( ( vreg_ctr[ irqreg+8 ] & bitpos ) == 0 ){ \
vreg_ctr[ irqreg ] |= bitpos; \
IRQ0_ast; \
} \
}
#endif #endif

View File

@ -26,8 +26,6 @@
#define BIT_MD123 1 #define BIT_MD123 1
#define BIT_MD0 0 #define BIT_MD0 0
// ======================================================== // ========================================================
static task_interval led_pow_normal(); static task_interval led_pow_normal();
static task_interval led_pow_hotaru(); static task_interval led_pow_hotaru();
@ -38,6 +36,10 @@ static task_interval led_pow_hotaru();
u8 wifi_TX; u8 wifi_TX;
// ========================================================
static const char MSG_MAIL[] = { 0b11110110, 0b11011010, 0b01101110, 0b10010100 };
#define MSG_SPD 70
// ======================================================== // ========================================================
void LED_init(){ void LED_init(){
/** /**
@ -60,20 +62,21 @@ void LED_init(){
= 1 << BIT_CKS0 | 0 << BIT_CCS0 | 0 << BIT_MASTER0 | 4 << BIT_STS0 | 0 << BIT_CIS0 | 4 << BIT_MD123 | 1 << BIT_MD0; = 1 << BIT_CKS0 | 0 << BIT_CCS0 | 0 << BIT_MASTER0 | 4 << BIT_STS0 | 0 << BIT_CIS0 | 4 << BIT_MD123 | 1 << BIT_MD0;
ISC = 0; ISC = 0;
TOM0 = 0b0000000011111110; // 出力モード。4はPWM出力しないが1にしないとTO5以降にクロックが届かない TOM0 = 0b0000000011111110; // 出力モード。4はPWM出力しないが1にしないとTO5以降にクロックが届かない
#if 0
#ifdef _MODEL_WM0_ #ifdef _MODEL_WM0_
TOL0 = 0b0000000000000010; TOL0 = 0b0000000000000010; // 出力を反転させるかフラグ
#else #else
#ifdef _MODEL_TS0_ #ifdef _MODEL_TS0_
TOL0 = 0b0000000000000110; TOL0 = 0b0000000000000110;
#endif #endif
TOL0 = 0b0000000000000110; TOL0 = 0b0000000000000110;
#endif
#endif #endif
TO0 = 0; // タイマー動作中で、タイマー出力にしてないときのピンのラッチ。タイマー出力を使わないなら0 TO0 = 0; // タイマー動作中で、タイマー出力にしてないときのピンのラッチ。タイマー出力を使わないなら0
TOE0 = 0b0000000011101110; // TOxをタイマーモジュールが制御 TOE0 = 0b0000000011101110; // TOxをタイマーモジュールが制御
TS0 = 0b0000000011101111; // 動作開始 TS0 = 0b0000000011101111; // 動作開始
TDR00 = 0x03FE; // 10bit, 周期 TDR00 = LED_BRIGHT_MAX - 1; // 10bit, 周期
} }
@ -112,7 +115,7 @@ enum LED_ILUM_MODE{
======================================================== */ ======================================================== */
task_interval tsk_led_pow(){ task_interval tsk_led_pow(){
switch( vreg_ctr[ VREG_C_LED_POW_ILUMI ] ){ switch( vreg_ctr[ VREG_C_LED_POW ] ){
case( LED_POW_ILM_AUTO ): case( LED_POW_ILM_AUTO ):
switch( system_status.pwr_state ){ switch( system_status.pwr_state ){
case( SLEEP ): case( SLEEP ):
@ -136,7 +139,11 @@ task_interval tsk_led_pow(){
case( LED_POW_ILM_OFF ): case( LED_POW_ILM_OFF ):
LED_duty_pow_H -= ( LED_duty_pow_H == 0x0000 )? 0: 1; LED_duty_pow_H -= ( LED_duty_pow_H == 0x0000 )? 0: 1;
LED_duty_pow_L -= ( LED_duty_pow_L == 0x0000 )? 0: 1; LED_duty_pow_L -= ( LED_duty_pow_L == 0x0000 )? 0: 1;
return( 0 ); if(( LED_duty_pow_H == 0 ) && ( LED_duty_pow_L == 0 )){
return( 250 );
}else{
return( 0 );
}
break; break;
case( LED_POW_ILM_HOTARU ): case( LED_POW_ILM_HOTARU ):
@ -147,7 +154,20 @@ task_interval tsk_led_pow(){
default: default:
return( led_pow_normal() ); return( led_pow_normal() );
break; break;
case( LED_POW_ILM_ONLY_RED ):
LED_duty_pow_H = 0x0000;
LED_duty_pow_L = LED_BRIGHT_MAX;
return( 250 );
break;
case( LED_POW_ILM_ONLY_BLUE ):
LED_duty_pow_H = LED_BRIGHT_MAX;
LED_duty_pow_L = 0x0000;
return( 250 );
break;
} }
} }
@ -245,11 +265,11 @@ static task_interval led_pow_hotaru(){
case( 2 ): case( 2 ):
case( 4 ): case( 4 ):
if( vreg_ctr[ VREG_C_BT_REMAIN ] < ( 255 * 0.2 ) ){ if( vreg_ctr[ VREG_C_BT_REMAIN ] < ( 255 * 0.2 ) ){
red_to = 0x03FF / 8; red_to = vreg_ctr[ VREG_C_LED_BRIGHT ];
blue_to = 0; blue_to = 0;
}else{ }else{
red_to = 0; red_to = 0;
blue_to = 0x03FF / 8; blue_to = vreg_ctr[ VREG_C_LED_BRIGHT ];
} }
break; break;
default: default:
@ -267,83 +287,130 @@ static task_interval led_pow_hotaru(){
/* ========================================================
======================================================== */
void set_LED_cam(){
if(( vreg_ctr[ VREG_C_CAM_LED ] & 0x01 ) != 0 ){
LED_duty_CAM = vreg_ctr[ VREG_C_LED_BRIGHT ];
}else{
LED_duty_CAM = 0;
}
if(( vreg_ctr[ VREG_C_CAM_LED ] & 0x02 ) != 0 ){
EGP0 |= 0x80;
}else{
EGP0 &= ~0x80;
}
}
/* ======================================================== /* ========================================================
// LED_Cam TO02 未 LED_Wifi 3
// LED_Charge 5     →PM 2 P24
LED_Wifi,2 3, P24
LED_TUNE 4
======================================================== */ ======================================================== */
task_interval tsk_led_wifi(){ task_interval tsk_led_wifi(){
// WiFi LED //
static u8 remain_wifi_tx; static u8 remain_wifi_tx;
static u8 state_wifi_tx; static u8 state_wifi_tx;
// フライトモードではNTRパルスが出ても電波でない→ switch( vreg_ctr[ VREG_C_LED_WIFI ] ){
// フライトレジスタ見なくてはならない case( WIFI_LED_OFF ):
if(( vreg_ctr[ VREG_C_WIFI_LED ] & REG_BIT_WIFI_ON ) == 0 ){ LED_duty_WiFi = 0;
return( 250 );
}
/*
// スリープ時
if( PM_SLP == 1 ){
// タスクで回すことはない trig_to_sleep_wifiLed() で減光状態にしてる
return;
}
*/
// 短いパルスを捕まえるために、割り込みフラグを見る
if( wifi_TX != 0 ){
wifi_TX = 0; wifi_TX = 0;
if(( vreg_ctr[ VREG_C_WIFI_LED ] & REG_BIT_WIFI_BLINK_ENA ) != 0 ){ state_wifi_tx = 0;
remain_wifi_tx = 2; remain_wifi_tx = 0;
}else{ LED_WIFI_2 = 0;
remain_wifi_tx = 0;
}
return( 250 ); return( 250 );
} break;
// 点滅パターン case( WIFI_LED_ON ):
if( remain_wifi_tx != 0 ){ // TX active default:
LED_duty_WiFi = vreg_ctr[ VREG_C_LED_BRIGHT ];
wifi_TX = 0;
state_wifi_tx = 0;
remain_wifi_tx = 0;
LED_WIFI_2 = 1;
return( 250 );
break;
case( WIFI_LED_TXAUTO ):
// 短いパルスを捕まえるために、割り込みフラグを見る
if( wifi_TX != 0 ){
wifi_TX = 0;
remain_wifi_tx = 2;
}
// 送信パターン
if( remain_wifi_tx != 0 ){ // TX active
switch( state_wifi_tx ){
case( 1 ):
case( 3 ):
case( 5 ):
LED_duty_WiFi = 0;
LED_WIFI_2 = 0;
break;
default:
LED_duty_WiFi = vreg_ctr[ VREG_C_LED_BRIGHT ];
LED_WIFI_2 = 1;
}
state_wifi_tx++;
if( state_wifi_tx == 32 ){
state_wifi_tx = 0;
remain_wifi_tx--;
}
return( 22 );
}else{
LED_duty_WiFi = vreg_ctr[ VREG_C_LED_BRIGHT ];
LED_WIFI_2 = 1;
return( 200 );
}
break;
case( WIFI_LED_PTN0 ):
LED_WIFI_2 = 1;
switch( state_wifi_tx ){ switch( state_wifi_tx ){
case( 1 ): case( 1 ):
case( 3 ): case( 3 ):
case( 5 ): case( 5 ):
LED_duty_WiFi = 0; LED_duty_WiFi = vreg_ctr[ VREG_C_LED_BRIGHT ];
break; break;
default: default:
LED_duty_WiFi = vreg_ctr[ VREG_C_LED_BRIGHT ]; LED_duty_WiFi = 0;
} }
state_wifi_tx++; state_wifi_tx++;
if( state_wifi_tx == 32 ){ if( state_wifi_tx == 16 ){
state_wifi_tx = 0; state_wifi_tx = 0;
remain_wifi_tx--;
} }
}else{ return( 50 );
set_led_wifi; break;
}
return( 28 );
}
case( WIFI_LED_PTN1 ):
LED_WIFI_2 = 1;
{
u8 dat;
if( remain_wifi_tx != 0 ){
LED_duty_WiFi = 0;
remain_wifi_tx = 0;
return( MSG_SPD );
}
dat = ( MSG_MAIL[ state_wifi_tx / 4 ] << (( state_wifi_tx % 4 ) *2 ) ) & 0xC0;
state_wifi_tx = ( dat == 0 )? 0: ( state_wifi_tx + 1 );
switch( dat ){
case( 0b00000000 ):
LED_duty_WiFi = 0;
remain_wifi_tx = 0;
return( MSG_SPD * 3 );
break;
case( 0b01000000 ):
default:
LED_duty_WiFi = 0;
remain_wifi_tx = 1;
return( MSG_SPD );
break;
case( 0b10000000 ):
LED_duty_WiFi = vreg_ctr[ VREG_C_LED_BRIGHT ];
remain_wifi_tx = 1;
return( MSG_SPD );
break;
case( 0b11000000 ):
LED_duty_WiFi = vreg_ctr[ VREG_C_LED_BRIGHT ];
remain_wifi_tx = 1;
return( MSG_SPD * 3 );
break;
}
}
}
}
/* ======================================================== /* ========================================================
@ -354,3 +421,65 @@ task_interval tsk_led_wifi(){
__interrupt void intp21_RFTx(){ __interrupt void intp21_RFTx(){
wifi_TX = 1; wifi_TX = 1;
} }
/* ========================================================
LED_Cam TO02
======================================================== */
task_interval tsk_led_cam(){
static u8 state_led_cam = 0;
switch( vreg_ctr[ VREG_C_LED_CAM ] ){
case( CAM_LED_OFF ):
default:
LED_duty_CAM = 0;
state_led_cam = 0;
break;
case( CAM_LED_ON ):
LED_duty_CAM = vreg_ctr[ VREG_C_LED_BRIGHT ];
state_led_cam = 0;
break;
case( CAM_LED_BLINK ):
case( CAM_LED_BY_TWL ):
if( state_led_cam == 0 ){
LED_duty_CAM = vreg_ctr[ VREG_C_LED_BRIGHT ];
state_led_cam = 1;
}else{
LED_duty_CAM = 0;
state_led_cam = 0;
}
break;
case( CAM_LED_ON_PLUSE ):
if( state_led_cam == 0 ){
LED_duty_CAM = vreg_ctr[ VREG_C_LED_BRIGHT ];
state_led_cam = 1;
}else{
vreg_ctr[ VREG_C_LED_CAM ] = CAM_LED_OFF;
return( 0 );
}
break;
case( CAM_LED_OFF_PLUSE ):
if( state_led_cam == 0 ){
LED_duty_CAM = 0;
state_led_cam = 1;
}else{
vreg_ctr[ VREG_C_LED_CAM ] = CAM_LED_ON;
return( 0 );
}
break;
}
return( 250 );
}
// 捨て看板
/* ========================================================
// LED_Charge 5     →PM
LED_TUNE 4
======================================================== */

View File

@ -2,36 +2,35 @@
#define __led__ #define __led__
// ====================================
// LED_DUTY // LED_DUTY
#define LED_duty_pow_L TDR07 #define LED_duty_pow_L TDR07
#define LED_duty_pow_H TDR06 #define LED_duty_pow_H TDR06
#define LED_duty_WiFi TDR03
#define LED_duty_CHARGE TDR05 #define LED_duty_CHARGE TDR05
#define LED_duty_WiFi TDR03
#define LED_duty_CAM TDR02 #define LED_duty_CAM TDR02
#define LED_duty_TUNE TDR01 #define LED_duty_TUNE TDR01
// wifi2はPWMできません。
void LED_init();
void LED_stop();
void set_LED_cam();
#define set_led_wifi \
if(( vreg_ctr[ VREG_C_WIFI_LED ] & 0x01 ) == 0 ){ \
LED_duty_WiFi = 0; \
MK2L |= 0x10; \
}else{ \
LED_duty_WiFi = vreg_ctr[ VREG_C_LED_BRIGHT ]; \
EGP0 |= 0x80; \
MK2L &= ~0x10; \
}
#define LED_BRIGHT_MAX 0x00FF
// ====================================
enum LED_ILUM_MODE{ enum LED_ILUM_MODE{
LED_POW_ILM_AUTO = 0, LED_POW_ILM_AUTO = 0,
LED_POW_ILM_ON, LED_POW_ILM_ON,
LED_POW_ILM_HOTARU, LED_POW_ILM_HOTARU,
LED_POW_ILM_OFF LED_POW_ILM_OFF,
LED_POW_ILM_ONLY_RED,
LED_POW_ILM_ONLY_BLUE
}; };
// ====================================
void LED_init();
void LED_stop();
#endif #endif

View File

@ -56,6 +56,7 @@ void FSL_Open(void);
void FSL_Close(void); void FSL_Close(void);
void hdwinit(void); void hdwinit(void);
void power_save(); void power_save();
static void hdwinit2();
extern void main_loop(); extern void main_loop();
extern void chk_bootCluster(); extern void chk_bootCluster();
@ -63,22 +64,28 @@ extern void chk_bootCluster();
// ======================================================== // ========================================================
void main(){ void main(){
u16 i = 0;
do{ // 電池接続時、16ms待ってみる
i+=1;
}while( i != 0 );
while(1){ while(1){
// 電池投入 //
// hdwinit(); 自動実行
// 電池投入時のみ初期化 // WDT_Restart();
#if 0 if( RTCEN ){
system_status.reboot = 1;
}else{
u8 pwup_delay0 = 0;
u8 pwup_delay1 = 0;
do{ // 電池接続時、16ms待ってみる
pwup_delay0 += 1;
do{
pwup_delay1 += 1;
}while( pwup_delay1 != 0 ); // コンパイラが不出来のため…。
}while( pwup_delay0 != 0 );
hdwinit2();
}
#if 1
// ファームの整合性チェック // // ファームの整合性チェック //
{ {
u8 i; u8 i;
@ -102,7 +109,7 @@ void main(){
} }
#endif #endif
chk_bootCluster(); chk_bootCluster();
// 通常運転 // 通常運転
main_loop(); main_loop();
@ -115,9 +122,7 @@ void main(){
======================================================== */ ======================================================== */
void power_save(){ void power_save(){
if( !renge_task_interval_run_force ){ HALT();
HALT();
}
} }
@ -163,7 +168,10 @@ void hdwinit(void){ //
LVIM = 0b00000000; /* LVI動作禁止 */ LVIM = 0b00000000; /* LVI動作禁止 */
/* 電源電圧(VDD)<検出電圧(VLVI)時に割込発生 */ /* 電源電圧(VDD)<検出電圧(VLVI)時に割込発生 */
/* 電源電圧(VDD)≧検出電圧<VLVI)、または動作禁止時に低電圧検出 */ /* 電源電圧(VDD)≧検出電圧<VLVI)、または動作禁止時に低電圧検出 */
}
void hdwinit2(){
// ポート設定 // ポート設定
P0 = 0b00000000; P0 = 0b00000000;
P1 = 0b00000000; P1 = 0b00000000;
@ -230,19 +238,22 @@ void hdwinit(void){ //
POM3 = 0b00000110; POM3 = 0b00000110;
POM7 = 0b00000000; POM7 = 0b00000000;
/*--- 割り込み設定 ---------*/ /*--- 割り込み設定 ---------*/
IF0L = 0b00000000; /* 割り込み要求フラグクリア */ IF0 = 0x0000; /* 割り込み要求フラグクリア */
IF0H = 0b00000000; IF1 = 0x0000;
IF1L = 0b00000000; #ifdef _MCU_BSR_
IF1H = 0b00000000; IF2 = 0x0000;
IF2L = 0b00000000; #else
IF2L = 0x00;
#endif
MK0L = 0b11111111; /* 割り込み禁止 */ MK0 = 0xFFFF; /* 割り込み禁止 */
MK0H = 0b11111111; MK1 = 0xFFFF;
MK1L = 0b11111111; #ifdef _MCU_BSR_
MK1H = 0b11111111; MK2 = 0xFFFF;
MK2L = 0b11111111; #else
MK2L = 0xFF;
#endif
PR00L = 0b11111111; /* 割り込み優先順位、全て低位(LV3) */ PR00L = 0b11111111; /* 割り込み優先順位、全て低位(LV3) */
PR10L = 0b11111111; PR10L = 0b11111111;
@ -256,9 +267,17 @@ void hdwinit(void){ //
PR12L = 0b11111111; PR12L = 0b11111111;
/*--- 外部割込の有効エッジ設定 ---*/ /*--- 外部割込の有効エッジ設定 ---*/
EGP0 = 0b00000000; /* 立上りエッジの検出禁止 */ #ifdef _MCU_BSR_
EGN0 = 0b00000000; /* 立下りエッジの検出禁止 */ EGP0 = 0b00110001;
EGN0 = 0b01110001;
EGP2 = 0b00000010;
EGN2 = 0b00000000;
// EGP2 = 0b00001010;
// EGN2 = 0b00000000;
#else
EGP0 = 0b10110001;
EGN0 = 0b01110001;
#endif
/*--- キー割り込み設定 ---*/ /*--- キー割り込み設定 ---*/
KRM = 0b00000000; /* 全キー割り込み信号を検出しない */ KRM = 0b00000000; /* 全キー割り込み信号を検出しない */

View File

@ -3,18 +3,68 @@
(touchしてね) (touchしてね)
****************************************************************************/ ****************************************************************************/
#include "config.h"
#pragma section @@CNSTL MGC_LOAD AT 0x0FF6
__far static const unsigned char MGC_LOAD[] = __TIME__;
#pragma section @@CNST MGC_MIMI AT 0x2100
static const unsigned char MGC_HEAD[] = __TIME__;
#pragma section @@CNST MGC_TAIL AT 0x47F6
static const unsigned char MGC_TAIL[] = __TIME__;
/*
(使)
V0.2 31 34 3A 33 35 3A 33 35 00 00
{ 0x31, 0x34, 0x3A, 0x33, 0x35, 0x3A, 0x33, 0x35, 0x00, 0x00 };
ctr_wm0
31373A30353A32310000
{ 0x31, 0x37, 0x3A, 0x30, 0x35, 0x3A, 0x32, 0x31, 0x00, 0x00 };
ctr_wm0_2
31303A34393A35390000
{ 0x31, 0x30, 0x3A, 0x34, 0x39, 0x3A, 0x35, 0x39, 0x00, 0x00 };
bsr_V0.2_090828_WM2
31323A35393A32350000
{ 0x31, 0x32, 0x3A, 0x35, 0x39, 0x3A, 0x32, 0x35, 0x00, 0x00 };
*/
/*
// V0.1の署名(日付) 30 38 3A 34 35 3A 33 39 00 00
#pragma section @@CNSTL MGC_LOAD AT 0x0FF6 #pragma section @@CNSTL MGC_LOAD AT 0x0FF6
//__far static const unsigned char MGC_LOAD[] = __TIME__;
__far static const unsigned char MGC_LOAD[] = __far static const unsigned char MGC_LOAD[] =
{ 0x30, 0x38, 0x3A, 0x34, 0x35, 0x3A, 0x33, 0x39, 0x00, 0x00 }; { 0x30, 0x38, 0x3A, 0x34, 0x35, 0x3A, 0x33, 0x39, 0x00, 0x00 };
#pragma section @@CNST MGC_MIMI AT 0x2100 #pragma section @@CNST MGC_MIMI AT 0x2100
//static const unsigned char MGC_HEAD[] = __TIME__;
static const unsigned char MGC_HEAD[] = static const unsigned char MGC_HEAD[] =
{ 0x30, 0x38, 0x3A, 0x34, 0x35, 0x3A, 0x33, 0x39, 0x00, 0x00 }; { 0x30, 0x38, 0x3A, 0x34, 0x35, 0x3A, 0x33, 0x39, 0x00, 0x00 };
#pragma section @@CNST MGC_TAIL AT 0x47F6 #pragma section @@CNST MGC_TAIL AT 0x47F6
//static const unsigned char MGC_TAIL[] = __TIME__;
static const unsigned char MGC_TAIL[] = static const unsigned char MGC_TAIL[] =
{ 0x30, 0x38, 0x3A, 0x34, 0x35, 0x3A, 0x33, 0x39, 0x00, 0x00 }; { 0x30, 0x38, 0x3A, 0x34, 0x35, 0x3A, 0x33, 0x39, 0x00, 0x00 };
// V0.4以降
#pragma section @@CNSTL MGC_LOAD AT 0x0FF6
__far static const unsigned char MGC_LOAD[] = __TIME__;
#pragma section @@CNST MGC_MIMI AT 0x2100
static const unsigned char MGC_HEAD[] = __TIME__;
#pragma section @@CNST MGC_TAIL AT 0x47F6
static const unsigned char MGC_TAIL[] = __TIME__;
*/

View File

@ -45,6 +45,7 @@ system_status_ system_status;
u8 off_delay; // 電源 OFF から PWSW 等で電源オンする際、押してる時間をカウントするのに使う u8 off_delay; // 電源 OFF から PWSW 等で電源オンする際、押してる時間をカウントするのに使う
extern u8 boot_ura;
/* ======================================================== /* ========================================================
loader.c loader.c
@ -52,27 +53,47 @@ u8 off_delay; //
void main_loop( void ){ void main_loop( void ){
// 電池投入時の1回のみ // 電池投入時の1回のみ
vreg_ctr_init(); iic_mcu_stop();
if(( RESF & REG_BIT_WDT_DET ) != 0 ){ RTCEN = 0;
vreg_ctr[ VREG_C_IRQ1 ] |= REG_BIT_WDT_DET;
iic_mcu_start();
}else{
PM_reset();
}
RTC_init(); // 電池初投入ビットも立てます RTC_init(); // 電池初投入ビットも立てます
if( system_status.reboot == 0 ){
/*
{
u8 temp;
temp = ( RESF & 0b10010001 );
if( temp != 0 ){
vreg_ctr[ VREG_C_IRQ1 ] |= REG_BIT_WDT_DET;
system_status.pwr_state = ON;
}else{
PM_reset();
system_status.pwr_state = OFF_TRIG;
}
}
*/
system_status.pwr_state = OFF_TRIG;
}else{
system_status.pwr_state = ON;
}
vreg_ctr_init();
vreg_twl_init(); vreg_twl_init();
iic_mcu_start();
read_dipsw(); read_dipsw();
// 特定スイッチで何かするか? // 特定スイッチで何かするか?
renge_init(); renge_init();
/*
if(( vreg_ctr[ VREG_C_IRQ1 ] & REG_BIT_WDT_DET ) != 0 ){ if(( vreg_ctr[ VREG_C_IRQ1 ] & REG_BIT_WDT_DET ) != 0 ){
system_status.pwr_state = ON_TRIG; system_status.pwr_state = OFF;
}else{ }else{
system_status.pwr_state = OFF_TRIG; system_status.pwr_state = OFF_TRIG;
} }
*/
renge_task_interval_run_force = 1; renge_task_interval_run_force = 1;
EI(); EI();
@ -82,11 +103,23 @@ void main_loop( void ){
renge_task_interval_run(); // 内部で、システムtickまたは強制起動します renge_task_interval_run(); // 内部で、システムtickまたは強制起動します
renge_task_immed_run(); // ここのループが廻る度に実行されます renge_task_immed_run(); // ここのループが廻る度に実行されます
power_save(); power_save();
/*
{
u8 str[4];
if(( system_status.pwr_state != OFF )){
str[3] = system_status.pwr_state;
str[2] = MK1H;
str[1] = vreg_ctr[ VREG_C_STATUS ];
str[0] = SEC;
iic_mcu_write( 0x44, 0, 4, &str[0] );
}
}
*/
} }
} }
/* ======================================================== /* ========================================================
======================================================== */ ======================================================== */
static void read_dipsw(){ static void read_dipsw(){

View File

@ -185,17 +185,6 @@ STOP
/* ========================================================
PMICにリセットコマンドを送る
======================================================== */
err PM_reset(){
iic_mcu_start();
return( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_CONT, 0x00 ) );
}
/* ======================================================== /* ========================================================
PMIC達の初期化 PMIC達の初期化
@ -291,7 +280,7 @@ Else
NewRCOMP = StartingRCOMP NewRCOMP = StartingRCOMP
End If End If
*/ */
if( iic_mcu_write( IIC_SLA_BT_GAUGE, BT_BT_PARAM_PANA_RCOMP_ADRS, 2, newrcomp ) == ERR_SUCCESS ){ if( iic_mcu_write( IIC_SLA_BT_GAUGE, BT_BT_PARAM_PANA_RCOMP_ADRS, 2, &newrcomp ) == ERR_SUCCESS ){
temp_old = vreg_ctr[ VREG_C_BT_TEMP ]; temp_old = vreg_ctr[ VREG_C_BT_TEMP ];
} }
count += 1; count += 1;
@ -312,19 +301,19 @@ err PM_LCD_on(){
wait_ms( DELAY_PM_TSS_50B ); wait_ms( DELAY_PM_TSS_50B );
wait_ms( DELAY_PM_TSS_50B ); wait_ms( DELAY_PM_TSS_50B );
iic_mcu_write_a_byte( IIC_SLA_PMIC, 0x22, 0x4A ); // バグ持ちPMIC対策 iic_mcu_write_a_byte( IIC_SLA_PMIC, 0x22, 0x4A ); // バグ持ちPMIC対策
vreg_ctr[ VREG_C_STATUS0 ] |= REG_BIT_LCD_POW; vreg_ctr[ VREG_C_STATUS ] |= REG_BIT_LCD_POW;
return( PM_chk_LDSW() ); return( PM_chk_LDSW() );
} }
err PM_BL_on(){ err PM_BL_on(){
wait_ms( 10 ); wait_ms( 10 );
vreg_ctr[ VREG_C_STATUS0 ] |= REG_BIT_BL; vreg_ctr[ VREG_C_STATUS ] |= REG_BIT_BL;
return( PM_chk_LDSW() ); return( PM_chk_LDSW() );
} }
err PM_BL_off(){ err PM_BL_off(){
vreg_ctr[ VREG_C_STATUS0 ] &= ~REG_BIT_BL; vreg_ctr[ VREG_C_STATUS ] &= ~REG_BIT_BL;
return( ERR_SUCCESS ); return( ERR_SUCCESS );
} }
@ -332,7 +321,7 @@ err PM_LCD_off(){
PM_TEG_LCD_OFF = 1; PM_TEG_LCD_OFF = 1;
wait_ms( 1 + 50 ); wait_ms( 1 + 50 );
PM_VDDLCD_off(); // 残ってたの全部止めます。 PM_VDDLCD_off(); // 残ってたの全部止めます。
vreg_ctr[ VREG_C_STATUS0 ] &= ~( REG_BIT_BL | REG_BIT_LCD_POW ); vreg_ctr[ VREG_C_STATUS ] &= ~( REG_BIT_BL | REG_BIT_LCD_POW );
return( ERR_SUCCESS ); return( ERR_SUCCESS );
} }
@ -355,7 +344,17 @@ task_status_immed tski_vcom_set(){
======================================================== */ ======================================================== */
err PM_LCD_vcom_set(){ err PM_LCD_vcom_set(){
u8 rv; u8 rv;
/*
rv = iic_mcu_write_a_byte( rv = iic_mcu_write_a_byte(
IIC_SLA_PMIC,
PM_REG_ADRS_POW_DAC1,
92 ); // がっかりなことに、PMICはバースト書き込み不可
rv |= iic_mcu_write_a_byte(
IIC_SLA_PMIC,
PM_REG_ADRS_POW_DAC2,
92 );
/*/
rv = iic_mcu_write_a_byte(
IIC_SLA_PMIC, IIC_SLA_PMIC,
PM_REG_ADRS_POW_DAC1, PM_REG_ADRS_POW_DAC1,
vreg_ctr[ VREG_C_VCOM_T ] ); // がっかりなことに、PMICはバースト書き込み不可 vreg_ctr[ VREG_C_VCOM_T ] ); // がっかりなことに、PMICはバースト書き込み不可
@ -363,6 +362,7 @@ err PM_LCD_vcom_set(){
IIC_SLA_PMIC, IIC_SLA_PMIC,
PM_REG_ADRS_POW_DAC2, PM_REG_ADRS_POW_DAC2,
vreg_ctr[ VREG_C_VCOM_B ] ); vreg_ctr[ VREG_C_VCOM_B ] );
// */
return( rv ); return( rv );
} }
@ -393,7 +393,7 @@ err PM_LCD_on(){
wait_ms( DELAY_PM_TSS_50B ); wait_ms( DELAY_PM_TSS_50B );
iic_mcu_write_a_byte( IIC_SLA_PMIC, 0x22, 0x4A ); // バグ持ちPMIC対策 iic_mcu_write_a_byte( IIC_SLA_PMIC, 0x22, 0x4A ); // バグ持ちPMIC対策
vreg_ctr[ VREG_C_STATUS0 ] |= REG_BIT_LCD_POW; vreg_ctr[ VREG_C_STATUS ] |= REG_BIT_LCD_POW;
return( PM_chk_LDSW() ); return( PM_chk_LDSW() );
} }
@ -402,14 +402,14 @@ err PM_BL_on(){
PM_set_BL( 0x03 ); PM_set_BL( 0x03 );
wait_ms( 10 ); wait_ms( 10 );
vreg_ctr[ VREG_C_STATUS0 ] |= REG_BIT_BL; vreg_ctr[ VREG_C_STATUS ] |= REG_BIT_BL;
return( PM_chk_LDSW() ); return( PM_chk_LDSW() );
} }
err PM_BL_off(){ err PM_BL_off(){
PM_set_BL( 0x00 ); PM_set_BL( 0x00 );
vreg_ctr[ VREG_C_STATUS0 ] &= ~REG_BIT_BL; vreg_ctr[ VREG_C_STATUS ] &= ~REG_BIT_BL;
return( ERR_SUCCESS ); return( ERR_SUCCESS );
} }
@ -419,7 +419,7 @@ err PM_LCD_off(){
wait_ms( 1 + 50 ); wait_ms( 1 + 50 );
PM_VDDLCD_off(); // 残ってたの全部止めます。 PM_VDDLCD_off(); // 残ってたの全部止めます。
vreg_ctr[ VREG_C_STATUS0 ] &= ~( REG_BIT_BL | REG_BIT_LCD_POW ); vreg_ctr[ VREG_C_STATUS ] &= ~REG_BIT_LCD_POW;
return( ERR_SUCCESS ); return( ERR_SUCCESS );
} }
@ -547,34 +547,36 @@ err PM_sys_pow_on(){
/* ======================================================== /* ========================================================
OFFシーケンス OFFシーケンス
todo:
======================================================== */ ======================================================== */
err PM_sys_pow_off(){ err PM_sys_pow_off(){
#ifndef _PMIC_TWL_ #ifndef _PMIC_TWL_
PM_BL_off(); PM_BL_off();
PM_LCD_off();// TCOM,VCS OFF も消してきます。 PM_LCD_off();// TCOM,VCS OFF も消してきます。
PM_reset_ast(); PM_reset_ast();
RESET2_ast; RESET2_ast;
FCRAM_RST_ast; FCRAM_RST_ast;
PM_off(); PM_off();
PM_LDSW_off(); PM_LDSW_off();
#else #else
wait_ms( 50 ); if( RESET1_n ){
if( RESET1_n ){ // 異常終了から来た場合 RESETs_ast;
FCRAM_RST_ast;
PM_TEG_PWSW = 1; PM_TEG_PWSW = 1;
wait_ms( 250 ); wait_ms( 250 );
wait_ms( 250 ); wait_ms( 250 );
wait_ms( 250 ); wait_ms( 250 );
PM_TEG_PWSW = 0; PM_TEG_PWSW = 0;
} }
RESETs_ast; RESETs_ast;
FCRAM_RST_ast; FCRAM_RST_ast;
#endif
#endif
return( ERR_SUCCESS ); return( ERR_SUCCESS );
} }
@ -610,8 +612,8 @@ task_interval tsk_batt(){
static u8 charge_hys = 0; // ヒステリシスで上限下限を拡張するとき1 static u8 charge_hys = 0; // ヒステリシスで上限下限を拡張するとき1
// 電源周りのステータスが変化? // 電源周りのステータスが変化?
set_bit( PM_EXTDC, vreg_ctr[ VREG_C_STATUS0 ], REG_BIT_POW_SUPPLY ); set_bit( PM_EXTDC, vreg_ctr[ VREG_C_STATUS ], REG_BIT_POW_SUPPLY );
set_bit( !BT_CHG_n, vreg_ctr[ VREG_C_STATUS0 ], REG_BIT_BATT_CHARGE ); set_bit( !BT_CHG_n, vreg_ctr[ VREG_C_STATUS ], REG_BIT_BATT_CHARGE );
// →割り込み。miscの中でよろしくやってくれている。 // →割り込み。miscの中でよろしくやってくれている。
// 充電 // 充電
@ -687,41 +689,40 @@ task_status_immed ntr_pmic_comm(){
DI(); DI();
// offリクエスト // offリクエスト
if(( reg_shadow & ( 1 << 6 )) != 0 ){ if(( reg_shadow & REG_BIT_TWL_REQ_OFF_REQ ) != 0 ){
vreg_ctr[ VREG_C_IRQ2 ] |= REG_BIT_TWL_OFF_REQ; set_irq( VREG_C_IRQ3, REG_BIT_TWL_OFF_REQ );
if( ( vreg_ctr[ VREG_C_IRQ_MASK2 ] & REG_BIT_TWL_OFF_REQ ) == 0 ){ vreg_ctr[ VREG_C_IRQ3 ] |= REG_BIT_TWL_OFF_REQ;
if( ( vreg_ctr[ VREG_C_IRQ_MASK3 ] & REG_BIT_TWL_OFF_REQ ) == 0 ){
IRQ0_ast; IRQ0_ast;
} }
} }
// リセットリクエスト // リセットリクエスト
if(( reg_shadow & ( 1 << 0 )) != 0 ){ if(( reg_shadow & REG_BIT_TWL_REQ_RST_REQ ) != 0 ){
vreg_ctr[ VREG_C_IRQ2 ] |= REG_BIT_TWL_RESET_REQ; vreg_ctr[ VREG_C_IRQ3 ] |= REG_BIT_TWL_RESET_REQ;
if( ( vreg_ctr[ VREG_C_IRQ_MASK2 ] & REG_BIT_TWL_RESET_REQ ) == 0 ){ if( ( vreg_ctr[ VREG_C_IRQ_MASK3 ] & REG_BIT_TWL_RESET_REQ ) == 0 ){
IRQ0_ast; IRQ0_ast;
} }
} }
// バックライトが... // バックライトが...
if( (( reg_old ^ reg_shadow ) & ~( 0x03 << 2 )) != 0 ){ if( (( reg_old ^ reg_shadow ) & ~( REG_BIT_TWL_REQ_BL )) != 0 ){
if(( reg_shadow & ( 0x03 << 2 )) == 0x00 ){ if(( reg_shadow & ( REG_BIT_TWL_REQ_BL )) == 0x00 ){
// 両方消された // 両方消された
vreg_ctr[ VREG_C_IRQ1 ] |= REG_BIT_STAT_CHANGE; vreg_ctr[ VREG_C_IRQ3 ] |= REG_BIT_TWL_BL_OFF;
vreg_ctr[ VREG_C_STATUS0 ] &= ~0x01; if( ( vreg_ctr[ VREG_C_IRQ_MASK3 ] & REG_BIT_TWL_BL_OFF ) == 0 ){
if( ( vreg_ctr[ VREG_C_IRQ_MASK1 ] & REG_BIT_STAT_CHANGE ) == 0 ){
IRQ0_ast; IRQ0_ast;
} }
}else if(( reg_shadow & ( 0x03 << 2 )) == ( 0x03 << 2 )){ }else if(( reg_shadow & ( REG_BIT_TWL_REQ_BL )) == ( REG_BIT_TWL_REQ_BL )){
// 両方ついた // 両方ついた
vreg_ctr[ VREG_C_IRQ1 ] |= REG_BIT_STAT_CHANGE; vreg_ctr[ VREG_C_IRQ3 ] |= REG_BIT_TWL_BL_ON;
vreg_ctr[ VREG_C_STATUS0 ] |= 0x01; if( ( vreg_ctr[ VREG_C_IRQ_MASK3 ] & REG_BIT_TWL_BL_ON ) == 0 ){
if( ( vreg_ctr[ VREG_C_IRQ_MASK1 ] & REG_BIT_STAT_CHANGE ) == 0 ){
IRQ0_ast; IRQ0_ast;
} }
} }
} }
EI(); EI();
reg_shadow &= ~( 0x03 << 3 ); // BLだけマスクして、クリアの準備 reg_shadow &= ~( REG_BIT_TWL_REQ_BL ); // BLだけマスクして、クリアの準備
iic_mcu_write_a_byte( IIC_SLA_CODEC, CODEC_REG_PMCOMP, reg_shadow ); iic_mcu_write_a_byte( IIC_SLA_CODEC, CODEC_REG_PMCOMP, reg_shadow );
#endif #endif
return( ERR_FINISED ); return( ERR_FINISED );

View File

@ -61,7 +61,6 @@ err PM_LCD_on();
err PM_bt_auth(); err PM_bt_auth();
task_status_immed PM_bt_temp_update(); task_status_immed PM_bt_temp_update();
void PM_init(); void PM_init();
err PM_reset();
err PM_LCD_vcom_set(); err PM_LCD_vcom_set();
task_status_immed tski_vcom_set(); task_status_immed tski_vcom_set();
@ -79,6 +78,7 @@ task_status_immed tski_PM_LCD_off();
#define PM_get_batt_left() ( iic_mcu_read_a_byte( IIC_SLA_BT_GAUGE, BT_GAUGE_REG_SOC ) ) #define PM_get_batt_left() ( iic_mcu_read_a_byte( IIC_SLA_BT_GAUGE, BT_GAUGE_REG_SOC ) )
#define PM_reset() ( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_CONT, 0x00 ) )
//========================================================= //=========================================================

View File

@ -27,6 +27,7 @@ extern task_info tasks[];
#include "..\bsr_system.h" #include "..\bsr_system.h"
extern system_status_ system_status; extern system_status_ system_status;
//****************************************************************************** //******************************************************************************
static void renge_task_immed_init(); static void renge_task_immed_init();
static void renge_task_immed_del( u8 ); static void renge_task_immed_del( u8 );
@ -70,10 +71,11 @@ err renge_task_interval_run(){
// インターバル起動 // インターバル起動
if( renge_flg_interval == 1 ){ if( renge_flg_interval == 1 ){
renge_flg_interval = 0; renge_flg_interval = 0;
for( current_task = tasks; for( current_task = &tasks[0];
current_task != &tasks[TSK_LAST]; current_task != &tasks[TSK_LAST];
current_task += 1 ) current_task += 1 )
{ {
// if( current_task -> dispatch_type == INTERVAL ){ // if( current_task -> dispatch_type == INTERVAL ){
if( current_task -> interval == 0 ){ if( current_task -> interval == 0 ){
current_task -> interval = current_task -> task(); current_task -> interval = current_task -> task();
@ -85,15 +87,14 @@ err renge_task_interval_run(){
} }
// ***_TRIG等で強制起動 // ***_TRIG等で強制起動
if( renge_task_interval_run_force ){ while( renge_task_interval_run_force ){
renge_task_interval_run_force = 0; // とりあえず、何が何でもフラグ消しちゃうけど... renge_task_interval_run_force = 0; // とりあえず、何が何でもフラグ消しちゃうけど...
for( current_task = tasks; for( current_task = &tasks[0];
current_task != &tasks[TSK_LAST]; current_task != &tasks[TSK_LAST];
current_task += 1 ) current_task += 1 )
{ {
current_task -> interval = current_task -> task(); current_task -> interval = current_task -> task();
} }
} }
return( ERR_SUCCESS ); return( ERR_SUCCESS );
@ -124,13 +125,13 @@ void renge_task_immed_init(){
/* /*
*/
u8 i; u8 i;
for( i = 0; i < IMMED_RSV_TASKS_NUM; i++ ){ for( i = 0; i < IMMED_RSV_TASKS_NUM; i++ ){
tasks_immed[ i ] = (void *)0; tasks_immed[ i ] = (void *)0;
} }
task_immed_index = 0; task_immed_index = 0;
*/
} }

View File

@ -52,7 +52,7 @@ conf << "\n"
conf << "task_info tasks[ TSK_LAST ] = {\n " conf << "task_info tasks[ TSK_LAST ] = {\n "
tasklist.each{|dat| tasklist.each{|dat|
conf << "{ tsk_" << dat << ",\t\tINTERVAL, 0 },\n " conf << "{ tsk_" << dat << ", \t0 },\n "
} }
conf << " \n};\n" conf << " \n};\n"

View File

@ -6,7 +6,7 @@
#include "renge_defs.h" #include "renge_defs.h"
enum { enum {
TSK_SW, TSK_WIFI, TSK_ADC, TSK_BATT, TSK_LED_POW, TSK_LED_WIFI, TSK_MISC_STAT, TSK_DEBUG, TSK_DEBUG2, TSK_SOFT_INT, TSK_SYS, TSK_LAST TSK_SW, TSK_WIFI, TSK_ADC, TSK_BATT, TSK_LED_POW, TSK_LED_WIFI, TSK_LED_CAM, TSK_MISC_STAT, TSK_DEBUG, TSK_DEBUG2, TSK_SOFT_INT, TSK_SYS, TSK_LAST
}; };
extern task_interval tsk_sw(); extern task_interval tsk_sw();
@ -15,6 +15,7 @@ extern task_interval tsk_adc();
extern task_interval tsk_batt(); extern task_interval tsk_batt();
extern task_interval tsk_led_pow(); extern task_interval tsk_led_pow();
extern task_interval tsk_led_wifi(); extern task_interval tsk_led_wifi();
extern task_interval tsk_led_cam();
extern task_interval tsk_misc_stat(); extern task_interval tsk_misc_stat();
extern task_interval tsk_debug(); extern task_interval tsk_debug();
extern task_interval tsk_debug2(); extern task_interval tsk_debug2();
@ -22,17 +23,18 @@ extern task_interval tsk_soft_int();
extern task_interval tsk_sys(); extern task_interval tsk_sys();
task_info tasks[ TSK_LAST ] = { task_info tasks[ TSK_LAST ] = {
{ tsk_sw, 0 }, { tsk_sw, 0 },
{ tsk_wifi, 0 }, { tsk_wifi, 0 },
{ tsk_adc, 0 }, { tsk_adc, 0 },
{ tsk_batt, 0 }, { tsk_batt, 0 },
{ tsk_led_pow, 0 }, { tsk_led_pow, 0 },
{ tsk_led_wifi, 0 }, { tsk_led_wifi, 0 },
{ tsk_misc_stat, 0 }, { tsk_led_cam, 0 },
{ tsk_debug, 0 }, { tsk_misc_stat, 0 },
{ tsk_debug2, 0 }, { tsk_debug, 0 },
{ tsk_soft_int, 0 }, { tsk_debug2, 0 },
{ tsk_sys, 0 } { tsk_soft_int, 0 },
{ tsk_sys, 0 },
}; };

View File

@ -4,6 +4,7 @@ adc
batt batt
led_pow led_pow
led_wifi led_wifi
led_cam
misc_stat misc_stat
debug debug
debug2 debug2

View File

@ -13,37 +13,50 @@
u8 rtc_work[7]; u8 rtc_work[7];
bit rtc_lock; bit rtc_lock;
bit rtc_dirty; bit rtc_dirty;
bit rtc_alarm_dirty;
/* ======================================================== /* ========================================================
======================================================== */ ======================================================== */
void RTC_init(void){ void RTC_init(void){
// if( !RTCEN ){
RTCEN = 1; // モジュールON RTCEN = 1; // モジュールON
// RTC設定 // RTC設定
RTCC0 = 0b00001000; /* 動作停止、24時間制、32k出力「まだなし」、定周期割り込みなし */ RTCC0 = 0b00001000; /* 動作停止、24時間制、32k出力「まだなし」、定周期割り込みなし */
RTCC1 = 0b11000000; /* アラーム割り込み有効&動作開始 */ RTCC1 = 0b11000000; /* アラーム割り込み有効&動作開始 */
RTCC2 = 0b10000000; /* インターバル:32k/2^6=2ms、RTCDIV出力なし */ RTCC2 = 0b10000000; /* インターバル:32k/2^6=2ms、RTCDIV出力なし */
SEC = 0; /*
SEC = 0;
MIN = 0; MIN = 0;
HOUR = 0; HOUR = 0;
DAY = 14; DAY = ((1<<4) + 7);
WEEK = 1; WEEK = 0;
MONTH = 9; MONTH = 9;
YEAR = 9; YEAR = 9;
*/
ALARMWW = 0x7F; ALARMWW = 0x7F;
vreg_ctr[ VREG_C_MCU_STATUS ] = REG_BIT_RTC_BLACKOUT;
// }
// 割り込み設定 // 割り込み設定
RTCIF = 0;
RTCIIF = 0;
RTCMK = 1; /* 割り込み(定周期)禁止 */ RTCMK = 1; /* 割り込み(定周期)禁止 */
RTCIMK = 0; /* 割り込み(アラーム&インターバル)許可 */ RTCIMK = 0; /* 割り込み(アラーム&インターバル)許可 */
RTCE = 1; /* 動作開始 */ RTCE = 1; /* 動作開始 */
vreg_ctr[ VREG_C_MCU_STATUS ] = REG_BIT_RTC_BLACKOUT; RWAIT = 1;
while( !RWST ){;}
RWAIT = 0;
rtc_lock = 0; rtc_lock = 0;
rtc_dirty = 0; rtc_dirty = 0;
rtc_alarm_dirty = 0;
} }
@ -53,8 +66,9 @@ void RTC_init(void){
2^6/fXT1.953125 ms 2^6/fXT1.953125 ms
======================================================== */ ======================================================== */
__interrupt void int_rtc_int(){ __interrupt void int_rtc_int(){
DBG_LED_WIFI_2_on;
renge_flg_interval = 1; renge_flg_interval = 1;
DBG_LED_WIFI_2_off;
} }
@ -67,8 +81,8 @@ __interrupt void int_rtc(){
&& ( vreg_ctr[ VREG_C_RTC_ALARM_MONTH ] == MONTH ) && ( vreg_ctr[ VREG_C_RTC_ALARM_MONTH ] == MONTH )
&& ( vreg_ctr[ VREG_C_RTC_ALARM_YEAR ] == YEAR )) && ( vreg_ctr[ VREG_C_RTC_ALARM_YEAR ] == YEAR ))
{ {
vreg_ctr[ VREG_C_IRQ1 ] |= REG_BIT_RTC_ALARM;
if( ( vreg_ctr[ VREG_C_IRQ_MASK1 ] & REG_BIT_RTC_ALARM ) == 0 ){ if( ( vreg_ctr[ VREG_C_IRQ_MASK1 ] & REG_BIT_RTC_ALARM ) == 0 ){
vreg_ctr[ VREG_C_IRQ1 ] |= REG_BIT_RTC_ALARM;
IRQ0_ast; IRQ0_ast;
// マスクをしてあったら、電源を入れません // マスクをしてあったら、電源を入れません
if( system_status.pwr_state == OFF ){ if( system_status.pwr_state == OFF ){
@ -120,9 +134,12 @@ void set_rtc( u8 adrs, u8 data ){
======================================================== */ ======================================================== */
// task_status_immed tski_rtc_close(){ // task_status_immed tski_rtc_close(){
void rtc_unlock(){ void rtc_unlock(){
if( rtc_lock != 0 ){ // リードロック
// if( rtc_lock != 0 ){
rtc_lock = 0; rtc_lock = 0;
} // }
// ライトロック
if( rtc_dirty != 0 ){ if( rtc_dirty != 0 ){
rtc_dirty = 0; rtc_dirty = 0;
RWAIT = 1; RWAIT = 1;
@ -130,7 +147,15 @@ void rtc_unlock(){
memcpy( &SEC, rtc_work, 7 ); memcpy( &SEC, rtc_work, 7 );
RWAIT = 0; RWAIT = 0;
} }
// return( ERR_SUCCESS );
// アラームセット
if( rtc_alarm_dirty ){
WALE = 0;
ALARMWM = vreg_ctr[ VREG_C_RTC_ALARM_MIN ];
ALARMWH = vreg_ctr[ VREG_C_RTC_ALARM_HOUR ];
rtc_dirty = 0;
WALE = 1;
}
} }

View File

@ -10,8 +10,12 @@ void set_rtc();
//task_status_immed tski_rtc_close(); //task_status_immed tski_rtc_close();
void rtc_unlock(); void rtc_unlock();
// ------------------------------------
#define RTC_32k_on() { RCLOE0 = 1; } #define RTC_32k_on() { RCLOE0 = 1; }
// ------------------------------------
extern bit rtc_alarm_dirty;
#endif #endif

View File

@ -11,7 +11,7 @@
#include "incs_loader.h" #include "incs_loader.h"
#include "fsl.h" #include <fsl.h>
#include "fsl_user.h" #include "fsl_user.h"
#include "i2c_ctr.h" #include "i2c_ctr.h"
@ -37,31 +37,30 @@ const u8 fsl_low_voltage_u08 = 1;
#ifdef _MCU_BSR_ #ifdef _MCU_BSR_
#define ACKD ACKD0 #define ACKD ACKD1
#define ACKE ACKE0 #define ACKE ACKE1
#define COI COI0 #define COI COI1
#define IICAEN IICA0EN #define IICAEN IICA1EN
#define IICAPR0 IICAPR00 #define IICAPR0 IICAPR10
#define IICRSV IICRSV0 #define IICRSV IICRSV1
#define IICA IICA0 #define IICA IICA1
#define IICAEN IICA0EN #define IICAIF IICAIF1
#define IICAIF IICAIF0 #define IICAMK IICAMK1
#define IICAMK IICAMK0 #define IICAPR1 IICAPR11
#define IICAPR1 IICAPR10 #define IICCTL0 IICCTL01
#define IICCTL0 IICCTL00 #define IICE IICE1
#define IICE IICE0 #define IICF IICF1
#define IICF IICF0 #define IICS IICS1
#define IICS IICS0 #define IICWH IICWH1
#define IICWH IICWH0 #define IICWL IICWL1
#define IICWL IICWL0 #define LREL LREL1
#define LREL LREL0 #define SPD SPD1
#define SPD SPD0 #define SPIE SPIE1
#define SPIE SPIE0 #define STCEN STCEN1
#define STCEN STCEN0 #define STD STD1
#define STD STD0 #define SVA SVA1
#define SVA SVA0 #define WREL WREL1
#define WREL WREL0 #define WTIM WTIM1
#define WTIM WTIM0
#endif #endif
@ -167,6 +166,8 @@ err firm_update(){
err = FSL_Erase( target_block ); err = FSL_Erase( target_block );
} }
WREL = 1;
// ブロックの数だけ繰り返し // ブロックの数だけ繰り返し
for( target_block = INACTIVE_BOOTSECT_TOP; for( target_block = INACTIVE_BOOTSECT_TOP;
target_block <= UPDATE_BLOCK_LAST; target_block <= UPDATE_BLOCK_LAST;
@ -207,7 +208,7 @@ err firm_update(){
} }
firm_update_end: firm_update_end:
WREL = 1; LREL = 1;
// 書き込んだファームのチェック // // 書き込んだファームのチェック //
{ {
@ -247,6 +248,8 @@ err firm_restore(){
fsl_u08 err; fsl_u08 err;
__far u8* p_rom; __far u8* p_rom;
RTCE = 0;
TOE0 = 0x0000; TOE0 = 0x0000;
TOE0 = 0x0080; TOE0 = 0x0080;
// 書き替え前準備 // // 書き替え前準備 //
@ -310,7 +313,7 @@ err firm_restore(){
} }
void chk_bootCluster(){ void chk_bootCluster(){
u8 data_buffer[ SELF_UPDATE_BUFF_SIZE ]; u8 data_buffer[ SELF_UPDATE_BUFF_SIZE ];
u8 err; u8 err;

View File

@ -29,41 +29,82 @@ task_interval tsk_wifi(){
======================================================== */ ======================================================== */
task_interval tsk_misc_stat(){ task_interval tsk_misc_stat(){
static u8 state_old; // ステータス変化検出→割り込み の為 static u8 state_old; // ステータス変化検出→割り込み の為
u8 diff;
SHELL_CLOSE_P = 1; SHELL_CLOSE_P = 1;
set_bit( EXT_OPT_DET, vreg_ctr[ VREG_C_STATUS0 ], REG_BIT_EXT_OPT_LOCK ); set_bit( EXT_OPT_OPEN, vreg_ctr[ VREG_C_STATUS ], REG_BIT_ST_EXT_OPT_OPEN );
set_bit( SHELL_CLOSE, vreg_ctr[ VREG_C_STATUS0 ], REG_BIT_ST_SHELL_CLOSED ); set_bit( SHELL_CLOSE, vreg_ctr[ VREG_C_STATUS ], REG_BIT_ST_SHELL_CLOSED );
SHELL_CLOSE_P = 0; SHELL_CLOSE_P = 0;
// ステータスレジスタ関係 → 割り込み // // ステータスレジスタ関係 → 割り込み //
if(( vreg_ctr[ VREG_C_STATUS0 ] ^ state_old ) != 0 ){ if( ( system_status.pwr_state == ON )
vreg_ctr[ VREG_C_IRQ1 ] |= REG_BIT_STAT_CHANGE; || ( system_status.pwr_state == SLEEP ) ){
switch( system_status.pwr_state ){ diff = vreg_ctr[ VREG_C_STATUS ] ^ state_old;
case ON_TRIG: if( diff != 0 ){
break;
case ON: if( diff & REG_BIT_LCD_POW ){
if( ( vreg_ctr[ VREG_C_IRQ_MASK1 ] & REG_BIT_STAT_CHANGE ) == 0 ){ // 液晶電源セット完了
IRQ0_ast; if( vreg_ctr[ VREG_C_STATUS ] & REG_BIT_LCD_POW ){
// on
set_irq( VREG_C_IRQ3, REG_BIT_LCD_ON );
}else{
// off
set_irq( VREG_C_IRQ3, REG_BIT_LCD_OFF );
}
} }
break;
case SLEEP_TRIG: if( diff & REG_BIT_BL ){
case SLEEP: // バックライトに変化有り
if( (( state_old & REG_BIT_ST_SHELL_CLOSED ) != 0 ) if( vreg_ctr[ VREG_C_STATUS ] & REG_BIT_BL ){
&& ( !SHELL_CLOSE ) ){ // ついた
// 蓋開けた のみ通知 set_irq( VREG_C_IRQ3, REG_BIT_BL_ON );
if( ( vreg_ctr[ VREG_C_IRQ_MASK1 ] & REG_BIT_STAT_CHANGE ) == 0 ){ }else{
IRQ0_ast; // 消えた
set_irq( VREG_C_IRQ3, REG_BIT_BL_OFF );
}
} }
if( diff & REG_BIT_BATT_CHARGE ){
// 充電状態に以下略
if( vreg_ctr[ VREG_C_STATUS ] & REG_BIT_BATT_CHARGE ){
set_irq( VREG_C_IRQ2, REG_BIT_BT_CHG_START );
}else{
set_irq( VREG_C_IRQ2, REG_BIT_BT_CHG_STOP );
}
}
if( diff & REG_BIT_POW_SUPPLY ){
// 電源供給
if( vreg_ctr[ VREG_C_STATUS ] & REG_BIT_POW_SUPPLY ){
set_irq( VREG_C_IRQ2, REG_BIT_BT_DC_CONNECT );
}else{
set_irq( VREG_C_IRQ2, REG_BIT_BT_DC_DISC );
}
}
if( diff & REG_BIT_ST_EXT_OPT_OPEN ){
// オプション蓋ロック
if( vreg_ctr[ VREG_C_STATUS ] & REG_BIT_ST_EXT_OPT_OPEN ){
set_irq( VREG_C_IRQ2, REG_BIT_EXTOPT_LOCK );
}else{
set_irq( VREG_C_IRQ2, REG_BIT_EXTOPT_OPEN );
}
}
if( diff & REG_BIT_ST_SHELL_CLOSED ){
// BL点灯
if( vreg_ctr[ VREG_C_STATUS ] & REG_BIT_ST_SHELL_CLOSED ){
set_irq( VREG_C_IRQ2, REG_BIT_SHELL_OPEN );
}else{
set_irq( VREG_C_IRQ2, REG_BIT_SHELL_CLOSE );
}
} }
break;
case OFF_TRIG:
case OFF:
default:
break;
} }
state_old = vreg_ctr[ VREG_C_STATUS ];
} }
state_old = vreg_ctr[ VREG_C_STATUS0 ];
return( 100 ); return( 100 );
} }
@ -76,10 +117,6 @@ task_interval tsk_debug(){
u8 temp; u8 temp;
static u8 count = 0; static u8 count = 0;
if( count == 0 ){
// LED_WIFI_2 ^= 1;
}
/* /*
temp = iic_mcu_read_a_byte( IIC_SLA_8LEDS, IIC_8LEDS_REG_DO ); temp = iic_mcu_read_a_byte( IIC_SLA_8LEDS, IIC_8LEDS_REG_DO );
count += 1; count += 1;
@ -94,14 +131,20 @@ task_interval tsk_debug(){
task_interval tsk_debug2(){ task_interval tsk_debug2(){
u8 str[4]; u8 str[4];
if(( system_status.pwr_state == ON ) return( 3 );
|| ( system_status.pwr_state == SLEEP )){
str[3] = vreg_ctr[ VREG_C_IRQ0 ];
str[2] = vreg_ctr[ VREG_C_IRQ1 ];
str[1] = vreg_ctr[ VREG_C_STATUS0 ];
str[0] = vreg_ctr[ VREG_C_ACC_YH ];
iic_mcu_write( IIC_SLA_DBG_MONITOR, 0, 4, &str ); if(( system_status.pwr_state == ON )
|| ( system_status.pwr_state == SLEEP )){
str[3] = boot_ura;
str[2] = vreg_ctr[ VREG_C_IRQ1 ];
str[1] = vreg_ctr[ VREG_C_IRQ2 ];
str[0] = vreg_ctr[ VREG_C_STATUS ];
// str[3] = vreg_ctr[ VREG_C_IRQ0 ];
// str[2] = vreg_ctr[ VREG_C_IRQ1 ];
// str[1] = vreg_ctr[ VREG_C_IRQ2 ];
// str[0] = vreg_ctr[ VREG_C_STATUS ];
// iic_mcu_write( IIC_SLA_DBG_MONITOR, 0, 4, &str[0] );
// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 2, vreg_ctr[ VREG_C_IRQ1 ] ); // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 2, vreg_ctr[ VREG_C_IRQ1 ] );
// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 1, boot_ura ); // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 1, boot_ura );
// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 1, vreg_ctr[ VREG_C_SND_VOL ] ); // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 1, vreg_ctr[ VREG_C_SND_VOL ] );
@ -109,7 +152,7 @@ task_interval tsk_debug2(){
// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 0, vreg_ctr[ VREG_C_ACC_ZH ] ); // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 0, vreg_ctr[ VREG_C_ACC_ZH ] );
// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 3, vreg_ctr[ VREG_C_TUNE ] ); // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 3, vreg_ctr[ VREG_C_TUNE ] );
// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 2, vreg_ctr[ VREG_C_SND_VOL ] ); // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 2, vreg_ctr[ VREG_C_SND_VOL ] );
// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 1, vreg_ctr[ VREG_C_STATUS0 ] ); // 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_a_byte( IIC_SLA_DBG_MONITOR, 0, vreg_ctr[ VREG_C_ACC_ZH ] );
} }
return( 3 ); return( 3 );
@ -152,38 +195,6 @@ task_status_immed tsk_imm_hina( u8* arg ){
/* ========================================================
======================================================== */
task_interval tsk_soft_int(){
#ifdef _MCU_KE3_
if( (( vreg_ctr[ VREG_C_ACC_CONFIG_HOSU ] & 0x01 ) != 0 )
|| (( vreg_ctr[ VREG_C_ACC_CONFIG ] & 0x03 ) == 0x01 ) ){
if( system_status.pwr_state == ON ){
// Hエッジ検出
// pin = ( pin << 1 ) + ( ACC_VALID? 1: 0 );
// if( ( pin & 0x03 ) == 0x01 ){
if( ACC_VALID ){
renge_task_immed_add( tsk_cbk_accero );
}
}
return( 0 );
}
#else
// 本物のマイコンなら、割り込みでタスクを登録します
#endif
return( 248 );
}
/* ======================================================== /* ========================================================

View File

@ -24,12 +24,11 @@ bit SW_pow_mask, SW_home_mask, SW_tune_mask, SW_wifi_mask;
======================================================== */ ======================================================== */
task_interval tsk_sys(){ task_interval tsk_sys(){
static u8 timeout = 0; static u8 timeout = 0;
RTCIMK = 0; // インターバル割り込み許可
switch( system_status.pwr_state ){ switch( system_status.pwr_state ){
case OFF: //------------------------------------------------------- case OFF: //-------------------------------------------------------
// スイッチ操作などで割り込みが発生し、スリープが解除されるとここに来ます。 // スイッチ操作などで割り込みが発生し、スリープが解除されるとここに来ます。
RTCIMK = 0; // インターバル割り込み許可
KRMK = 1;
switch( system_status.poweron_reason ){ switch( system_status.poweron_reason ){
default: default:
@ -43,16 +42,19 @@ task_interval tsk_sys(){
if( timeout > 127 ){ if( timeout > 127 ){
system_status.pwr_state = OFF_TRIG; // スイッチはノイズだった。寝る。 system_status.pwr_state = OFF_TRIG; // スイッチはノイズだった。寝る。
renge_task_interval_run_force = 1; renge_task_interval_run_force = 1;
//iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 3, 0x81 );
return( 0 ); return( 0 );
} }
if(( SW_pow_count < 3 )&& if(( SW_pow_count < 3 )&&
( SW_wifi_count < 3 )){ ( SW_wifi_count < 3 )){
// もう少しスイッチの様子を見る // もう少しスイッチの様子を見る
//iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 3, 0x82 );
return( 0 ); return( 0 );
} }
break; break;
case( RTC_ALARM ): case( RTC_ALARM ):
//iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 3, 0x83 );
break; break;
// 何か他に電源ON要因はあるか // 何か他に電源ON要因はあるか
@ -60,17 +62,13 @@ task_interval tsk_sys(){
// アダプタ(充電の温度を監視しなくてはならない) // アダプタ(充電の温度を監視しなくてはならない)
} }
timeout = 0;
// 電源投入 // 電源投入
SW_pow_mask = 1; SW_pow_mask = 1;
SW_tune_mask = 1; SW_tune_mask = 1;
SW_wifi_mask = 1; SW_wifi_mask = 1;
SW_pow_count = 0;
SW_tune_count = 0;
SW_wifi_count = 0;
// 電源投入 // // 電源投入 //
iic_mcu_start(); iic_mcu_start();
@ -95,12 +93,11 @@ task_interval tsk_sys(){
} }
PM_LCD_vcom_set(); // LCDの対向電圧値など書き込み PM_LCD_vcom_set(); // LCDの対向電圧値など書き込み
// 電源スイッチでの電源投入であれば、バックライトを点ける // 電源スイッチでの電源投入であれば、バックライトを点ける
if( system_status.poweron_reason == PWSW ){ if( system_status.poweron_reason == PWSW ){
// パワースイッチでのonの時は、LEDを点灯させる // パワースイッチでのonの時は、LEDを点灯させる
vreg_ctr[ VREG_C_LED_POW_ILUMI ] = LED_POW_ILM_AUTO; vreg_ctr[ VREG_C_LED_POW ] = LED_POW_ILM_AUTO;
#if 0
if( PM_LCD_on() == 0 ){ if( PM_LCD_on() == 0 ){
renge_task_interval_run_force = 1; renge_task_interval_run_force = 1;
iic_mcu_stop(); iic_mcu_stop();
@ -114,11 +111,12 @@ task_interval tsk_sys(){
system_status.pwr_state = OFF; system_status.pwr_state = OFF;
return( 0 ); return( 0 );
} }
#endif
} }
else else
{ {
// 他には? // 他には?
vreg_ctr[ VREG_C_LED_POW_ILUMI ] = LED_POW_ILM_OFF; vreg_ctr[ VREG_C_LED_POW ] = LED_POW_ILM_OFF;
} }
// ここまで来ると、電源投入確定 // ここまで来ると、電源投入確定
@ -130,31 +128,30 @@ task_interval tsk_sys(){
case ON_TRIG: //------------------------------------------------------- case ON_TRIG: //-------------------------------------------------------
LED_init(); LED_init();
// iic_mcu_write_a_byte( IIC_SLA_8LEDS, IIC_8LEDS_REG_DIR, 0x00 );
// iic_mcu_write_a_byte( IIC_SLA_8LEDS, IIC_8LEDS_REG_DO, 0x00 );
{ {
PU7 = 0b00011101; // 4:SW_WIFI 3:SW_PWSW 2:PM_IRQ 0:PM_EXTDC PU7 = 0b00011101; // 4:SW_WIFI 3:SW_PWSW 2:PM_IRQ 0:PM_EXTDC
} }
// アクティブ中に使用するピン変化割り込み
// I2CやDMAは個別にセットしてください
// KRM = 0b00000000;
MK0 = INT_MSK0_RSV;
MK1 = INT_MSK1_RSV;
#ifdef _MCU_BSR_
MK2 = INT_MSK2_RSV;
#else
MK2L= INT_MSK2L_RSV;
#endif
// ほか、必要ペリフェラルの初期化 // ほか、必要ペリフェラルの初期化
IIC_ctr_Init(); // とりあえずはここで初期化 IIC_ctr_Init(); // とりあえずはここで初期化
IIC_twl_Init(); IIC_twl_Init();
RTC_32k_on(); RTC_32k_on();
// アクティブ中に使用するピン変化割り込み system_status.pwr_state = ON;
// I2CやDMAは個別にセットしてください
// KRM = 0b00000000;
EGP0 = 0b00110001;
EGN0 = 0b01110001;
// intp20系は後ほど
MK0 = INT_MSK0_RSV;
MK1 = INT_MSK1_RSV;
MK2L= INT_MSK2L_RSV;
system_status.pwr_state = ON; #ifndef _CODEC_CTR_
#ifndef _PMIC_TWL_
{ {
u8 temp; u8 temp;
// do{ // do{
@ -164,12 +161,7 @@ task_interval tsk_sys(){
} }
#endif #endif
// vreg_ctr[ VREG_C_ACC_CONFIG_HOSU ] = 0x00; // デバッグ目的
vreg_ctr[ VREG_C_ACC_CONFIG_HOSU ] = 0x01; // デバッグ目的
renge_task_immed_add( acc_hosu_set );
system_status.poweron_reason = PWSW; system_status.poweron_reason = PWSW;
break; break;
@ -191,7 +183,7 @@ task_interval tsk_sys(){
break; break;
case SLEEP: //------------------------------------------ case SLEEP: //------------------------------------------
system_status.pwr_state = ON_TRIG; system_status.pwr_state = ON_TRIG;
if( !RESET1_n ){ if( !RESET1_n ){
NOP(); NOP();
/* /*
@ -203,12 +195,19 @@ task_interval tsk_sys(){
break; break;
case OFF_TRIG: //--------------------------------------- case OFF_TRIG: //---------------------------------------
DBG_LED_WIFI_2_on;
DBG_LED_WIFI_2_off;
DBG_LED_WIFI_2_on;
DBG_LED_WIFI_2_off;
LED_stop(); LED_stop();
IIC_ctr_Stop(); IIC_ctr_Stop();
IIC_twl_Stop(); IIC_twl_Stop();
vreg_ctr[ VREG_C_IRQ0 ] = 0; vreg_ctr[ VREG_C_IRQ0 ] = 0;
vreg_ctr[ VREG_C_IRQ1 ] = 0; vreg_ctr[ VREG_C_IRQ1 ] = 0;
vreg_ctr[ VREG_C_IRQ2 ] = 0; vreg_ctr[ VREG_C_IRQ2 ] = 0;
vreg_ctr[ VREG_C_IRQ3 ] = 0;
BT_TEMP_P = 0; BT_TEMP_P = 0;
// 電源オン条件の割り込みセット // 電源オン条件の割り込みセット
@ -221,9 +220,16 @@ task_interval tsk_sys(){
DI(); DI();
PM_sys_pow_off(); PM_sys_pow_off();
iic_mcu_stop(); DBG_LED_WIFI_2_on;
DBG_LED_WIFI_2_off;
DBG_LED_WIFI_2_on;
DBG_LED_WIFI_2_off;
DBG_LED_WIFI_2_on;
DBG_LED_WIFI_2_off;
// pullup_off(); // iic_mcu_stop();
// pullup_off(); ↓
{ {
PU5 = 0b00000011; // PM_CHG,PM_CHGERR PU5 = 0b00000011; // PM_CHG,PM_CHGERR
PU7 = 0b00011001; // SW_WiFi,PWSWI,PM_EXTTDC PU7 = 0b00011001; // SW_WiFi,PWSWI,PM_EXTTDC
@ -231,10 +237,6 @@ task_interval tsk_sys(){
// KRM = ( KR_SW_POW | KR_SW_WIFI ); // Mask ではなく、Modeなのだそうだ。紛らわしい // KRM = ( KR_SW_POW | KR_SW_WIFI ); // Mask ではなく、Modeなのだそうだ。紛らわしい
KRM = ( KR_SW_POW ); // Mask ではなく、Modeなのだそうだ。紛らわしい KRM = ( KR_SW_POW ); // Mask ではなく、Modeなのだそうだ。紛らわしい
// EGP0 = 0b00100000; // SHELL, 0で検出しない
EGP0 = 0b00000000; // SHELL, 0で検出しない
EGN0 = 0b00010000; // EXTDC
// intp20系は後ほど // intp20系は後ほど
MK0 = 0b1111111110111111; // INT(EXTDC) MK0 = 0b1111111110111111; // INT(EXTDC)
// MK0 = 0b1111111100111111; // INT(SHELL), INT(EXTDC) // MK0 = 0b1111111100111111; // INT(SHELL), INT(EXTDC)
@ -248,15 +250,26 @@ task_interval tsk_sys(){
timeout = 0; timeout = 0;
system_status.pwr_state = OFF; system_status.pwr_state = OFF;
STOP(); // 割り込み待ちで寝る
// while( SW_POW_n ){;} while( RWST ){;}
iic_mcu_stop();
STOP(); // 割り込み待ちで寝る //
DBG_LED_WIFI_2_on;
DBG_LED_WIFI_2_off;
DBG_LED_WIFI_2_on;
DBG_LED_WIFI_2_off;
DBG_LED_WIFI_2_on;
DBG_LED_WIFI_2_off;
DBG_LED_WIFI_2_on;
DBG_LED_WIFI_2_off;
// while( SW_POW_n ){;}
KRMK = 1;
RTCIMK = 0; // インターバル割り込み許可
EI(); EI();
#ifdef _PMIC_TWL_
MK2L = 0b01111111; // wifi_TX 割り込み
EGP0 |= 0x80;
#else
// todo
#endif
renge_task_interval_run_force = 1; renge_task_interval_run_force = 1;
break; break;
@ -296,6 +309,7 @@ task_interval tsk_sys(){
task_interval tsk_sw(){ task_interval tsk_sw(){
static u8 cnt_force_off = 0; static u8 cnt_force_off = 0;
static u8 sw_pow_old = 0;
if(( system_status.pwr_state == ON ) if(( system_status.pwr_state == ON )
|| ( system_status.pwr_state == OFF )){ || ( system_status.pwr_state == OFF )){
@ -309,33 +323,34 @@ task_interval tsk_sw(){
case( OFF_TRIG ): case( OFF_TRIG ):
SW_pow_count = 0; SW_pow_count = 0;
SW_wifi_count = 0; SW_wifi_count = 0;
SW_tune_count = 0; SW_tune_count = 0;
cnt_force_off = 0; cnt_force_off = 0;
break; break;
case( ON ): case( ON ):
case( SLEEP ): case( SLEEP ):
// 電源スイッチの監視 // // 電源スイッチの監視 //
if( SW_pow_count == 6 ){ if( SW_pow_count == 0 ){
vreg_ctr[ VREG_C_IRQ0 ] |= REG_BIT_SW_POW_CLICK; if(( 6 < sw_pow_old ) && ( sw_pow_old < 66 )){
if( ( vreg_ctr[ VREG_C_IRQ_MASK0 ] & REG_BIT_SW_POW_CLICK ) == 0 ){ set_irq( VREG_C_IRQ0, REG_BIT_SW_POW_CLICK );
IRQ0_ast;
} }
}else if( SW_pow_count == 66 ){ }else if( SW_pow_count == 66 ){
vreg_ctr[ VREG_C_IRQ0 ] |= REG_BIT_SW_POW_HOLD; set_irq( VREG_C_IRQ0, REG_BIT_SW_POW_HOLD );
if( ( vreg_ctr[ VREG_C_IRQ_MASK0 ] & REG_BIT_SW_POW_HOLD ) == 0 ){ }else if( SW_pow_count == 254 ){ // todo
IRQ0_ast; // vreg_ctr[ VREG_C_LED_POW ] = LED_POW_ONLY_RED;
} system_status.pwr_state = OFF_TRIG;
renge_task_interval_run_force = 1;
} }
sw_pow_old = SW_pow_count;
// 電源OFF割り込みを入れたが… // 電源OFF割り込みを入れたが…
if(( vreg_ctr[ VREG_C_IRQ0 ] & REG_BIT_SW_POW_HOLD ) != 0 ){ if(( vreg_ctr[ VREG_C_IRQ0 ] & REG_BIT_SW_POW_HOLD ) != 0 ){
cnt_force_off += 1; cnt_force_off += 1;
if( cnt_force_off >= 13 ){ // …返事がない。強制的に切る。 if( cnt_force_off >= 13 ){ // …返事がない。強制的に切る。
vreg_ctr[ VREG_C_LED_POW_ILUMI ] = LED_POW_ILM_OFF; vreg_ctr[ VREG_C_LED_POW ] = LED_POW_ILM_OFF;
if(( LED_duty_pow_H == 0 ) && ( LED_duty_pow_L == 0 )){ if(( LED_duty_pow_H == 0 ) && ( LED_duty_pow_L == 0 )){
system_status.pwr_state = OFF_TRIG; system_status.pwr_state = OFF_TRIG;
renge_task_interval_run_force = 1; renge_task_interval_run_force = 1;
} }
} }
}else{ }else{
@ -359,18 +374,12 @@ task_interval tsk_sw(){
// wifi sw // wifi sw
if( SW_wifi_count == 10 ){ if( SW_wifi_count == 10 ){
vreg_ctr[ VREG_C_IRQ0 ] |= REG_BIT_SW_WIFI_CLICK; set_irq( VREG_C_IRQ0, REG_BIT_SW_WIFI_CLICK );
if( ( vreg_ctr[ VREG_C_IRQ_MASK0 ] & REG_BIT_SW_WIFI_CLICK ) == 0 ){
IRQ0_ast;
}
} }
// tune sw // tune sw
if( SW_tune_count == 10 ){ if( SW_tune_count == 10 ){
vreg_ctr[ VREG_C_IRQ0 ] |= REG_BIT_SW_TUNE_CLICK; set_irq( VREG_C_IRQ0, REG_BIT_SW_TUNE_CLICK );
if( ( vreg_ctr[ VREG_C_IRQ_MASK0 ] & REG_BIT_SW_TUNE_CLICK ) == 0 ){
IRQ0_ast;
}
} }
break; break;
} }
@ -388,3 +397,6 @@ task_interval tsk_sw(){
return( 8 ); return( 8 );
} }

View File

@ -10,7 +10,6 @@
#define IIC_SLA_DCP 0x50 #define IIC_SLA_DCP 0x50
#define _debug_
#ifdef _debug_ #ifdef _debug_
// 8ドットのLED // 8ドットのLED
@ -22,8 +21,25 @@
// 7セグ 4バイト版 // 7セグ 4バイト版
#define IIC_SLA_DBG_MONITOR 0x44 #define IIC_SLA_DBG_MONITOR 0x44
#endif #endif
#ifdef _debug_led_
#define DBG_LED_WIFI_on ( P1.1 = 1 ) // TO03
#define DBG_LED_WIFI_off ( P1.1 = 0 ) // TO03
#define DBG_LED_WIFI_2_on ( LED_WIFI_2 = 1 )
#define DBG_LED_WIFI_2_off ( LED_WIFI_2 = 0 )
#define DBG_LED_WIFI_2_toggle ( LED_WIFI_2 ^= 1 )
#else
#define DBG_LED_WIFI_on ;
#define DBG_LED_WIFI_2_on ;
#define DBG_LED_WIFI_2_off ;
#define DBG_LED_WIFI_off ;
#define DBG_LED_WIFI_2_toggle ;
#endif
#ifdef _MCU_KE3_ #ifdef _MCU_KE3_
extern unsigned char temp_teg; extern unsigned char temp_teg;
#define P20 temp_teg #define P20 temp_teg
@ -44,7 +60,7 @@ extern unsigned char temp_teg;
// PMxは0で出力モード // PMxは0で出力モード
// SoC // SoC
#ifndef _PMIC_CTR_ #ifndef _MODEL_TS0_
#define IRQ0_ast { P3.0 = 0; PM3.0 = 0; } #define IRQ0_ast { P3.0 = 0; PM3.0 = 0; }
#else #else
#define IRQ0_ast { P7.6 = 0; PM7.6 = 0; } #define IRQ0_ast { P7.6 = 0; PM7.6 = 0; }
@ -52,7 +68,7 @@ extern unsigned char temp_teg;
//#define IRQ0_neg { PM3.0 = 1; } //#define IRQ0_neg { PM3.0 = 1; }
// ↓誤代入防止 // ↓誤代入防止
#define RESET1_n ( P0.0 & 0x01 ) #define RESET1_n ( P0.0 )
#define RESET1_ast { P0.0 = 0; PM0.0 = 0; } #define RESET1_ast { P0.0 = 0; PM0.0 = 0; }
#define RESET1_neg { PM0.0 = 1; } #define RESET1_neg { PM0.0 = 1; }
#define RESETs_ast { P0 &= ~0x03; PM0 &= ~0x03; } #define RESETs_ast { P0 &= ~0x03; PM0 &= ~0x03; }
@ -62,7 +78,7 @@ extern unsigned char temp_teg;
#define SLP_REQ P12.0 #define SLP_REQ P12.0
// FCRAM // FCRAM
#ifndef _PMIC_CTR_ #ifndef _MODEL_TS0_
#define FCRAM_RST P14.0 #define FCRAM_RST P14.0
#define FCRAM_RST_ast { P14.0 = 0; } #define FCRAM_RST_ast { P14.0 = 0; }
#define FCRAM_RST_neg { P14.0 = 1; } #define FCRAM_RST_neg { P14.0 = 1; }
@ -149,14 +165,22 @@ extern unsigned char temp_teg;
#define DBG P14.1 #define DBG P14.1
#define EXT_OPT_DET P12.2 #define EXT_OPT_OPEN P12.2
#ifdef _MCU_KE3_ #ifdef _MODEL_TEG2_
#define ACC_VALID P15.2 #define ACC_VALID P15.2
#else
#define ACC_VALID P20.5 // ACC_INT0
#endif
#define ACCEL_INT1 P2.5 #define ACCEL_INT1 P2.5
#endif
#ifdef _MODEL_TS0_
#define ACC_VALID P20.5
#define ACCEL_INT1 P2.5
#endif
#ifdef _MODEL_WM0_
#define ACC_VALID P2.5
#define ACCEL_INT1 P20.5
#endif
/* /*
#define DBG_M_n P2.1 #define DBG_M_n P2.1
@ -178,10 +202,14 @@ extern unsigned char temp_teg;
#define INT_MSK1_RTCALARM ( 0b0000001000000000 ) #define INT_MSK1_RTCALARM ( 0b0000001000000000 )
#define INT_MSK1_ADC ( 0b0000000100000000 ) #define INT_MSK1_ADC ( 0b0000000100000000 )
#define INT_MSK1_IIC_CTR ( 0b0000000000001000 ) #define INT_MSK1_IIC_CTR ( 0b0000000000001000 )
#define INT_MSK1_IIC_YAV ( 0b0000000000000001 ) #define INT_MSK1_IIC_MCU ( 0b0000000000000001 )
#define INT_MSK1_RSV ( 0b1111000011110110 ) #define INT_MSK1_RSV ( 0b1111000011110110 )
#define INT_MSK2L_RSV ( 0b11111111 ) #define INT_MSK2_WIFI_TX_KE3 ( 0b00010000 )
#define INT_MSK2L_RSV ( 0b11101111 )
#define INT_MSK2_IIC_TWL ( 0b0000000100000000 )
#define INT_MSK2_WIFI_TX_BSR ( 0b0000010000000000 )
#define INT_MSK2_RSV ( 0b1111101111111111 )
#endif #endif

View File

@ -27,11 +27,19 @@ u8 vreg_ctr[ VREG_C_ENDMARK_ ];
// 非ゼロの初期値の指定が必要なアドレス // 非ゼロの初期値の指定が必要なアドレス
void vreg_ctr_init(){ void vreg_ctr_init(){
vreg_ctr[ VREG_C_LED_BRIGHT ] = 0xFF; vreg_ctr[ VREG_C_LED_BRIGHT ] = 0xFF;
#ifdef _MCU_BSR_
vreg_ctr[ VREG_C_MCU_VER_MAJOR ] = MCU_VER_MAJOR + 0x10; #ifdef _debug_
#else vreg_ctr[ VREG_C_LED_TUNE ] = 0x01;
vreg_ctr[ VREG_C_MCU_VER_MAJOR ] = MCU_VER_MAJOR;
#endif #endif
vreg_ctr[ VREG_C_MCU_VER_MAJOR ] = MCU_VER_MAJOR;
#ifdef _MODEL_WM0_
vreg_ctr[ VREG_C_MCU_VER_MAJOR ] += 0x20;
#endif
#ifdef _MODEL_TS0_
vreg_ctr[ VREG_C_MCU_VER_MAJOR ] += 0x10;
#endif
vreg_ctr[ VREG_C_MCU_VER_MINOR ] = MCU_VER_MINOR; vreg_ctr[ VREG_C_MCU_VER_MINOR ] = MCU_VER_MINOR;
} }
@ -46,9 +54,35 @@ void vreg_ctr_init(){
// を使用しないと、I2C_mcu使用中でエラー終了した場合にリトライしません。 // を使用しないと、I2C_mcu使用中でエラー終了した場合にリトライしません。
void vreg_ctr_write( u8 adrs, u8 data ){ void vreg_ctr_write( u8 adrs, u8 data ){
switch( adrs ){ switch( adrs ){
case( VREG_C_MCU_STATUS ):
vreg_ctr[ adrs ] = ( data & ~0x40 );
break;
case( VREG_C_VCOM_T ):
case( VREG_C_VCOM_B ):
renge_task_immed_add( tski_vcom_set );
vreg_ctr[ adrs ] = data;
break;
case( VREG_C_DBG1 ):
case( VREG_C_DBG2 ):
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' )
){
firm_update(); // 戻ってこない
}
break;
case( VREG_C_IRQ_MASK0 ): case( VREG_C_IRQ_MASK0 ):
case( VREG_C_IRQ_MASK1 ): case( VREG_C_IRQ_MASK1 ):
case( VREG_C_IRQ_MASK2 ): case( VREG_C_IRQ_MASK2 ):
case( VREG_C_IRQ_MASK3 ):
vreg_ctr[ adrs ] = data; vreg_ctr[ adrs ] = data;
break; break;
@ -62,52 +96,45 @@ void vreg_ctr_write( u8 adrs, u8 data ){
case( VREG_C_COMMAND1 ): case( VREG_C_COMMAND1 ):
vreg_ctr[ adrs ] = data; vreg_ctr[ adrs ] = data;
if( data != 0 ){ if( data != 0 ){
// renge_task_immed_add( do_command1 ); // renge_task_immed_add( do_command1 );
// 持ってきました /// 持ってきました
vreg_twl[ REG_TWL_ADRS_IRQ ] = (( vreg_ctr[ VREG_C_COMMAND1 ] & REG_BIT_TWL_CMD_PWSW_DET ) != 0 )? REG_BIT_TWL_IRQ_PWSW_DET: 0x00; //pwsw_det vreg_twl[ REG_TWL_ADRS_IRQ ] = (( vreg_ctr[ VREG_C_COMMAND1 ] & REG_BIT_TWL_CMD_PWSW_DET ) != 0 )? REG_BIT_TWL_IRQ_PWSW_DET: 0x00; //pwsw_det
vreg_twl[ REG_TWL_ADRS_IRQ ] |= (( vreg_ctr[ VREG_C_COMMAND1 ] & REG_BIT_TWL_CMD_RESET ) != 0 )? REG_BIT_TWL_IRQ_RESET: 0x00; //reset_req vreg_twl[ REG_TWL_ADRS_IRQ ] |= (( vreg_ctr[ VREG_C_COMMAND1 ] & REG_BIT_TWL_CMD_RESET ) != 0 )? REG_BIT_TWL_IRQ_RESET: 0x00; //reset_req
vreg_twl[ REG_TWL_ADRS_IRQ ] |= (( vreg_ctr[ VREG_C_COMMAND1 ] & REG_BIT_TWL_CMD_OFF ) != 0 )? REG_BIT_TWL_IRQ_OFF: 0x00; //off_req vreg_twl[ REG_TWL_ADRS_IRQ ] |= (( vreg_ctr[ VREG_C_COMMAND1 ] & REG_BIT_TWL_CMD_OFF ) != 0 )? REG_BIT_TWL_IRQ_OFF: 0x00; //off_req
vreg_twl[ REG_TWL_ADRS_IRQ ] |= (( vreg_ctr[ VREG_C_COMMAND1 ] & REG_BIT_TWL_CMD_BT_LOW ) != 0 )? REG_BIT_TWL_IRQ_BT_LOW: 0x00; //batt_low vreg_twl[ REG_TWL_ADRS_IRQ ] |= (( vreg_ctr[ VREG_C_COMMAND1 ] & REG_BIT_TWL_CMD_BT_LOW ) != 0 )? REG_BIT_TWL_IRQ_BT_LOW: 0x00; //batt_low
vreg_twl[ REG_TWL_ADRS_IRQ ] |= (( vreg_ctr[ VREG_C_COMMAND1 ] & REG_BIT_TWL_CMD_BT_EMPTY ) != 0 )? REG_BIT_TWL_IRQ_BT_EMPTY: 0x00; //batt_empty vreg_twl[ REG_TWL_ADRS_IRQ ] |= (( vreg_ctr[ VREG_C_COMMAND1 ] & REG_BIT_TWL_CMD_BT_EMPTY ) != 0 )? REG_BIT_TWL_IRQ_BT_EMPTY: 0x00; //batt_empty
vreg_twl[ REG_TWL_ADRS_IRQ ] |= (( vreg_ctr[ VREG_C_COMMAND1 ] & REG_BIT_TWL_CMD_VOL_CHANGE ) != 0 )? REG_BIT_TWL_IRQ_VOL_CHANGE: 0x00; //vol_changed vreg_twl[ REG_TWL_ADRS_IRQ ] |= (( vreg_ctr[ VREG_C_COMMAND1 ] & REG_BIT_TWL_CMD_VOL_CHANGE ) != 0 )? REG_BIT_TWL_IRQ_VOL_CHANGE: 0x00; //vol_changed
} }
break; break;
case( VREG_C_VCOM_T ): case( VREG_C_FREE0 ):
case( VREG_C_VCOM_B ): case( VREG_C_FREE1 ):
renge_task_immed_add( tski_vcom_set ); case( VREG_C_FREE2 ):
case( VREG_C_FREE3 ):
vreg_ctr[ adrs ] = data; vreg_ctr[ adrs ] = data;
break; break;
case( VREG_C_LED_BRIGHT ): case( VREG_C_LED_BRIGHT ):
vreg_ctr[ adrs ] = data; vreg_ctr[ adrs ] = data;
set_LED_cam();
break; break;
case( VREG_C_LED_POW_ILUMI ): case( VREG_C_LED_POW ):
vreg_ctr[ adrs ] = data; vreg_ctr[ adrs ] = data;
break; break;
case( VREG_C_WIFI_LED ): case( VREG_C_LED_WIFI ):
vreg_ctr[ adrs ] = data; vreg_ctr[ adrs ] = data;
set_led_wifi;
break; break;
case( VREG_C_CAM_LED ): case( VREG_C_LED_CAM ):
vreg_ctr[ adrs ] = data; vreg_ctr[ adrs ] = data;
set_LED_cam();
break; break;
case( VREG_C_MCU_STATUS ): case( VREG_C_LED_TUNE ):
vreg_ctr[ adrs ] = ( data & ~0x40 );
break;
case( VREG_C_RTC_COMP ):
vreg_ctr[ adrs ] = data; vreg_ctr[ adrs ] = data;
SUBCUD = data;
break; break;
case( VREG_C_RTC_SEC ): case( VREG_C_RTC_SEC ):
@ -122,7 +149,25 @@ void vreg_ctr_write( u8 adrs, u8 data ){
set_rtc( adrs - VREG_C_RTC_SEC, data ); set_rtc( adrs - VREG_C_RTC_SEC, data );
break; break;
case( VREG_C_ACC_CONFIG_HOSU ): case( VREG_C_RTC_COMP ):
vreg_ctr[ adrs ] = data;
SUBCUD = data;
break;
case( VREG_C_RTC_ALARM_MIN ):
case( VREG_C_RTC_ALARM_HOUR ):
vreg_ctr[ adrs ] = data;
rtc_alarm_dirty = 1;
break;
// 書くだけでよい
case( VREG_C_RTC_ALARM_DAY ):
case( VREG_C_RTC_ALARM_MONTH ):
case( VREG_C_RTC_ALARM_YEAR ):
vreg_ctr[ adrs ] = data;
break;
case( VREG_C_ACC_CONFIG ): case( VREG_C_ACC_CONFIG ):
vreg_ctr[ adrs ] = data; vreg_ctr[ adrs ] = data;
renge_task_immed_add( acc_hosu_set ); renge_task_immed_add( acc_hosu_set );
@ -148,46 +193,19 @@ void vreg_ctr_write( u8 adrs, u8 data ){
vreg_ctr[ adrs ] = data; vreg_ctr[ adrs ] = data;
break; break;
case( VREG_C_DIAG ): #ifdef _debug_
case( VREG_C_BT_REMAIN ):
case( VREG_C_BT_TEMP ):
vreg_ctr[ adrs ] = data; vreg_ctr[ adrs ] = data;
break; break;
#endif
case( VREG_C_COMMAND3 ):
case( VREG_C_RTC_ALARM_MIN ):
vreg_ctr[ adrs ] = data; vreg_ctr[ adrs ] = data;
ALARMWM = data; switch( data ){
break; case('r'): // マイコン再起動
WDTE = 0xAA;
case( VREG_C_RTC_ALARM_HOUR ): break;
vreg_ctr[ adrs ] = data;
ALARMWH = data;
break;
// 書くだけでよい
case( VREG_C_RTC_ALARM_DAY ):
case( VREG_C_RTC_ALARM_MONTH ):
case( VREG_C_RTC_ALARM_YEAR ):
case( VREG_C_FREE0 ):
case( VREG_C_FREE1 ):
case( VREG_C_FREE2 ):
case( VREG_C_FREE3 ):
vreg_ctr[ adrs ] = data;
break;
case( VREG_C_DBG0 ):
case( VREG_C_DBG1 ):
case( VREG_C_DBG2 ):
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' )
){
firm_update(); // 戻ってこない
} }
break; break;
} }
@ -216,20 +234,11 @@ u8 vreg_ctr_read( u8 adrs ){
void vreg_ctr_after_read( u8 adrs ){ void vreg_ctr_after_read( u8 adrs ){
// リードがトリガで何かをする↓ // リードがトリガで何かをする↓
switch( adrs ){ // 割り込みビットのクリア
// 読んだらクリア if( adrs == VREG_C_IRQ3 ){
case( VREG_C_IRQ0 ): vreg_ctr[ VREG_C_IRQ0 ] = 0; break; vreg_ctr[ VREG_C_IRQ0 ] = vreg_ctr[ VREG_C_IRQ1 ] =
case( VREG_C_IRQ1 ): vreg_ctr[ VREG_C_IRQ1 ] = 0; break; vreg_ctr[ VREG_C_IRQ2 ] = vreg_ctr[ VREG_C_IRQ3 ] = 0;
case( VREG_C_IRQ2 ): vreg_ctr[ VREG_C_IRQ2 ] = 0x02; break; // 暫定
}
/*
if(( adrs == VREG_C_IRQ0 ) || ( adrs == VREG_C_IRQ1 ) || ( adrs == VREG_C_IRQ2 )){
IRQ0_neg;
if(! (( vreg_ctr[ VREG_C_IRQ0 ] == 0 ) && ( vreg_ctr[ VREG_C_IRQ1 ] == 0 ) && ( vreg_ctr[ VREG_C_IRQ2 ] == 0x02 )) ){ // 暫定
IRQ0_ast;
} }
}
*/
return; return;
} }

View File

@ -4,11 +4,7 @@
#include "config.h" #include "config.h"
#if MCU_VER_MINOR <= 3 #if MCU_VER_MINOR >= 4
#include "vreg_ctr_03.h"
#else
#define REG_BIT_RTC_BLACKOUT 0b00000001 #define REG_BIT_RTC_BLACKOUT 0b00000001
#define REG_BIT__SYS_MODE0 0b01000000 #define REG_BIT__SYS_MODE0 0b01000000
@ -53,13 +49,13 @@
#define REG_BIT_BL_OFF ( 1 << 0 ) #define REG_BIT_BL_OFF ( 1 << 0 )
// VREG_C_STATUS0, // VREG_C_STATUS,
#define REG_BIT_LCD_POW ( 1 << 7 ) #define REG_BIT_LCD_POW ( 1 << 7 )
#define REG_BIT_BL ( 1 << 6 ) #define REG_BIT_BL ( 1 << 6 )
// #define REG_BIT_BATT_CHARGE_ERR ( 1 << 5 ) // #define REG_BIT_BATT_CHARGE_ERR ( 1 << 5 )
#define REG_BIT_BATT_CHARGE ( 1 << 4 ) #define REG_BIT_BATT_CHARGE ( 1 << 4 )
#define REG_BIT_POW_SUPPLY ( 1 << 3 ) #define REG_BIT_POW_SUPPLY ( 1 << 3 )
#define REG_BIT_EXT_OPT_LOCK ( 1 << 2 ) #define REG_BIT_ST_EXT_OPT_OPEN ( 1 << 2 )
#define REG_BIT_ST_SHELL_CLOSED ( 1 << 1 ) #define REG_BIT_ST_SHELL_CLOSED ( 1 << 1 )
@ -91,7 +87,18 @@ enum{
}; };
// VREG_C_CAM_LED
enum{
CAM_LED_OFF = 0,
CAM_LED_BLINK,
CAM_LED_ON,
CAM_LED_BY_TWL,
CAM_LED_ON_PLUSE,
CAM_LED_OFF_PLUSE
};
// TWLに送るコマンド
// command2 // command2
#define REG_BIT_TWL_CMD_PWSW_DET 0x01 #define REG_BIT_TWL_CMD_PWSW_DET 0x01
#define REG_BIT_TWL_CMD_RESET 0x02 #define REG_BIT_TWL_CMD_RESET 0x02
@ -100,7 +107,6 @@ enum{
#define REG_BIT_TWL_CMD_BT_EMPTY 0x10 #define REG_BIT_TWL_CMD_BT_EMPTY 0x10
#define REG_BIT_TWL_CMD_VOL_CHANGE 0x20 #define REG_BIT_TWL_CMD_VOL_CHANGE 0x20
// <20>ªTWL¤ // <20>ªTWL¤
#define REG_BIT_TWL_IRQ_PWSW_DET 0x80 #define REG_BIT_TWL_IRQ_PWSW_DET 0x80
#define REG_BIT_TWL_IRQ_RESET 0x01 #define REG_BIT_TWL_IRQ_RESET 0x01
@ -110,6 +116,14 @@ enum{
#define REG_BIT_TWL_IRQ_VOL_CHANGE 0x40 #define REG_BIT_TWL_IRQ_VOL_CHANGE 0x40
// TWLがSPIでPMICに投げたコマンド
#define REG_BIT_TWL_REQ_OFF_REQ ( 1 << 6 )
#define REG_BIT_TWL_REQ_RST_REQ ( 1 << 0 )
#define REG_BIT_TWL_REQ_BL ( 3 << 2 )
/* /*
ƒƒvƒŒ ƒƒvƒŒ
#define REG_BIT_ ( 1 << 7 ) #define REG_BIT_ ( 1 << 7 )
@ -159,6 +173,8 @@ enum VREG_C{ //
VREG_C_COMMAND0 = 0x20, VREG_C_COMMAND0 = 0x20,
VREG_C_COMMAND1, VREG_C_COMMAND1,
VREG_C_COMMAND2,
VREG_C_COMMAND3,
VREG_C_FREE0 = 0x24, VREG_C_FREE0 = 0x24,
VREG_C_FREE1, VREG_C_FREE1,
@ -166,11 +182,10 @@ enum VREG_C{ //
VREG_C_FREE3, VREG_C_FREE3,
VREG_C_LED_BRIGHT = 0x28, VREG_C_LED_BRIGHT = 0x28,
VREG_C_LED_POW_ILUMI, VREG_C_LED_POW,
VREG_C_WIFI_LED, VREG_C_LED_WIFI,
// LED0 VREG_C_LED_CAM,
VREG_C_CAM_LED, VREG_C_LED_TUNE,
// LED1
VREG_C_RTC_SEC = 0x30, VREG_C_RTC_SEC = 0x30,
VREG_C_RTC_MIN, VREG_C_RTC_MIN,
@ -213,7 +228,9 @@ enum VREG_C{ //
VREG_C_BT_INFO, // ¢Žg—p VREG_C_BT_INFO, // ¢Žg—p
*/ */
#define VREG_C_ACC_CONFIG_HOSU VREG_C_ACC_CONFIG #else
 "がらっと変えてしまったので、旧版のディレクトリを使用して下さい。"
#endif #endif
@ -224,4 +241,5 @@ u8 vreg_ctr_read( u8 phy_adrs );
void vreg_ctr_after_read( u8 adrs ); void vreg_ctr_after_read( u8 adrs );
#endif #endif

View File

@ -65,7 +65,7 @@ void vreg_twl_write( u8 adrs, u8 data ){
switch( adrs ){ switch( adrs ){
case( REG_TWL_INT_ADRS_COMMAND ): case( REG_TWL_INT_ADRS_COMMAND ):
if( data != 0 ){ if( data != 0 ){
renge_task_immed_add( command_from_twl ); set_irq( VREG_C_IRQ3, REG_BIT_TWL_RESET_REQ ); //リセットしかない。他のは、SPIから来ます。
break; break;
} }
@ -158,16 +158,3 @@ u8 adrs_table_twl_ext2int( u8 img ){
/* ========================================================
TWLからのコマンド
======================================================== */
task_status_immed command_from_twl(){
vreg_ctr[ VREG_C_IRQ2 ] |= REG_BIT_TWL_RESET_REQ;
if( ( vreg_ctr[ VREG_C_IRQ_MASK2 ] & REG_BIT_TWL_RESET_REQ ) == 0 ){
IRQ0_ast;
}
return( ERR_FINISED );
}

View File

@ -3,10 +3,10 @@ Version=6.00
Path=C:\78k_data\yav-mcu-basara\ Path=C:\78k_data\yav-mcu-basara\
Title=yav-mcu Title=yav-mcu
Series=78K0R.PM Series=78K0R.PM
Device=uPD78F1009_64 Device=uPD79F0104
DeviceVer=V1.11 DeviceVer=E1.00b
DebugMode=1 DebugMode=1
Target=C:\78k_data\yav-mcu-basara\bsr_k0r.lmf Target=C:\78k_data\yav-mcu-basara\bsr.lmf
[BuildMode0] [BuildMode0]
BuildModeName=Debug Build BuildModeName=Debug Build
TargetFile=0 TargetFile=0
@ -59,257 +59,6 @@ Source16=renge\renge.c
Source17=tasks_sys.c Source17=tasks_sys.c
Source18=accero.c Source18=accero.c
Source19=self_flash.c Source19=self_flash.c
[Options.LK78K0R 0]
Version=100
O0=bsr_k0r.lmf
O1=bsr.lmf
O2=flash.lmf
O3=a.lmf
G=1
E=0
E0=flash.elk
E1=a.elk
GO=1
GOValue=85
GOStart=FC00
GOSizeValue=1024
GI=1
GIValue=FFFFFFFFFFFFFFFFFFFF
CCZA=0
MemInfoCheck=1
P=1
P0=bsr_k0r.map
P1=bsr.map
P2=flash.map
P3=a.map
MI=0
GB=1
GBValue=6EFBFF
KM=1
KD=0
KP=1
KL=0
LF=0
LL=0
B0=C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib
D0=bsr_mcu.dr
D1=user_area.dr
S=1
W=0
SELFCheck=1
SELF=0
ZB=
Etcetera0=
Etcetera1=boot.lmf
CommandFile=0
[Options.LK78K0R 1]
Version=100
O0=a.lmf
G=0
E=0
E0=a.elk
GO=0
GOValue=
GOStart=FC00
GOSizeValue=1024
GI=0
GIValue=FFFFFFFFFFFFFFFFFFFF
CCZA=1
MemInfoCheck=0
P=1
P0=a.map
MI=0
GB=0
GBValue=
KM=1
KD=1
KP=0
KL=0
LF=0
LL=0
S=0
W=1
SELFCheck=0
SELF=0
ZB=
CommandFile=0
[Options.LK78K0R 2]
Version=100
O0=bsr_k0r.lmf
O1=bsr.lmf
O2=flash.lmf
O3=a.lmf
G=1
E=0
E0=flash.elk
E1=a.elk
GO=1
GOValue=85
GOStart=FC00
GOSizeValue=1024
GI=1
GIValue=FFFFFFFFFFFFFFFFFFFF
CCZA=0
MemInfoCheck=1
P=1
P0=bsr_k0r.map
P1=bsr.map
P2=flash.map
P3=a.map
MI=0
GB=1
GBValue=6EFBFF
KM=1
KD=0
KP=1
KL=0
LF=0
LL=0
B0=C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib
D0=bsr_mcu.dr
D1=user_area.dr
S=1
W=0
SELFCheck=0
SELF=0
ZB=
Etcetera0=
Etcetera1=boot.lmf
CommandFile=0
OFILE=C:\78k_data\yav-mcu-basara\bsr_k0r.lmf
[Options.LK78K0R 3]
Version=100
O0=bsr_bsr.lmf
O1=bsr_k0r.lmf
O2=bsr.lmf
O3=flash.lmf
O4=a.lmf
G=1
E=0
E0=flash.elk
E1=a.elk
GO=1
GOValue=85
GOStart=FC00
GOSizeValue=1024
GI=1
GIValue=FFFFFFFFFFFFFFFFFFFF
CCZA=0
MemInfoCheck=1
P=1
P0=bsr_bsr.map
P1=bsr_k0r.map
P2=bsr.map
P3=flash.map
P4=a.map
MI=0
GB=1
GBValue=6EFBFF
KM=1
KD=0
KP=1
KL=0
LF=0
LL=0
B0=C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib
D0=bsr_mcu.dr
D1=user_area.dr
S=1
W=2
SELFCheck=0
SELF=0
ZB=
Etcetera0=
Etcetera1=boot.lmf
CommandFile=0
[Options.LK78K0R 4]
Version=100
O0=bsr_k0r.lmf
O1=bsr.lmf
O2=flash.lmf
O3=a.lmf
G=1
E=0
E0=flash.elk
E1=a.elk
GO=1
GOValue=85
GOStart=FC00
GOSizeValue=1024
GI=1
GIValue=FFFFFFFFFFFFFFFFFFFF
CCZA=0
MemInfoCheck=1
P=1
P0=bsr_k0r.map
P1=bsr.map
P2=flash.map
P3=a.map
MI=0
GB=1
GBValue=6EFBFF
KM=1
KD=0
KP=1
KL=0
LF=0
LL=0
B0=C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib
D0=bsr_mcu.dr
D1=user_area.dr
S=1
W=0
SELFCheck=1
SELF=0
ZB=
Etcetera0=
Etcetera1=boot.lmf
CommandFile=0
[Options.LK78K0R 5]
Version=100
O0=bsr_bsr.lmf
O1=bsr_k0r.lmf
O2=bsr.lmf
O3=flash.lmf
O4=a.lmf
G=1
E=0
E0=flash.elk
E1=a.elk
GO=1
GOValue=85
GOStart=FC00
GOSizeValue=1024
GI=1
GIValue=FFFFFFFFFFFFFFFFFFFF
CCZA=0
MemInfoCheck=1
P=1
P0=bsr_bsr.map
P1=bsr_k0r.map
P2=bsr.map
P3=flash.map
P4=a.map
MI=0
GB=1
GBValue=6EFBFF
KM=1
KD=0
KP=1
KL=0
LF=0
LL=0
B0=C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib
D0=bsr_mcu.dr
D1=user_area.dr
S=1
W=2
SELFCheck=0
SELF=0
ZB=
Etcetera0=
Etcetera1=boot.lmf
CommandFile=0
[Options.RA78K0R 0] [Options.RA78K0R 0]
Version=100 Version=100
G=1 G=1
@ -418,36 +167,6 @@ LT=8
Z=0 Z=0
CommandFile=0 CommandFile=0
RA_OPT= RA_OPT=
[Options.LCNV78K0R 0]
Version=100
LCNV_GO=0
E=0
CommandFile=0
[Options.LCNV78K0R 1]
Version=100
LCNV_GO=0
E=0
CommandFile=0
[Options.LCNV78K0R 2]
Version=100
LCNV_GO=0
E=0
CommandFile=0
[Options.LCNV78K0R 3]
Version=100
LCNV_GO=0
E=0
CommandFile=0
[Options.LCNV78K0R 4]
Version=100
LCNV_GO=0
E=0
CommandFile=0
[Options.LCNV78K0R 5]
Version=100
LCNV_GO=0
E=0
CommandFile=0
[Options.OC78K0R 0] [Options.OC78K0R 0]
Version=100 Version=100
O0=.\bsr.hex O0=.\bsr.hex
@ -524,16 +243,6 @@ ZF=0
S=1 S=1
E=0 E=0
CommandFile=0 CommandFile=0
[Options.78K0R]
BuildMode=2
BuildMode2=K0R_dbg
BuildMode3=BSR_dbg
BuildMode4=BSR_rel
BuildMode5=BSR_WM0
DefaultMode2=1
DefaultMode3=1
DefaultMode4=1
DefaultMode5=1
[Options.CC78K0R 0] [Options.CC78K0R 0]
Version=210 Version=210
Include0=renge,C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r Include0=renge,C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r
@ -744,7 +453,7 @@ Intunexpand=0
Kanjicode=1210 Kanjicode=1210
Verbose=0 Verbose=0
CommandFile=0 CommandFile=0
Warninglevel=2 Warninglevel=1
Startupchk=1 Startupchk=1
Fixation=0 Fixation=0
FarROMization=0 FarROMization=0
@ -1000,11 +709,6 @@ VfiFileBoot0=
VfiFileBoot1=boot.vfi VfiFileBoot1=boot.vfi
VF78K0Rchk=0 VF78K0Rchk=0
VF78K0Rvs= VF78K0Rvs=
[ToolSet]
ToolSetName=(•Ï<E280A2>X)78K0R Software Package V1.10
Tool1=CC78K0R|W2.10
Tool2=RA78K0R|W1.31
Tool3=ID78K0R-QB|V3.60
[IncFile] [IncFile]
Include1=incs_loader.h Include1=incs_loader.h
Include2=jhl_defs.h Include2=jhl_defs.h
@ -1031,4 +735,300 @@ Include22=accero.h
Include23=i2c_twl_defs.h Include23=i2c_twl_defs.h
Include24=renge\renge_task_intval.h Include24=renge\renge_task_intval.h
Include25=i2c_twl.h Include25=i2c_twl.h
Include26=vreg_ctr_03.h Include26=..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h
[Options.LK78K0R 0]
Version=100
O0=bsr_k0r.lmf
O1=bsr.lmf
O2=flash.lmf
O3=a.lmf
G=1
E=0
E0=flash.elk
E1=a.elk
GO=1
GOValue=85
GOStart=FC00
GOSizeValue=1024
GI=1
GIValue=FFFFFFFFFFFFFFFFFFFF
CCZA=0
MemInfoCheck=1
P=1
P0=bsr_k0r.map
P1=bsr.map
P2=flash.map
P3=a.map
MI=0
GB=1
GBValue=6EFBFF
KM=1
KD=0
KP=1
KL=0
LF=0
LL=0
B0=C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib
D0=bsr_mcu.dr
D1=user_area.dr
S=1
W=0
SELFCheck=1
SELF=0
ZB=
Etcetera0=
Etcetera1=boot.lmf
CommandFile=0
[Options.LK78K0R 1]
Version=100
O0=a.lmf
G=0
E=0
E0=a.elk
GO=0
GOValue=
GOStart=FC00
GOSizeValue=1024
GI=0
GIValue=FFFFFFFFFFFFFFFFFFFF
CCZA=1
MemInfoCheck=0
P=1
P0=a.map
MI=0
GB=0
GBValue=
KM=1
KD=1
KP=0
KL=0
LF=0
LL=0
S=0
W=1
SELFCheck=0
SELF=0
ZB=
CommandFile=0
[Options.LK78K0R 2]
Version=100
O0=bsr.lmf
O1=bsr_k0r.lmf
O2=flash.lmf
O3=a.lmf
G=1
E=0
E0=flash.elk
E1=a.elk
GO=1
GOValue=85
GOStart=FC00
GOSizeValue=1024
GI=1
GIValue=FFFFFFFFFFFFFFFFFFFF
CCZA=0
MemInfoCheck=1
P=1
P0=bsr_k0r.map
P1=bsr.map
P2=flash.map
P3=a.map
MI=0
GB=1
GBValue=7EFBFF
KM=1
KD=0
KP=1
KL=0
LF=0
LL=0
B0=C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib
D0=bsr_mcu.dr
D1=user_area.dr
S=1
W=0
SELFCheck=0
SELF=0
ZB=
Etcetera0=
Etcetera1=boot.lmf
CommandFile=0
OFILE=C:\78k_data\yav-mcu-basara\bsr.lmf
[Options.LK78K0R 3]
Version=100
O0=bsr_bsr.lmf
O1=bsr_k0r.lmf
O2=bsr.lmf
O3=flash.lmf
O4=a.lmf
G=1
E=0
E0=flash.elk
E1=a.elk
GO=1
GOValue=85
GOStart=FC00
GOSizeValue=1024
GI=1
GIValue=FFFFFFFFFFFFFFFFFFFF
CCZA=0
MemInfoCheck=1
P=1
P0=bsr_bsr.map
P1=bsr_k0r.map
P2=bsr.map
P3=flash.map
P4=a.map
MI=0
GB=1
GBValue=6EFBFF
KM=1
KD=0
KP=1
KL=0
LF=0
LL=0
B0=C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib
D0=bsr_mcu.dr
D1=user_area.dr
S=1
W=2
SELFCheck=0
SELF=0
ZB=
Etcetera0=
Etcetera1=boot.lmf
CommandFile=0
[Options.LK78K0R 4]
Version=100
O0=bsr_k0r.lmf
O1=bsr.lmf
O2=flash.lmf
O3=a.lmf
G=1
E=0
E0=flash.elk
E1=a.elk
GO=1
GOValue=85
GOStart=FC00
GOSizeValue=1024
GI=1
GIValue=FFFFFFFFFFFFFFFFFFFF
CCZA=0
MemInfoCheck=1
P=1
P0=bsr_k0r.map
P1=bsr.map
P2=flash.map
P3=a.map
MI=0
GB=1
GBValue=6EFBFF
KM=1
KD=0
KP=1
KL=0
LF=0
LL=0
B0=C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib
D0=bsr_mcu.dr
D1=user_area.dr
S=1
W=0
SELFCheck=1
SELF=0
ZB=
Etcetera0=
Etcetera1=boot.lmf
CommandFile=0
[Options.LK78K0R 5]
Version=100
O0=bsr_bsr.lmf
O1=bsr_k0r.lmf
O2=bsr.lmf
O3=flash.lmf
O4=a.lmf
G=1
E=0
E0=flash.elk
E1=a.elk
GO=1
GOValue=85
GOStart=FC00
GOSizeValue=1024
GI=1
GIValue=FFFFFFFFFFFFFFFFFFFF
CCZA=0
MemInfoCheck=1
P=1
P0=bsr_bsr.map
P1=bsr_k0r.map
P2=bsr.map
P3=flash.map
P4=a.map
MI=0
GB=1
GBValue=6EFBFF
KM=1
KD=0
KP=1
KL=0
LF=0
LL=0
B0=C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib
D0=bsr_mcu.dr
D1=user_area.dr
S=1
W=2
SELFCheck=0
SELF=0
ZB=
Etcetera0=
Etcetera1=boot.lmf
CommandFile=0
[Options.LCNV78K0R 0]
Version=100
LCNV_GO=0
E=0
CommandFile=0
[Options.LCNV78K0R 1]
Version=100
LCNV_GO=0
E=0
CommandFile=0
[Options.LCNV78K0R 2]
Version=100
LCNV_GO=0
E=0
CommandFile=0
[Options.LCNV78K0R 3]
Version=100
LCNV_GO=0
E=0
CommandFile=0
[Options.LCNV78K0R 4]
Version=100
LCNV_GO=0
E=0
CommandFile=0
[Options.LCNV78K0R 5]
Version=100
LCNV_GO=0
E=0
CommandFile=0
[Options.78K0R]
BuildMode=2
BuildMode2=K0R_dbg
BuildMode3=BSR_dbg
BuildMode4=BSR_rel
BuildMode5=BSR_WM0
DefaultMode2=1
DefaultMode3=1
DefaultMode4=1
DefaultMode5=1
[ToolSet]
ToolSetName=(•Ï<E280A2>X)78K0R Software Package V1.10
Tool1=CC78K0R|W2.10
Tool2=RA78K0R|W1.31
Tool3=ID78K0R-QB|V3.60

View File

@ -1,23 +1,16 @@
[ProjectManager] [ProjectManager]
FrameMax=1 FrameMax=1
FrameX=35 FrameX=102
FrameY=0 FrameY=62
FrameCX=1375 FrameCX=1503
FrameCY=1183 FrameCY=631
OpenFile1=vreg_ctr.c,0,260,12,1504,769,120,228,0,0 OpenFile1=i2c_mcu.c,0,330,330,1204,1087,48,321,48,0
OpenFile2=pm.c,0,66,66,1310,823,0,343,0,0 OpenFile2=renge\\renge_defs.h,0,330,330,1574,1087,0,47,0,0
OpenFile3=rtc.c,0,198,198,1442,955,3,130,0,0 OpenFile3=ProjectWindow
OpenFile4=inter_asm\i2c_ctr.asm,0,242,242,1486,999,4,269,8,0 PrjPos=0,2,754,3,253
OpenFile5=renge\renge.c,0,176,176,1420,933,7,213,43,0 OpenFile4=config.h,0,168,78,1412,835,0,14,21,0
OpenFile6=led.c,0,286,286,1530,1043,30,68,30,0 OpenFile5=OutputWindow
OpenFile7=i2c_ctr.c,0,154,299,1398,1056,0,72,6,0 OutputPos=0,67,1023,707,1568
OpenFile8=i2c_twl.c,0,483,300,1727,1057,0,72,0,0
OpenFile9=tasks.c,0,132,132,1376,889,47,104,36,0
OpenFile10=i2c_mcu.c,0,330,330,1204,1087,0,331,0,0
OpenFile11=ProjectWindow
PrjPos=0,6,758,2,252
OpenFile12=OutputWindow
OutputPos=0,704,1089,701,1562
ActivePRJ=yav_mcu_bsr.prj ActivePRJ=yav_mcu_bsr.prj
[ProjectWindow] [ProjectWindow]
ProjectWindowDispType=0 ProjectWindowDispType=0

View File

@ -1,7 +1,7 @@
[SdbInfo] [SdbInfo]
Ver=5 Ver=5
[loader.c] [loader.c]
T=4aa7256f T=4ac169a4
1=incs_loader.h 1=incs_loader.h
2=fsl.h 2=fsl.h
3=fsl_user.h 3=fsl_user.h
@ -10,46 +10,47 @@ T=4aa7256f
6=pm.h 6=pm.h
7=rtc.h 7=rtc.h
[pm.c] [pm.c]
T=4aae01f1 T=4ac09552
1=incs_loader.h 1=incs_loader.h
2=adc.h 2=adc.h
3=led.h 3=led.h
4=pm.h 4=pm.h
[i2c_ctr.c] [i2c_ctr.c]
T=4aaf55db T=4ac07479
1=incs.h 1=incs.h
[main.c] [main.c]
T=4a9e6e71 T=4ac0af62
1=incs.h 1=incs.h
2=WDT.h 2=WDT.h
3=rtc.h 3=rtc.h
4=pm.h 4=pm.h
5=accero.h 5=accero.h
[magic.c] [magic.c]
T=4aa4d76e T=4ac01920
1=config.h
[WDT.c] [WDT.c]
T=4a9e6e71 T=4a9e6e71
1=incs_loader.h 1=incs_loader.h
[i2c_mcu.c] [i2c_mcu.c]
T=4aaf5bf7 T=4ac0b193
1=incs.h 1=incs.h
2=i2c_mcu.h 2=i2c_mcu.h
[i2c_twl.c] [i2c_twl.c]
T=4aaf55db T=4ac07a54
1=incs.h 1=incs.h
2=i2c_twl_defs.h 2=i2c_twl_defs.h
[ini_VECT.c] [ini_VECT.c]
T=4aae33c6 T=4ac169a4
1=config.h 1=config.h
[led.c] [led.c]
T=4aaf5378 T=4ac15aa7
1=incs.h 1=incs.h
2=led.h 2=led.h
[rtc.c] [rtc.c]
T=4aaee84a T=4ac1c178
1=incs.h 1=incs.h
[vreg_ctr.c] [vreg_ctr.c]
T=4aadf96a T=4ac1a405
1=incs.h 1=incs.h
2=vreg_ctr.h 2=vreg_ctr.h
3=rtc.h 3=rtc.h
@ -57,29 +58,30 @@ T=4aadf96a
5=accero.h 5=accero.h
6=pm.h 6=pm.h
[vreg_twl.c] [vreg_twl.c]
T=4aa8a1dd T=4ab332c7
1=incs.h 1=incs.h
2=jhl_defs.h 2=jhl_defs.h
3=vreg_twl.h 3=vreg_twl.h
[tasks.c] [tasks.c]
T=4aaf56f5 T=4ac169a4
1=incs.h 1=incs.h
2=renge\renge.h 2=renge\renge.h
3=pm.h 3=pm.h
[adc.c] [adc.c]
T=4aadf487 T=4ac15aa7
1=incs.h 1=incs.h
2=adc.h 2=adc.h
3=pm.h 3=pm.h
4=led.h 4=led.h
[renge\renge.c] [renge\renge.c]
T=4aae3b80 T=4ac0a6c5
1=renge\renge_defs.h 1=renge\renge_defs.h
2=renge\renge_task_intval.h 2=renge\renge_task_intval.h
3=renge\renge_task_immediate.h 3=renge\renge_task_immediate.h
4=WDT.h 4=WDT.h
5=bsr_system.h
[tasks_sys.c] [tasks_sys.c]
T=4aae102d T=4ac1a252
1=incs.h 1=incs.h
2=i2c_twl.h 2=i2c_twl.h
3=i2c_ctr.h 3=i2c_ctr.h
@ -88,12 +90,12 @@ T=4aae102d
6=pm.h 6=pm.h
7=rtc.h 7=rtc.h
[accero.c] [accero.c]
T=4aa8a1dd T=4ac1a5fc
1=incs.h 1=incs.h
[self_flash.c] [self_flash.c]
T=4aa79d0f T=4ac07a54
1=incs_loader.h 1=incs_loader.h
2=fsl.h 2=..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h
3=fsl_user.h 3=fsl_user.h
4=i2c_ctr.h 4=i2c_ctr.h
[incs_loader.h] [incs_loader.h]
@ -107,17 +109,16 @@ T=4a9e6e71
7=i2c_mcu.h 7=i2c_mcu.h
8=WDT.h 8=WDT.h
[jhl_defs.h] [jhl_defs.h]
T=4a9e6e71 T=4ab3330b
[user_define.h] [user_define.h]
T=4aae0407 T=4ac1a76f
1=config.h 1=config.h
[config.h] [config.h]
T=4aaf54ba T=4ac1d2cd
[bsr_system.h] [bsr_system.h]
T=4aaddbc7 T=4ac09552
1=jhl_defs.h
[renge\renge.h] [renge\renge.h]
T=4aa9df1e T=4abc82ef
1=renge\renge_defs.h 1=renge\renge_defs.h
2=renge\renge_task_immediate.h 2=renge\renge_task_immediate.h
[renge\renge_defs.h] [renge\renge_defs.h]
@ -126,7 +127,8 @@ T=4aa79102
T=4a8a7575 T=4a8a7575
1=renge\renge_defs.h 1=renge\renge_defs.h
[vreg_ctr.h] [vreg_ctr.h]
T=4aadcdb0 T=4ac14c41
1=config.h
[loader.h] [loader.h]
T=4a7a31d0 T=4a7a31d0
1=jhl_defs.h 1=jhl_defs.h
@ -141,16 +143,16 @@ T=4a7bf458
[i2c_ctr.h] [i2c_ctr.h]
T=4a7c0777 T=4a7c0777
[pm.h] [pm.h]
T=4aa7a30d T=4ab47f83
[rtc.h] [rtc.h]
T=4aaee839 T=4ab48e99
[adc.h] [adc.h]
T=4aa74fb6 T=4aa74fb6
1=jhl_defs.h 1=jhl_defs.h
[led.h] [led.h]
T=4aa74fb6 T=4ac15aa7
[incs.h] [incs.h]
T=4aaddc46 T=4ac0857f
1=jhl_defs.h 1=jhl_defs.h
2=user_define.h 2=user_define.h
3=bsr_system.h 3=bsr_system.h
@ -167,7 +169,9 @@ T=4aa7853b
[i2c_twl_defs.h] [i2c_twl_defs.h]
T=4a7c074e T=4a7c074e
[renge\renge_task_intval.h] [renge\renge_task_intval.h]
T=4aa787f2 T=4ab226cf
1=renge\renge_defs.h 1=renge\renge_defs.h
[i2c_twl.h] [i2c_twl.h]
T=4a7c0786 T=4a7c0786
[..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h]
T=49a3bd4e