TWL側の充電フラグ修正

TWL側カメラLEDレジスタの、「1発だけ消灯」修正
不要コード削除
reboot.*追加


git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@16 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
fujita_ryohei 2009-10-29 06:50:26 +00:00
parent 972a9bcd16
commit 50a1948303
15 changed files with 98 additions and 99 deletions

View File

@ -68,8 +68,6 @@ void tsk_adc( )
static u8 vol_old;
static u8 class_old;
u8 class;
static u8 direction = 0; // 0:上り方向
u8 comp; // 補正値
if( abs( vol_old - vreg_ctr[VREG_C_SND_VOL] ) > 3 )
{
@ -87,14 +85,16 @@ void tsk_adc( )
}
// デバイスに伝える
if( sndvol_codec != vreg_ctr[VREG_C_SND_VOL] )
{
sndvol_codec = vreg_ctr[VREG_C_SND_VOL];
// codecに伝える
// DCPにも伝えておく
iic_mcu_write_a_byte( IIC_SLA_DCP, 0,
( sndvol_codec / 2 + vreg_ctr[VREG_C_SND_VOL] / 4 ));
sndvol_codec / 2 + sndvol_codec / 4 ); // 簡易スケーリング todo
// codecに伝える
iic_mcu_write_a_byte( IIC_SLA_CODEC, REG_ADRS_CODEC_VOL,
127 - ( sndvol_codec / 2 + vreg_ctr[VREG_C_SND_VOL] / 4 )/2 );
127 - ( sndvol_codec / 2 + sndvol_codec / 4 )/2 );
}
adc_updated = 0;
}
@ -139,6 +139,7 @@ static u8 getmean3( u8 * hist )
{
u8 temp;
// ちょっと並び替え
if( *hist < *( hist + 1 ) )
{
temp = *hist;

View File

@ -2,7 +2,6 @@
#define __config__
#define _debug_
// #define _debug_led_
#define MCU_VER_MAJOR 0;
@ -19,6 +18,8 @@
#define _CODEC_CTR_
// ---------------------------------- //
#ifdef _MODEL_TEG2_
#define _PMIC_TWL_
#define _MCU_KE3_

View File

@ -469,6 +469,7 @@ void tsk_led_cam( )
{
static u8 state_led_cam = 0;
static u8 task_interval;
static u8 state_led_cam_twl;
if( task_interval != 0 )
{
@ -530,7 +531,7 @@ void tsk_led_cam( )
break;
case ( CAM_LED_BY_TWL ):
switch ( vreg_twl[ REG_TWL_INT_ADRS_CAM ] ){
switch ( vreg_twl[ REG_TWL_INT_ADRS_CAM ] ){ // switchのネストとか…
case( TWL_CAMLED_OFF ):
LED_duty_CAM = 0;
state_led_cam = 0;
@ -554,7 +555,7 @@ void tsk_led_cam( )
case( TWL_CAMLED_DEF_ON ):
default:
LED_duty_CAM = vreg_ctr[VREG_C_LED_BRIGHT];
state_led_cam = 0;
state_led_cam = 1;
break;
}
}

View File

@ -23,28 +23,14 @@
// ========================================================
err to_sleep( );
static void read_dipsw( );
unsigned char temp_teg;
extern void power_save( );
// ========================================================
bit active;
bit sleep;
bit rsv_to_sleep;
bit rsv_LCD_on;
bit rsv_BL_on;
system_status_ system_status;
u8 off_delay; // 電源 OFF から PWSW 等で電源オンする際、押してる時間をカウントするのに使う
extern u8 boot_ura;
/* ========================================================

View File

@ -561,18 +561,6 @@ err PM_sys_pow_off( )
/* ========================================================
======================================================== */
err to_sleep( )
{
PM_LCD_off( );
return 0;
}
/* ========================================================
@ -680,7 +668,6 @@ __interrupt void intp4_extdc( )
/*=========================================================
OFFから起こす
(misc)
=========================================================*/
__interrupt void intp5_shell( )

24
trunk/reboot.c Normal file
View File

@ -0,0 +1,24 @@
/********************************************************//*
**********************************************************/
#pragma SFR
#include "incs_loader.h"
void my_reboot(){
#asm
MOV PSW,#06H ; PSWをセット
MOVW AX,#000d0h ;
PUSH PSW
PUSH AX ; RETIのためのスタックを準備
RETI ;
#endasm
}

6
trunk/reboot.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef __MYREBOOT__
#define __MYREBOOT__
void my_reboot();
#endif

View File

@ -173,12 +173,13 @@ void tsk_sys( )
}
}
#if 0
// SLPŠÄŽ
if( SLP_REQ ){
system_status.pwr_state = SLEEP_TRIG;
renge_task_interval_run_force = 1;
}
#endif
break;
case SLEEP_TRIG: //-------------------------------------

View File

@ -40,12 +40,6 @@
#endif
#ifdef _MCU_KE3_
extern unsigned char temp_teg;
#define P20 temp_teg
#endif
#ifdef _PMIC_TWL_
#define PM_TEG_PWSW P7.5 // TEGのみ
#define PM_TEG_LCD_dis( val ) ( P7.6 = val ) // TEGのみ

View File

@ -3,16 +3,20 @@
TWL互換側のI2Cレジスタ
======================================================== */
#include "incs.h"
#include "jhl_defs.h"
#include "vreg_twl.h"
#include "vreg_ctr.h"
// ========================================================
#define TWL_REG_VER_INFO 0x35
u8 vreg_twl[_REG_TWL_INT_ADRS_EDNMARK];
// ========================================================
u8 vreg_twl[_REG_TWL_INT_ADRS_ENDMARK];
/* ========================================================
@ -20,8 +24,7 @@ u8 vreg_twl[_REG_TWL_INT_ADRS_EDNMARK];
======================================================== */
void vreg_twl_init( )
{
vreg_twl[0x03] = 0x03;
// vreg_twl[0x03] = 0x03;
vreg_twl[ REG_TWL_INT_ADRS_MODE ] = 0x03;
}
@ -56,6 +59,7 @@ void vreg_twl_write( u8 adrs, u8 data )
}
// ========================================================
// I2C仮想レジスタから読みます。
// 引数 adrs 外から見たときの、アドレス
@ -70,24 +74,32 @@ u8 vreg_twl_read( u8 phy_adrs )
return( TWL_REG_VER_INFO );
case( REG_TWL_INT_ADRS_POWER_INFO ):
vreg_twl[ REG_TWL_INT_ADRS_POWER_INFO ] = 0x0F;
if( PM_EXTDC )
{
return ( vreg_twl[ REG_TWL_INT_ADRS_POWER_INFO ] | 0x80 );
}
else
{
return ( vreg_twl[ REG_TWL_INT_ADRS_POWER_INFO ] );
if( vreg_ctr[ VREG_C_BT_REMAIN ] > 90 ){
vreg_twl[ REG_TWL_INT_ADRS_POWER_INFO ] = 0x0F;
}else if( vreg_ctr[ VREG_C_BT_REMAIN ] > 75 ){
vreg_twl[ REG_TWL_INT_ADRS_POWER_INFO ] = 0x0B;
}else if( vreg_ctr[ VREG_C_BT_REMAIN ] > 50 ){
vreg_twl[ REG_TWL_INT_ADRS_POWER_INFO ] = 0x07;
}else if( vreg_ctr[ VREG_C_BT_REMAIN ] > 25 ){
vreg_twl[ REG_TWL_INT_ADRS_POWER_INFO ] = 0x03;
}else if( vreg_ctr[ VREG_C_BT_REMAIN ] > 5 ){
vreg_twl[ REG_TWL_INT_ADRS_POWER_INFO ] = 0x01;
}else{
vreg_twl[ REG_TWL_INT_ADRS_POWER_INFO ] = 0x00;
}
return( vreg_twl[ REG_TWL_INT_ADRS_POWER_INFO ] | ( !BT_CHG_n ? 0x80: 0x00 ) ); // ƒAƒ_ƒvƒ^bit
case( REG_TWL_INT_ADRS_IRQ ):
temp = vreg_twl[ REG_TWL_INT_ADRS_IRQ ];
vreg_twl[ REG_TWL_INT_ADRS_IRQ ]= 0;
return( temp );
default: return( vreg_twl[ phy_adrs ] );
default:
return( vreg_twl[ phy_adrs ] );
case( 0xFF ): return( 0x00 );
case( 0xFF ):
return( 0x00 );
}
}

