エージング結果をフィードバック。PEE(branches/CTR_SDK-3_2_5-PEE r45674付近)にコミット

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@445 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
n2232 2012-01-26 08:13:21 +00:00
parent 8aa11a947a
commit 1415d2864d
10 changed files with 54 additions and 80 deletions

View File

@ -4,7 +4,7 @@
I2Cの競合回避などがあるので
$Id$
$Id: accero.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
@ -135,8 +135,9 @@ task_status_immed tski_cbk_accero( )
iic_mcu_read( IIC_SLA_ACCEL, ( ACC_REG_X | ACC_REG_FLG_BURST_ACCESS ), ACC_RAW_DATA_SIZE, temp );
}
}
if(( system_status.pwr_state == ON )
||( system_status.pwr_state == SLEEP )
if( (( system_status.pwr_state == ON )
||( system_status.pwr_state == SLEEP ))
&&( ( vreg_ctr[VREG_C_ACC_CONFIG] & VREG_BITMASK_ACC_CONF_HOSU ) != 0 )
)
{
pedometer(); // 歩数計

View File

@ -2,7 +2,7 @@
SoC I2C通信
.nintendo
'09 Apr
$Id$
$Id: i2c_ctr.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
#pragma interrupt INTIICA1 int_iic_ctr RB1
@ -280,8 +280,8 @@ void IIC_ctr_Init( void )
WTIM = 1; // 自動でACKを返した後clkをLに固定する
ACKE = 1;
IICWH = 5;
IICWL = 10; // L期間の長さ
IICWH = 9;
IICWL = 11; // L期間の長さ
SMC = 1; // 高速モード
DFC = 1; // デジタルフィルタon (@fast mode)

View File

@ -17,6 +17,10 @@
#include "loader.h"
#include "util_funcs.h"
#include "i2c_mcu_sub.h"
// ========================================================
// レジスタのビット名
// プリフィックスbだが、一部のビット名がレジスタ名にかぶるため...
@ -54,12 +58,12 @@
// ========================================================
static void iic_mcu_send_st( );
static void iic_mcu_send_re_st( );
static void iic_mcu_send_sp( );
static i2c_err iic_mcu_send_a_byte( u8 );
static i2c_err iic_mcu_call_slave( u8 slave );
// *subからしか呼ばない
void iic_mcu_send_re_st( );
void iic_mcu_send_sp( );
i2c_err iic_mcu_send_a_byte( u8 );
i2c_err iic_mcu_call_slave( u8 slave );
// ========================================================
@ -475,7 +479,7 @@ __interrupt void int_iic10( )
 NACK   I2C_ERR_NOSLAVE
***********************************************/
static i2c_err iic_mcu_call_slave( u8 slave )
i2c_err iic_mcu_call_slave( u8 slave )
{
iic_mcu_send_st( );
@ -504,7 +508,7 @@ static i2c_err iic_mcu_call_slave( u8 slave )
***********************************************/
static i2c_err iic_mcu_send_a_byte( u8 dat )
i2c_err iic_mcu_send_a_byte( u8 dat )
{
IICMK10 = 1;
IICIF10 = 0;
@ -546,7 +550,7 @@ static void iic_mcu_send_st( )
/********************************************//**
***********************************************/
static void iic_mcu_send_re_st( )
void iic_mcu_send_re_st( )
{
ST0 |= 0x0004;
SO0 |= 0x0400 | TAUS_MASK; // ( SDA = H ), SCL -> H
@ -565,7 +569,7 @@ static void iic_mcu_send_re_st( )
***********************************************/
static void iic_mcu_send_sp( )
void iic_mcu_send_sp( )
{
ST0 = 0x0004;
SOE0 = 0; // 受信の時はもっと前に「も」設定してる。(NACK出力)
@ -645,44 +649,3 @@ void iic_mcu_stop( )
iic_mcu_initialized = false;
}
/********************************************//**
iic_mcu_write_a_byte CODEC不具合ワークアラウンド
***********************************************/
i2c_err iic_mcu_write_a_byte_codec( u8 adrs, u8 dat )
{
static u8 count;
// 文字の時はDMAとか起動しないでさっさと終わらせる
if( iic_mcu_wait_free() !=I2C_ERR_OK )
{
return( I2C_ERR_TIMEOUT );
}
// スタートコンディションとスレーブの呼び出し...
IICMK10 = 1;
if( iic_mcu_call_slave( IIC_SLA_CODEC ) != I2C_ERR_OK )
{
iic_mcu_busy = false;
return ( I2C_ERR_NOSLAVE );
}
iic_mcu_send_a_byte( adrs );
iic_mcu_send_a_byte( dat );
// ワークアラウンドここから
/// リスタートにしてダミーライト
iic_mcu_send_re_st( );
iic_mcu_send_a_byte( IIC_SLA_CODEC ); // ダミーライト
iic_mcu_send_a_byte( 0x20 ); // ゴミを書いても問題ないアドレス
iic_mcu_send_a_byte( count ); // 何でもよいのだが。メモリ足りなくなったら固定値に
count ++;
iic_mcu_send_sp( );
iic_mcu_busy = false;
return ( I2C_ERR_OK );
}

View File

@ -1,7 +1,7 @@
/* ========================================================
TWL I2C
$Id$
$Id: i2c_twl.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
@ -52,6 +52,7 @@
#define WTIM WTIM0
#define SMC SMC0
#define TRC TRC0
#define DFC DFC0
#endif // _MCU_BSR_
@ -213,10 +214,11 @@ void IIC_twl_Init( void )
WTIM = 1; // 自動でACKを返した後clkをLに固定する
ACKE = 1; // ダメCPUは無視して次の通信をはじめるかもしれないんで早くclkを開放しないといけない
IICWH = 5;
IICWL = 10; // L期間の長さ
IICWH = 9;
IICWL = 11; // L期間の長さ
SMC = 1;
DFC = 1; // デジタルフィルタon (@fast mode)
IICAMK = 0; // 割り込みを許可

View File

@ -1,6 +1,7 @@
/* ========================================================
LED.c
$Id$
$Id: LED.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32

View File

@ -6,7 +6,7 @@
$Id$
$Id: loader.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
@ -251,7 +251,7 @@ void hdwinit( void )
CMC = bits8(0,0,0,1, 0,0,0,0); /* X1発振せず(入力ポート)、XT1使用、超低電力発振は不安定に付き通常で */
CSC = bits8(1,0,0,0, 0,0,0,0); /* X1発振なし、XT1発振あり、高速内蔵発振動作 */
OSMC = bits8(1,0,0,0, 0,0,0,1); /* 隠しレジスタ */
OSMC = bits8(0,0,0,0, 0,0,0,1); /* 隠しレジスタ */
NOP();NOP();NOP(); // 3clk開ける
CKC = bits8(0,0,0,0, 1,0,0,0); /* CPU/周辺クロック=fMAIN、fMAIN=fMX、fCLK=fMX */

View File

@ -3,6 +3,8 @@
nintendo
'08 Dec
$Id: pm.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
@ -172,6 +174,7 @@ static void update_chg_led()
// レジスタの充電中ビットはLEDに同期する
set_bit( LED_CHARGE, vreg_ctr[VREG_C_STATUS], REG_BIT_BATT_CHARGE ); // set_bitのみ。
/// 割り込みはtask_status()で行う
}
@ -831,7 +834,7 @@ err PM_LCD_on( )
else
{
// CTR 時
wait_ms( DELAY_PM_TSS_50B_AND_TCOM );
wait_ms( DELAY_PM_TSS_50B_AND_TCOM );
}
PM_TCOM_on( );
@ -876,7 +879,6 @@ void PM_LCD_off()
}
// 50msとか待つし、確認しましょうかね…
if( read_pmic( PM_REG_ADRS_VDD_LCD ) != 0 )
{
@ -1264,9 +1266,9 @@ void codec_reg_init()
ROM節約のため
***********************************************/
err send_cmd_mgic_2B( u8 reg, u16 dat ) // 送信バッファ
err send_cmd_mgic_2B( u8 reg, u16 dat )
{
u16 temp = dat;
u16 temp = dat; // 送信バッファ
return iic_mcu_write( IIC_SLA_BT_GAUGE, reg, 2, &temp ); // DMA転送するので送信データバッファのポインタがどうせ必要
}

View File

@ -1,7 +1,8 @@
/* ========================================================
$Id$
$Id: task_misc.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
@ -355,15 +356,15 @@ static const u8 *infos_table[] = {
- 1)
- 2) PMIC
- 3)
- 4)
- 5)
- 6) ( rcomp & 0xFF )
- 7) raw_adc_temperature
- 8) ( !temp_zone_charge_disable | ( bt_authorized << 1 ) )
- 9) LEDはフルカラー
- 1)
- 2) PMIC
- 3)
- 4)
- 5)
- 6) ( rcomp & 0xFF )
- 7) raw_adc_temperature
- 8) ( !temp_zone_charge_disable | ( bt_authorized << 1 ) )
- 9) LEDはフルカラー
- 10) system_status.family
***********************************************/
u8 extinfo_read(void)

View File

@ -81,6 +81,7 @@ void tsk_status( )
else
{
set_irq( VREG_C_IRQ0, REG_BIT_SHELL_CLOSE );
}
}
}
}

View File

@ -423,6 +423,7 @@ void tsk_sys( )
system_status.poweron_reason = RSN_PWSW;
system_status.pwr_state = ON_CHECK;
#ifndef _TAIKENDAI_SEISAN_SPECIAL_
// 試遊台なら自動で電源再投入
if( system_status.taikendai )
{
@ -431,6 +432,7 @@ void tsk_sys( )
system_status.poweron_reason = RSN_TRIAL;
system_status.pwr_state = ON_CHECK;
}
#endif
}
else
{
@ -452,7 +454,7 @@ void tsk_sys( )
#ifdef _DBG_CHK_OFF_LEAK_
leak_check();
#endif
CKC = bits8(0,0,0,0, 1,0,0,1); // 4MHzに落としてからSTOPしなくてはならない
CKC = bits8(0,0,0,0, 1,0,0,1); // 4MHzに落として(bit0)からSTOPしなくてはならない
OSMC = bits8(0,0,0,0, 0,0,0,0); // 5MHz以下モードへ。
if( PM_EXTDC_n_RAW ) // きわどいタイミングで挿抜が起きることがある。HAL通さないべきoff中ですし
@ -466,11 +468,11 @@ void tsk_sys( )
// ・RTCアラーム現在封印
// クロック復帰
OSMC = bits8(1,0,0,0, 0,0,0,1); // 8MHz動作準備
OSMC = bits8(0,0,0,0, 0,0,0,1); // 8MHz動作準備
renge_flg_interval = 0;
hal_update();
CKC = bits8(0,0,0,0, 1,0,0,0); // FSEL = 1 後3clk以上開ける
CKC = bits8(0,0,0,0, 1,0,0,0); // OSMC.FSEL = 1 後3clk以上開ける
// 起きた理由は?
if( !PM_EXTDC_n ){
@ -495,11 +497,12 @@ void tsk_sys( )
RTCIMK = 0; // sys tick タイマー有効
#ifndef _TAIKENDAI_SEISAN_SPECIAL_
if( system_status.taikendai )
{
system_status.pwr_state = OFF_TRIG;
}
#endif
}
}
}