From 195afa8add2a0f3b6058eb2d1d288bc47b799557 Mon Sep 17 00:00:00 2001 From: yutaka Date: Fri, 25 May 2007 09:30:19 +0000 Subject: [PATCH] add forgotten header files git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@88 4ee2a332-4b2b-5046-8439-1ba90f034370 --- include/nitro/os/common/system.h | 27 ++- include/twl/cdc.h | 2 +- include/twl/cdc/ARM7/cdc.h | 22 +-- include/twl/cdc/ARM7/cdc_dsmode_access.h | 212 +++++++++++++++++++++++ include/twl/i2c/ARM7/i2c.h | 1 + include/twl/snd/ARM7/i2s.h | 1 + 6 files changed, 245 insertions(+), 20 deletions(-) create mode 100644 include/twl/cdc/ARM7/cdc_dsmode_access.h diff --git a/include/nitro/os/common/system.h b/include/nitro/os/common/system.h index a66a4a8..d2a07d0 100644 --- a/include/nitro/os/common/system.h +++ b/include/nitro/os/common/system.h @@ -141,9 +141,9 @@ extern "C" { //---------------------------------------------------------------------------- #ifndef SDK_ASM -#define OS_EXIT_STRING_1 "*** Exit nitro program (status=" -#define OS_EXIT_STRING_2 "%d).\n" -#define OS_EXIT_STRING OS_EXIT_STRING_1 OS_EXIT_STRING_2 +#define OS_EXIT_STRING_1 "*** Exit nitro program (status=" +#define OS_EXIT_STRING_2 "%d).\n" +#define OS_EXIT_STRING OS_EXIT_STRING_1 OS_EXIT_STRING_2 typedef enum { @@ -276,7 +276,7 @@ extern OSProcMode OS_GetProcMode(void); Name: OS_Terminate Description: Halt CPU and loop - + Arguments: None Returns: None @@ -288,7 +288,7 @@ extern void OS_Terminate(void); Name: OS_Halt Description: Halt CPU - + Arguments: None Returns: None @@ -306,8 +306,8 @@ static inline void OS_Halt(void) Name: OS_Exit Description: Display exit string and Terminate. - This is useful for 'loadrun' tool command. - + This is useful for 'loadrun' tool command. + Arguments: status : exit status Returns: -- (Never return) @@ -328,6 +328,17 @@ extern void OS_Exit(int status); *---------------------------------------------------------------------------*/ extern void OS_SpinWait(u32 cycle); +/*---------------------------------------------------------------------------* + Name: OS_SpinWaitSysCycles + + Description: Spin and Wait for specified SYSTEM cycles at least + + Arguments: cycles waiting SYSTEM cycle + + Returns: None + *---------------------------------------------------------------------------*/ +extern void OS_SpinWaitSysCycles(u32 cycle); + /*---------------------------------------------------------------------------* Name: OS_WaitInterrupt @@ -360,7 +371,7 @@ extern void OS_WaitInterrupt(BOOL clear, OSIrqMask irqFlags); Name: OS_WaitVBlankIntr Description: wait till vblank interrupt occurred. - the difference between SVC_WaitVBlankIntr and OS_WaitVBlankIntr is: + the difference between SVC_WaitVBlankIntr and OS_WaitVBlankIntr is: OS_WaitVBlankIntr does switch thread, SVC_WaitVBlankIntr doesn't switch thread. diff --git a/include/twl/cdc.h b/include/twl/cdc.h index 8965256..dc6804a 100644 --- a/include/twl/cdc.h +++ b/include/twl/cdc.h @@ -21,7 +21,7 @@ #include #include #include -//#include +#include /* TWL_CDC_H_ */ #endif diff --git a/include/twl/cdc/ARM7/cdc.h b/include/twl/cdc/ARM7/cdc.h index ec595bd..0459ea4 100644 --- a/include/twl/cdc/ARM7/cdc.h +++ b/include/twl/cdc/ARM7/cdc.h @@ -22,11 +22,13 @@ #include #include - #ifdef __cplusplus extern "C" { #endif +extern void SPI_Lock(u32 id); +extern void SPI_Unlock(u32 id); + //================================================================ // CODEC status variables //================================================================ @@ -213,7 +215,6 @@ static inline void CDC_ReadI2cRegisters( u8 reg, u8 *bufp, size_t size ) I2C_ReadRegisters( I2C_SLAVE_CODEC_TP, reg, bufp, size ); } -#if 0 //================================================================================ // SPI BIT CONTROL //================================================================================ @@ -273,9 +274,9 @@ void CDC_ClearSpiFlags( u8 reg, u8 clrBits ); void CDCi_WriteSpiRegister( u8 reg, u8 data ); static inline void CDC_WriteSpiRegister( u8 reg, u8 data ) { - (void)spiLock(); + (void)SPI_Lock(123); CDCi_WriteSpiRegister( reg, data ); - (void)spiUnlock(); + (void)SPI_Unlock(123); } /*---------------------------------------------------------------------------* @@ -290,9 +291,9 @@ static inline void CDC_WriteSpiRegister( u8 reg, u8 data ) u8 CDCi_ReadSpiRegister( u8 reg ); static inline void CDC_ReadSpiRegister( u8 reg ) { - (void)spiLock(); + (void)SPI_Lock(123); CDCi_ReadSpiRegister( reg ); - (void)spiUnlock(); + (void)SPI_Unlock(123); } /*---------------------------------------------------------------------------* @@ -308,9 +309,9 @@ static inline void CDC_ReadSpiRegister( u8 reg ) void CDCi_WriteSpiRegisters( u8 reg, const u8 *bufp, size_t size ); static inline void CDC_WriteSpiRegisters( u8 reg, const u8 *bufp, size_t size ) { - (void)spiLock(); + (void)SPI_Lock(123); CDCi_WriteSpiRegisters( reg, bufp, size ); - (void)spiUnlock(); + (void)SPI_Unlock(123); } /*---------------------------------------------------------------------------* @@ -325,11 +326,10 @@ static inline void CDC_WriteSpiRegisters( u8 reg, const u8 *bufp, size_t size ) void CDCi_ReadSpiRegisters( u8 reg, u8 *bufp, size_t size ); static inline void CDC_ReadSpiRegisters( u8 reg, u8 *bufp, size_t size ) { - (void)spiLock(); + (void)SPI_Lock(123); CDCi_ReadSpiRegisters( reg, bufp, size ); - (void)spiUnlock(); + (void)SPI_Unlock(123); } -#endif //================================================================================ // Utility Functions diff --git a/include/twl/cdc/ARM7/cdc_dsmode_access.h b/include/twl/cdc/ARM7/cdc_dsmode_access.h new file mode 100644 index 0000000..4c510b3 --- /dev/null +++ b/include/twl/cdc/ARM7/cdc_dsmode_access.h @@ -0,0 +1,212 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - CDC - include - cdc + File: cdc_CDC_Dsmode_access.h + + Copyright 2006-2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#ifndef TWL_CDC_CDC_DSMODE_ACCESS_H_ +#define TWL_CDC_CDC_DSMODE_ACCESS_H_ + +#include +#include +#include +#include +//#include + + +#ifdef __cplusplus +extern "C" { +#endif + + +//================================================================ +// CODEC status variables +//================================================================ +extern SPIBaudRate cdcDsmodeSPIBaudRate; + + +//================================================================ +// BAUDRATE parameter +//================================================================ + +#define DSMODE_SPI_BAUDRATE_DEFAULT SPI_BAUDRATE_1MHZ + + +/*---------------------------------------------------------------------------* + Name: i_tpSetSPIBaudRate + + Description: set SPI baud rate. + + Arguments: baud rate. + + Returns: None. + *---------------------------------------------------------------------------*/ +static inline void CDCi_DsmodeSetSPIBaudRate( SPIBaudRate rate ) +{ + cdcDsmodeSPIBaudRate = rate; +} + +/*---------------------------------------------------------------------------* + Name: i_tpGetSPIBaudRate + + Description: get SPI baud rate. + + Arguments: None. + + Returns: baud rate. + *---------------------------------------------------------------------------*/ +static inline SPIBaudRate CDCi_DsmodeGetSPIBaudRate( void ) +{ + return cdcDsmodeSPIBaudRate; +} + +/*---------------------------------------------------------------------------* + Name: i_tpChangeSpiMode + + Description: change SPI mode.. + + Arguments: continuous : SPI_TRANSMODE_CONTINUOUS or SPI_TRANSMODE_1BYTE + + Returns: None. + *---------------------------------------------------------------------------*/ +static inline void CDCi_DsmodeChangeSpiMode( SPITransMode continuous ) +{ + reg_SPI_SPICNT = (u16)((1 << REG_SPI_SPICNT_E_SHIFT) | + (0 << REG_SPI_SPICNT_I_SHIFT) | + (SPI_COMMPARTNER_TP << REG_SPI_SPICNT_SEL_SHIFT) | + (continuous << REG_SPI_SPICNT_MODE_SHIFT) | + (CDCi_DsmodeGetSPIBaudRate() << REG_SPI_SPICNT_BAUDRATE_SHIFT)); +} + +//================================================================================ +// SPI BIT CONTROL +//================================================================================ +/*---------------------------------------------------------------------------* + Name: CDCi_DsmodeSetSpiParams + + Description: set control bit to device register + + Arguments: reg : device register + setBits : bits to set + maskBits : bits to mask + + Returns: None + *---------------------------------------------------------------------------*/ +void CDCi_DsmodeSetSpiParams( u8 reg, u8 setBits, u8 maskBits ); +void CDC_DsmodeSetSpiParams( u8 reg, u8 setBits, u8 maskBits ); + +/*---------------------------------------------------------------------------* + Name: CDC_DsmodeSetSpiFlags + + Description: set control bit to device register + + Arguments: reg : device register + setBits : bits to set + + Returns: None + *---------------------------------------------------------------------------*/ +void CDCi_DsmodeSetSpiFlags( u8 reg, u8 setBits ); +void CDC_DsmodeSetSpiFlags( u8 reg, u8 setBits ); + +/*---------------------------------------------------------------------------* + Name: CDC_DsmodeClearSpiFlags + + Description: clear control bit to device register + + Arguments: reg : device register + clrBits : bits to set + + Returns: None + *---------------------------------------------------------------------------*/ +void CDCi_DsmodeClearSpiFlags( u8 reg, u8 clrBits ); +void CDC_DsmodeClearSpiFlags( u8 reg, u8 clrBits ); + +//================================================================================ +// SPI ACCESS +//================================================================================ +/*---------------------------------------------------------------------------* + Name: CDCi_DsmodeWriteSpiRegister + + Description: set value to Touch-Panel register + + Arguments: reg : TP register + data : value to be written + + Returns: None + *---------------------------------------------------------------------------*/ +void CDCi_DsmodeWriteSpiRegister( u8 reg, u8 data ); +static inline void CDC_DsmodeWriteSpiRegister( u8 reg, u8 data ) +{ + (void)SPI_Lock(123); + CDCi_DsmodeWriteSpiRegister( reg, data ); + (void)SPI_Unlock(123); +} + +/*---------------------------------------------------------------------------* + Name: CDC_DsmodeReadSpiRegister + + Description: get value from Touch-Panel register + + Arguments: reg : TP register + + Returns: value which is read from specified TP register + *---------------------------------------------------------------------------*/ +u8 CDCi_DsmodeReadSpiRegister( u8 reg ); +static inline void CDC_DsmodeReadSpiRegister( u8 reg ) +{ + (void)SPI_Lock(123); + CDCi_DsmodeReadSpiRegister( reg ); + (void)SPI_Unlock(123); +} + +/*---------------------------------------------------------------------------* + Name: CDC_DsmodeWriteSpiRegisters + + Description: set value to decive registers through SPI. + + Arguments: reg : decive register + data : value to be written + + Returns: None + *---------------------------------------------------------------------------*/ +void CDCi_DsmodeWriteSpiRegisters( u8 reg, const u8 *bufp, size_t size ); +static inline void CDC_DsmodeWriteSpiRegisters( u8 reg, const u8 *bufp, size_t size ) +{ + (void)SPI_Lock(123); + CDCi_DsmodeWriteSpiRegisters( reg, bufp, size ); + (void)SPI_Unlock(123); +} + +/*---------------------------------------------------------------------------* + Name: CDC_DsmodeReadSpiRegisters + + Description: get value from decive registers through SPI. + + Arguments: reg : decive register + + Returns: value which is read from specified decive register + *---------------------------------------------------------------------------*/ +void CDCi_DsmodeReadSpiRegisters( u8 reg, u8 *bufp, size_t size ); +static inline void CDC_DsmodeReadSpiRegisters( u8 reg, u8 *bufp, size_t size ) +{ + (void)SPI_Lock(123); + CDC_DsmodeReadSpiRegisters( reg, bufp, size ); + (void)SPI_Unlock(123); +} + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* TWL_CDC_CDC_DSMODE_ACCESS_H_ */ +#endif diff --git a/include/twl/i2c/ARM7/i2c.h b/include/twl/i2c/ARM7/i2c.h index 773ecfd..5fafb08 100644 --- a/include/twl/i2c/ARM7/i2c.h +++ b/include/twl/i2c/ARM7/i2c.h @@ -21,6 +21,7 @@ extern "C" { #endif +#include #include #include diff --git a/include/twl/snd/ARM7/i2s.h b/include/twl/snd/ARM7/i2s.h index a08e578..cb281f8 100644 --- a/include/twl/snd/ARM7/i2s.h +++ b/include/twl/snd/ARM7/i2s.h @@ -47,6 +47,7 @@ void SND_I2SEndSleep(void); void SND_I2SMute(BOOL isMute); void SND_I2SSetMixingRatio(int nitroRatio); +void SND_I2SSetSamplingRatio(BOOL is47kHz); #endif /* SDK_ARM7 */