一応ビルドはできるようになった。

レジスタを全部変数に宣言してあるだけ
ペリフェラルのレジスタ操作も正しくない
K0Rでもビルドできた。(正しいかは未検証)

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@484 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
n2232 2012-10-29 04:35:35 +00:00
parent 53eb60f4a2
commit a44e696248
36 changed files with 203 additions and 172 deletions

View File

@ -6,7 +6,7 @@
$Id: accero.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma SFR
#pragma NOP
@ -19,7 +19,7 @@
#endif
#ifndef _WIN32
#ifdef _78K0R
#pragma interrupt INTP23 intp23_ACC_ready RB3 // 加速度センサ、データ準備完了
@ -30,7 +30,7 @@
#include "i2c_mcu.h"
#ifndef _WIN32
#ifdef _78K0R
#include <math.h>
#endif
// ========================================================

View File

@ -24,7 +24,7 @@ const bt_param_ bt_param[ _BT_PARAM_NUM_ ] =
0x1C, 0x60, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00
},
2, // 2 = 19 bit mode
{ 92, (u8)(-256* 0.79), (u8)(-256* 4.35) }, //  (u8)誤キャストの誤パラメータのままの方が
{ 92, /*(u8)*/(-256* 0.79), /*(u8)*/(-256* 4.35) }, //  (u8)誤キャストの誤パラメータのままの方が
0xD800, // システムとしては良好な動作
{ 0xEA, 0xE8 }
},
@ -42,7 +42,7 @@ const bt_param_ bt_param[ _BT_PARAM_NUM_ ] =
0x07, 0x00, 0x09, 0x30, 0x01, 0xC0, 0x01, 0xC0
},
1,
{ 171, (u8)(-256* 1.00), (u8)(-256* 2.60) }, //  (u8)誤キャストの誤パラメータのままの方が
{ 171, /*(u8)*/(-256* 1.00), /*(u8)*/(-256* 2.60) }, //  (u8)誤キャストの誤パラメータのままの方が
0xDA20, // システムとしては良好な動作
{ 0x69, 0x67 },
},

View File

@ -94,7 +94,7 @@
/* FLMD0 control bit */
#ifndef _WIN32
#ifdef _78K0R
#define FSL_FLMD0_HIGH {BECTL.7 = 1;}
#define FSL_FLMD0_LOW {BECTL.7 = 0;}
#else

View File

@ -3,7 +3,7 @@
$Id: asdf$
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma SFR
#endif

View File

@ -1,6 +1,10 @@
#ifndef _hal_h_
#define _hal_h_
#ifndef _78K0R
//#define bit bool
#define bit unsigned char
#endif
extern bit PM_EXTDC_n;
extern bit BT_IN_CHG_n;
@ -9,6 +13,7 @@ extern bit SW_HOME_n;
extern bit SW_WIFI_n;
extern bit SHELL_OPEN;
// ========================================================
void hal_update();
void hal_reset();

View File

@ -4,7 +4,7 @@
'09 Apr
$Id: i2c_ctr.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma interrupt INTIICA1 int_iic_ctr RB1
#endif
@ -46,7 +46,6 @@
#define TRC TRC1
#define SMC SMC1
#define DFC DFC1
#define IICS IICS1
#define PortMode PM20
#define Port P20

View File

@ -4,7 +4,7 @@
'09 Feb -
$Id$
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma sfr
#pragma di
#pragma ei

View File

@ -4,7 +4,7 @@
'09 Feb -
$Id$
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma sfr
#pragma di
#pragma ei

View File

@ -3,15 +3,13 @@
$Id: i2c_twl.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
# pragma sfr /* 特殊機能レジスタ使用 */
#endif
/*============================================================================*/
#ifndef _WIN32
#ifdef _78K0R
# pragma interrupt INTIICA0 int_iic_twl RB2
#endif

View File

@ -1,4 +1,5 @@
#ifndef _WIN32
#ifdef _78K0R
#pragma SFR
#pragma di
#pragma ei
@ -7,7 +8,7 @@
#pragma halt
#endif
#ifndef _WIN32
#ifdef _78K0R
#pragma section @@CODE ROM_CODE
//#pragma section @@CNST ROM_CNST
#endif
@ -17,6 +18,9 @@
# include "sim/simOnWin.h"
#endif
#ifdef _IAR
# include "sim/simOnWin.h"
#endif
//=========================================================

View File

@ -5,7 +5,7 @@
$Id: asdf$
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma SFR
#pragma di
#pragma ei
@ -13,7 +13,6 @@
#pragma stop
#pragma halt
#pragma section @@CODE LDR_CODE
#pragma section @@CODEL LDR_CODL
@ -28,6 +27,9 @@
#include "sim/simOnWin.h"
# endif
#ifdef _IAR
# include "sim/simOnWin.h"
#endif
//=========================================================
#include "jhl_defs.h"