View File

@ -87,7 +87,7 @@ enum REG_TWL_ADRS_INT
// REG_TWL_INT_ADRS_TEMP7,
// REG_TWL_INT_ADRS_TIME_PWSW_DELAY,
// REG_TWL_INT_ADRS_TIME_PWSW_THRESHOLD
_REG_TWL_INT_ADRS_EDNMARK,
_REG_TWL_INT_ADRS_ENDMARK,
};

View File

@ -1,15 +1,6 @@
C:\WINDOWS\system32\cmd.exe /c echo touch magic.c
touch magic.c
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -qcvjl1wt -sainter_asm -zp -no tasks_sys.c
tasks_sys.c(343) : CC78K0R warning W0401: Conversion may lose significant digits
Compilation complete, 0 error(s) and 1 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\tasks_sys.asm
Assembly complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\lk78k0r.exe" -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -obsr.lmf "..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r\s0rm.rel" -go85h,0FC00h,1024 -gi0FFFFFFFFFFFFFFFFFFFFh -pbsr_k0r.map -nkd -kp -gb7EFBFFh -b"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib" -bcl0rdm.lib -bcl0rm.lib -bcl0rmf.lib -i"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r" -dbsr_mcu.dr -s -w0 loader.rel pm.rel i2c_ctr.rel main.rel magic.rel WDT.rel i2c_mcu.rel i2c_twl.rel ini_VECT.rel led.rel rtc.rel vreg_ctr.rel vreg_twl.rel tasks.rel adc.rel renge.rel tasks_sys.rel accero.rel self_flash.rel reboot.rel
Link complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\oc78k0r.exe" -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -o.\bsr.hex -nu -ki bsr.lmf
Object Conversion Complete, 0 error(s) and 0 warning(s) found.
C:\WINDOWS\system32\cmd.exe /c ruby C:\Cygwin\home\fujita_ryohei\ctr\nec_s_2_bsrbin.rb bsr.hex
C:/Cygwin/home/fujita_ryohei/ctr/nec_s_2_bsrbin.rb:2: warning: variable $KCODE is no longer effective; ignored
Build Total error(s) : 0 Total warning(s) : 1
Build Total error(s) : 0 Total warning(s) : 0