View File

@ -3,7 +3,7 @@
$Id$
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma nop
@ -11,7 +11,7 @@
#include "config.h"
#ifndef _WIN32
#ifdef _78K0R
# ifdef _WDT_CHECK_
# pragma interrupt INTWDTI fn_intwdti // wdt debug

View File

@ -3,10 +3,8 @@
$Id: LED.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
# pragma sfr
#endif
#include "incs.h"

View File

@ -17,7 +17,7 @@
#define LED_duty_notify_blu TDR02
// これらはduty変えられません
#ifndef _WIN32
#ifdef _78K0R
#define LED_pow_red P4.2
#define LED_CAM P7.5
#else

View File

@ -5,12 +5,10 @@
OFFBLINK OFFが無視されます
$Id$
$Id: asdf$
*********************************************************/
#ifndef _WIN32
#ifdef _78K0R
# pragma sfr
#endif
#include "incs.h"

View File

@ -24,10 +24,8 @@ enum LED_ILUM_MODE{
LED_POW_ILM_CEOFF
};
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
# pragma sfr
#endif
#include "incs.h"

View File

@ -8,7 +8,7 @@
$Id: loader.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma SFR
#pragma di
@ -21,7 +21,10 @@
#endif
#include "incs_loader.h"
#ifdef _78K0R
#include <fsl.h>
#endif
#include "fsl_user.h"
#include "i2c_ctr.h"
@ -121,7 +124,7 @@ void main( )
//*/
hdwinit2( );
#ifndef _WIN32
#ifdef _78K0R
// ファームの整合性チェック //
chk_firm_broke(); // 壊れていたら帰ってこない
#endif
@ -198,7 +201,7 @@ static void chk_firm_broke()
void chk_platform_type()
{
// ●CTRファミリ //
system_status.family = (enum family_)( DEV_DET >> 1 ); /// あぁ...
//iar! system_status.family = (enum family_)( DEV_DET >> 1 ); /// あぁ...
#ifdef _DBG_FORCE_SNAKE_
system_status.family = FAMILY_SNAKE;
#endif

View File

@ -10,7 +10,7 @@
#include "magic.h"
#include "config.h"
#ifndef _WIN32
#ifdef _78K0R
#pragma section @@CNSTL MGC_LOAD AT 0x0FF6
__far const unsigned char MGC_LOADd[] = __TIME__;

View File

@ -6,7 +6,7 @@
$Id$
********************************************************* */
#ifndef _WIN32
#ifdef _78K0R
#pragma mul
#pragma div
@ -16,7 +16,7 @@
#include "incs.h"
#ifndef _WIN32
#ifdef _78K0R
#include <math.h>
#endif

View File

@ -6,10 +6,8 @@
$Id: pm.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
# pragma nop
#endif
#include "incs.h"
@ -20,7 +18,10 @@
#include "batt_params.h"
#ifdef _78K0R
# include <fsl.h>
#endif
#include "fsl_user.h"
#include "vreg_twl.h"
@ -1337,7 +1338,7 @@ void bt_param_select()
{
bt_type_temp += BT_PARAM_SNAKE_MAXELL;
}
p_bt_param = &bt_param[ bt_type_temp ];
// iar! p_bt_param = &bt_param[ bt_type_temp ];
}

View File

@ -24,10 +24,10 @@
//=========================================================
#ifdef _WIN32
#define LED_CHARGE mcuRegP[ _P2_4 ]
#else
#ifdef _78K0R
#define LED_CHARGE P2.4
#else
#define LED_CHARGE mcuRegP[ _P2_4 ]
#endif

View File

@ -5,10 +5,9 @@
$Id$
**********************************************************/
#pragma SFR
#include "incs_loader.h"
#ifdef _78K0R
void my_reboot(){
#asm
@ -21,3 +20,10 @@ void my_reboot(){
#endasm
}
#endif
#ifdef _IAR
void my_reboot(){
}
#endif

View File

@ -1,4 +1,4 @@
#ifndef _WIN32
#ifdef _78K0R
#pragma section @@CODE ROM_CODE
#pragma nop
@ -9,6 +9,11 @@
#endif
#ifdef _IAR
typedef unsigned char bit;
typedef unsigned char u8;
#endif
#ifdef _WIN32
typedef unsigned char bit;
typedef unsigned char u8;
@ -29,9 +34,15 @@ typedef unsigned char u8;
#include "..\util_funcs.h"
#ifdef _IAR
#include "../sim/simOnWin.h"
#endif
#ifdef _WIN32
#include "../sim/simOnWin.h"
#endif
//#define _renge_test_
#define true 1
@ -218,7 +229,7 @@ __callt err renge_task_immed_run(){
rv = tasks_immed[ list_id ](); // タスク実行
if( rv == ERR_SUCCESS )
{
tasks_immed[ list_id ] = TSK_IMM_DELETED_;
// iar! tasks_immed[ list_id ] = TSK_IMM_DELETED_;
}
// きわどいタイミングで同じタスクの登録があると困るのでDI状態でかえって来る事がある
}

View File

@ -12,11 +12,21 @@
******************************************************************************/
#ifdef _78K0R
typedef unsigned char u8;
typedef signed char s8;
typedef unsigned short u16;
typedef signed short s16;
#else
#define __callt
#endif
// ************************************
#define SYS_INTERVAL_TICK 1.953

View File

@ -17,8 +17,8 @@ extern task_status_immed tski_vol_update();
// *************************************
#define TSK_IMM_EMPTY_ ( void * )( 0x0000 )
#define TSK_IMM_DELETED_ ( void * )( 0x0001 )
#define TSK_IMM_EMPTY_ ( task_status_immed )( 0x0000 )
#define TSK_IMM_DELETED_ ( task_status_immed(*)() )( 0x0001 )

View File

@ -21,7 +21,7 @@ extern void tsk_misc();
extern void tsk_status();
extern void tsk_sys();
const void ( *tasks[ TSK_LAST ] )() = {
/*const*/ void ( *tasks[ TSK_LAST ] )() = {
tsk_sw,
tsk_adc,
tsk_batt,

View File

@ -2,11 +2,9 @@
RTC
$Id$
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
# pragma sfr
# pragma inline
#endif
#include "incs.h"

View File

@ -1,8 +1,8 @@
/* ========================================================
$Id$
$Id: qqqqq$
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma SFR
#pragma di
@ -74,7 +74,7 @@ const u8 fsl_low_voltage_u08 = 1;
#define WTIM WTIM1
#endif
#ifndef _WIN32
#ifdef _78K0R
#define LED_POW1 P4.2
#define LED_PM_POW1 PM4.2
#else

View File

@ -7,7 +7,7 @@
$Id$
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma SFR
#pragma NOP

View File

@ -2,7 +2,7 @@
$Id$
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma SFR
#pragma NOP

View File

@ -5,7 +5,7 @@
$Id: task_misc.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma SFR
#pragma NOP

View File

@ -4,7 +4,7 @@
$Id$
********************************************************* */
#ifndef _WIN32
#ifdef _78K0R
#pragma SFR
#pragma NOP

View File

@ -4,7 +4,7 @@
$Id$
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma SFR
#pragma NOP
@ -338,7 +338,7 @@ void tsk_sys( )
LED_stop( );
IIC_ctr_Stop( );
IIC_twl_Stop( );
RTC_32k_off();
//iar! RTC_32k_off();
// 電源オン条件の割り込みセット
// PWSW KR3 押すとL

View File

@ -10,7 +10,7 @@
#define bits8(a,b,c,d,e,f,g,h) ( a<<7 | b<<6 | c<<5 | d<<4 | e<<3 | f<<2 | g<<1 | h )
#ifndef _WIN32
#ifdef _78K0R
// ŽÀ‹@ŠÂ‹«
#ifdef _debug_led_

View File

@ -3,9 +3,9 @@
$Id$
$Id: asdf$
======================================================== */
#ifndef _WIN32
#ifdef _78K0R
#pragma SFR
#pragma di

View File

@ -96,8 +96,8 @@ void vreg_ctr_reset( )
vreg_ctr[ VREG_C_WIFI_CALIB ] = 0;
// ここでやるのは気持ち悪いが…
RTC_32k_on();
RESET1_neg;
//iar! RTC_32k_on();
//iar! RESET1_neg;
RESET2_neg;
FCRAM_RST_neg;
}
@ -325,14 +325,14 @@ void vreg_ctr_write( u8 adrs, u8 data )
case VREG_C_WIFI_CALIB:
if( data & REG_BIT_WIFI_CALIB_32K_HI_Z )
{
RTC_32k_HI_Z();
//iar! RTC_32k_HI_Z();
}
else{
RTC_32k_on();
//iar! RTC_32k_on();
}
if( data & REG_BIT_WIFI_CALIB_RSTS_AST )
{
RESET1_ast;
//iar! RESET1_ast;
// RESET2_ast; RESET1のみ。
// FCRAM_RST_ast;
}