View File

@ -78,7 +78,7 @@ Symbol Type=OFF
Language=C
Kanji=SJIS
[Source]
Geometry=304, 189, 1090, 857
Geometry=162, 219, 1090, 857
Window=Normal
DispStart=167
CaretPos=168,0
@ -256,7 +256,7 @@ Window=Normal
Boundary=13762687
Mode=Proper
[Sfr]
Geometry=0, 0, 0, 0
Geometry=100, 100, 400, 400
Window=Hide
Address1=
Address2=
@ -274,13 +274,13 @@ Address13=
Address14=
Address15=
Address16=
Boundary=0, 0
Boundary=202, 89
Mode=Hex
Attribute=Show
Sort=Unsort
Pickup=OFF
SelectSort=Address
Last Name=
Last Name=P0
Line=531
L1=P0
L2=P1
@ -814,7 +814,7 @@ L529=IICWL1
L530=IICWH1
L531=SVA1
[Local Variable]
Geometry=1192, 334, 400, 300
Geometry=1188, 318, 400, 300
Window=Normal
Boundary=13041851
Mode=Proper
@ -866,7 +866,7 @@ SaveRange=Screen
SaveStart=
SaveEnd=
[Register]
Geometry=36, 663, 250, 400
Geometry=1329, 693, 250, 400
Window=Normal
Mode=Hex
Boundary=62
@ -960,16 +960,13 @@ Count=0
Geometry=1138, 6, 440, 300
Window=Normal
Boundary=13762700
0=.P12.0,P,S,A,+,1
1=.system_status,.,N,A,+,1
2=.RTCEN,P,S,A,+,1
3=.P2,B,S,A,+,1
4=.PM2,B,S,A,+,1
5=.PM20,B,S,A,+,1
6=.P20,B,S,A,+,1
7=.wifi_TX,P,N,A,+,1
8=.temp,P,N,A,+,1
Line=9
0=.system_status.pwr_state,P,N,A,+,1
1=.P12.0,P,S,A,+,1
2=.system_status,.,N,A,+,1
3=.vreg_twl,P,N,A,+,1
4=.wifi_TX,P,N,A,+,1
5=.temp,P,N,A,+,1
Line=6
[Quick Watch]
0=temp,P,A,1
1=wifi_TX,P,A,1
@ -980,9 +977,9 @@ Line=9
6=RTCEN,P,A,1
7=system_status,P,A,1
8=P12.0,P,A,1
9=
10=
11=
9=system_status.pwr_state,P,A,1
10=pm12,P,A,1
11=vreg_twl,P,A,1
12=
13=
14=
@ -995,12 +992,12 @@ Name0=Swb00001
Address0=self_flash.c#_firm_update+0x209
Window0=ASM
Status0=ON
Name1=Swb00002
Address1=adc.c#_tsk_adc+0x7a
Name1=Swb00004
Address1=vreg_twl.c#_vreg_twl_read+0x56
Window1=ASM
Status1=ON
Name2=Swb00003
Address2=tasks_sys.c#_tsk_sys+0x3
Name2=Swb00002
Address2=vreg_twl.c#_vreg_twl_read+0x18
Window2=ASM
Status2=ON
Count=3

View File

@ -21,10 +21,8 @@ OpenFile14=led.c,0,286,286,1469,912,0,420,6,0
OpenFile15=ProjectWindow
PrjPos=0,2,754,3,253
OpenFile16=adc.c,0,0,0,790,447,0,97,0,0
OpenFile17=config.h,0,259,332,1503,1089,2,18,21,0
OpenFile18=pm.c,0,100,80,890,527,63,336,63,0
OpenFile19=tasks_sys.c,0,242,242,1486,999,1,208,23,0
OpenFile20=OutputWindow
OpenFile17=config.h,0,374,323,1618,1080,15,18,22,0
OpenFile18=OutputWindow
OutputPos=0,360,1128,478,1503
ActivePRJ=yav_mcu_bsr.prj
[ProjectWindow]

View File

@ -11,7 +11,7 @@ T=4ae7c536
7=rtc.h
8=reboot.h
[pm.c]
T=4ae80b7d
T=4ae8dfa1
1=incs.h
2=adc.h
3=led.h
@ -20,7 +20,7 @@ T=4ae80b7d
T=4ae78e76
1=incs.h
[main.c]
T=4adee91e
T=4ae8dfa1
1=incs.h
2=WDT.h
3=rtc.h
@ -84,7 +84,7 @@ T=4ac96eb4
4=WDT.h
5=bsr_system.h
[tasks_sys.c]
T=4ae82f9a
T=4ae8e00c
1=incs.h
2=i2c_twl.h
3=i2c_ctr.h
@ -118,10 +118,10 @@ T=4aca8c17
[jhl_defs.h]
T=4ae647cd
[user_define.h]
T=4ae7c500
T=4ae8dfa1
1=config.h
[config.h]
T=4ae82e78
T=4ae8dd2a
[bsr_system.h]
T=4aca8c17
[renge\renge.h]