📄 mmedev.c
字号:
void OpenMic(void) //set the bit VULON to one -----Power Up
{
//glowing,2004-05-17, use the new SPI module
//spi_abb_write(2,0x0e,0x1c6 );////reset Micphone set //wms set VBUR to 1c6 04-14
//spi_abb_read(1,0x0008,CBOpenMic);
spi_abb_write( PAGE1, VBUCTRL, 0X1c6 );
spi_abb_read(PAGE0,TOGBR1,CBOpenMic );
return ;
}
void CBCloseMic(UINT16* value){
UINT16 status;
status=(*value)&0xFFFC;
status=status|0x0001;
//glowing,2004-05-17, use the new SPI module
//spi_abb_write(1,0x0008,status);
spi_abb_write(PAGE0, TOGBR1, status );
return ;
}
void CloseMic(void) //zym://set the bit VULON to zero -------Power Down ///zym 030110 use callback fuction 1
{
spi_abb_write(2,0x0e,0x310 ); ///Mute Microphone Mute sidetone
spi_abb_read(1,0x0008,CBCloseMic);
return ;
}
void mic_off_cb(int status)
{
status&=0xfffc;
status|=0x0001;
spi_abb_write(1,8,status);
}
void Mic_off()
{
//spi_abb_read(1,8,mic_ff_cb);
int status;
//glowing,2004-05-17 use the new SPI module
//status=ABB_Read_Register_on_page(1,8);
status=ABB_Read_Register_on_page(PAGE0, TOGBR1);
status&=0xfffc;
status|=0x0001;
//glowing,2004-05-17, use the new SPI module
//spi_abb_write(1,8,status);
spi_abb_write(PAGE0, TOGBR1, status );
}
void mic_on_cb(int status)
{
status&=0xfffc;
status|=0x0002;
//glowing,2004-05-17, use the new SPI module
//spi_abb_write(1,8,status);
spi_abb_write(PAGE0, TOGBR1, status);
}
void Mic_on()
{
//glowing,2004-05-17, use the new SPI module
//spi_abb_read(1,8,mic_on_cb);
spi_abb_read(PAGE0, TOGBR1, mic_on_cb);
}
void spk_off_cb(int status)
{
status&=0xfff3;
status|=0x0004;
//glowing,2004-05-17, use the new SPI module
// spi_abb_write(1,8,status);
spi_abb_write( PAGE0, TOGBR1, status );
}
void Spk_off()
{
//glowing, 2004-05-17, use the new SPI module
//spi_abb_read(1,8,spk_off_cb);
spi_abb_read( PAGE0, TOGBR1, spk_off_cb );
}
void spk_on_cb(int status)
{
status&=0xfff3;
status|=0x0008;
//glowing,2004-05-17, use the new SPI module
//spi_abb_write(1,8,status);
spi_abb_write(PAGE0, TOGBR1, status);
}
void Spk_on()
{
//glowing,2004-05-17, use the new SPI module
//spi_abb_read(1,8,spk_on_cb);
spi_abb_read(PAGE0, TOGBR1, spk_on_cb);
}
void red_status_cb(USHORT status)
{
status=status&0x0001;
status_fortest=status;
// return status_fortest;
}
int Red_Status()
{
status_fortest=0;
//spi_abb_read(2,48,red_status_cb);
//glowing,2004-05-17, use the new SPI module
//status_fortest=SPIRead_ABB_Register(2,48);
status_fortest=ABB_Read_Register_on_page(PAGE1, AUXLED);
status_fortest&=0x0001;
return status_fortest;
}
int Green_Status()
{
USHORT status;
*((volatile UINT16 *)(0xfffef00a))|=0x0200;
*((volatile UINT16 *)(0xfffe4804))&=0xdfff;
if(((*((volatile UINT16 *)(0xfffe4802)))&0x2000)==0x2000)
return 1;
else
return 0;
}
void speaker_status_cb(USHORT status)
{
status&=0x0003;
status_fortest=status;
}
int speaker_status()
{
status_fortest=0;
//glowing,2004-05-17, use the new SPI module
//spi_abb_read(2,18,speaker_status_cb);
status_fortest=ABB_Read_Register_on_page(PAGE1,PWDNRG);
status_fortest&=0x0002;
//return status_fortest;
if(status_fortest)
return 1;
else
return 0;
}
int Mic_status()
{
status_fortest=0;
//glowing,2004-05-17, use the new SPI module
//spi_abb_read(2,18,speaker_status_cb);
status_fortest=ABB_Read_Register_on_page(PAGE1, PWDNRG);
status_fortest&=0x0001;
if(status_fortest)
return 1;
else
return 0;
}
#define GPIO_VIBRATOR 5
void Vibrator_on()
{
#if( MODEL == 6 ) //GTMobile M288G!
AI_SETBIT(GPIO_VIBRATOR);
#endif
}
void Vibrator_off()
{
#if(MODEL == 6 )
AI_RESETBIT(GPIO_VIBRATOR );
#endif
}
int Vibrator_Status()
{
//SET_BIT(io_conf_reg_g,2);
*((volatile UINT16 *)(0xfffef00a))|=0x0004;
//RESET_BIT(io_cntl_reg_g,6);
*((volatile UINT16 *)(0xfffe4804))&=0x0040;
//SET_BIT(armio_latch_out_g,6);
//vib_playing = 1;
//vibra_status = VIBRA_BUSY;
if(((*((volatile UINT16 *)(0xfffe4802)))&0x0040)==0x0040)
return 1;
else
return 0;
}
/*void Backlight_Status_cb(USHORT status)
{
status=status&0x02;
status_fortest=status;
}
*/
int Backlight_Status()
{
status_fortest=0;
//glowing,2004-05-17, use the new SPI module
//spi_abb_read(spi_abb_read(2,48,Backlight_Status_cb));//PAGE1,ACDLED
status_fortest=ABB_Read_Register_on_page( PAGE1, AUXLED );
status_fortest&=0x02;
if(status_fortest)
return 1;
else
return 0;
}
int LCD_Status()
{
//if((*((volatile UINT16*) GPIO_OUT) & 0x0100)==0x0100)
if((*((volatile UINT16*) ARMIO_OUT) & 0x0100)==0x0100)
return 1;
else
return 0;
}
//Voice baseband control register'status
int VBCR_status()
{
status_fortest=0;
//glowing, 2004-05-17, use the new SPI module
//spi_abb_read(2,18,speaker_status_cb);
status_fortest=ABB_Read_Register_on_page(PAGE1, VBCTRL1 );//page=1,offset=8
//status_fortest&=0x0001;
return status_fortest;
}
//Voice baseband control register2'status
int VBCR2_status()
{
status_fortest=0;
//glowing, 2004-05-17, use the new SPI module
//spi_abb_read(2,18,speaker_status_cb);
status_fortest=ABB_Read_Register_on_page(PAGE1, VBCTRL2);//page=1,offset=11
//status_fortest&=0x0001;
return status_fortest;
}
//Voice baseband uplink register'status
int VBUR_status()
{
status_fortest=0;
//glowing,2004-05-17, use the new SPI module
//spi_abb_read(2,18,speaker_status_cb);
status_fortest=ABB_Read_Register_on_page(PAGE1, VBUCTRL);//page=1,offset=7
//status_fortest&=0x0001;
return status_fortest;
}
//Voice baseband downlink register'status
int VBDR_status()
{
status_fortest=0;
//glowing, 2004-05-17, use the new SPI module
//spi_abb_read(2,18,speaker_status_cb);
status_fortest=ABB_Read_Register_on_page( PAGE1, VBDCTRL);//page=0,offset=6
//status_fortest&=0x0001;
return status_fortest;
}
int PWDNRG_status( )
{
status_fortest=0;
status_fortest=ABB_Read_Register_on_page( PAGE1, PWDNRG);
return status_fortest;
}
unsigned short IsPcsyncRemove(void)
{
if ( (*((volatile unsigned short *)MEM_ARMIO ) & 0x0400)==1 &&(g_pcsyncstatus == 1))
{
return 1;
} else
return 0;
}
void Audio_Loop_Test()
{
volatile unsigned short status;
int i;
for(i=0;i<100;i++)
{
//glowing,2004-06-17,use the new spi api
#if 0
// SPI_WriteTX_MSB(0x0A << 6 |TOGBR1); // Initialize transmit register. This transmission
// SPI_StartWrite(); // enables selected OMEGA modules
SPI_WRITE_TX_MSB(0x0A << 6 |TOGBR1); // Initialize transmit register. This transmission
SPI_START_WRITE // enables selected OMEGA modules
while(((status = Spi->SPI_CTRL_STAT_UN.SPI_CTRL_STAT_ST.SPI_REG_STATUS) & WE_ST) == 0);
#else
ABB_Write_Register_on_page( PAGE0, TOGBR1, 0x0A );
#endif
rvf_delay( RVF_MS_TO_TICKS(50 ) ) ;
ABB_UlMute(0);
ABB_DlMute(0);
ABB_DlVolume(255);
ABB_SideTone(255);
}
return;
}
void Audio_Loop_Test_pctm_start()
{
volatile unsigned short status;
int i;
for(i=0;i<100;i++)
{
//glowing,2004-06-17,use the new spi api
#if 0
//SPI_WriteTX_MSB(0x0A << 6 |TOGBR1); // Initialize transmit register. This transmission
//SPI_StartWrite(); // enables selected OMEGA modules
SPI_WRITE_TX_MSB(0x0A << 6 |TOGBR1); // Initialize transmit register. This transmission
SPI_START_WRITE(); // enables selected OMEGA modules
while(((status = Spi->SPI_CTRL_STAT_UN.SPI_CTRL_STAT_ST.SPI_REG_STATUS) & WE_ST) == 0);
#else
ABB_Write_Register_on_page( PAGE0, TOGBR1, 0x0A );
#endif
//rvf_delay( RVF_MS_TO_TICKS(50 ) ) ;
ABB_UlMute(0);
ABB_DlMute(0);
ABB_DlVolume(255);
ABB_SideTone(255);
}
return;
}
void Audio_Loop_Test_pctm_stop()
{
volatile unsigned short status;
//glowing,2004-06-17, use the new spi api
#if 0
// SPI_WriteTX_MSB(0x5 << 6 |TOGBR1); // Initialize transmit register. This transmission
// SPI_StartWrite(); // enables selected OMEGA modules
while(((status = Spi->SPI_CTRL_STAT_UN.SPI_CTRL_STAT_ST.SPI_REG_STATUS) & WE_ST) == 0);
#else
ABB_Write_Register_on_page( PAGE0, TOGBR1, 0x05 );
#endif
return;
}
void Speaker_Vibrator_Test_Start()
{
SetMVol_DownLinkPGA(6);
StartPlayingMelody2(5, 0); //glowing,2003-12-23, use the yamaha api
StartVibrator();
}
void Speaker_Vibrator_Test_Stop()
{
StopPlayingMelody2(); //glowing,2003-12-23, use the yamaha api
StopVibrator();
}
typedef enum /* %CPI parameter <msg> */
{
CPI_MSG_NotPresent = -1,
CPI_MSG_Setup,
CPI_MSG_Disc,
CPI_MSG_Alert,
CPI_MSG_Proc,
CPI_MSG_Sync,
CPI_MSG_Progr,
CPI_MSG_Conn
}
T_ACI_CPI_MSG;
void fixTone(UINT8 type, UINT8 ibt)
{
if(type == CPI_MSG_Alert && ibt)
{
vocoder_mute_ul(FALSE);
vocoder_mute_dl(FALSE);
}
}
/* Robert.Chen added, 2004-06-08 */
void getVolSetting(UINT8* amp)
{
UINT8 i;
UINT16 vbdctrl;
/* NOTE: to get correct result, this table must match to the SetASpk_DownLinkPGA() func's methonology */
UINT8 value2lel[7] = {72/*-16*/, 6/*-12*/, 10/*-8*/, 34/*-4*/, 38/*0*/, 41/*3*/, 43/*5*/};
#ifndef _INNOVATION_EMULATOR_
status_fortest=ABB_Read_Register_on_page(PAGE0, VBDCTRL);//page=1,offset=11
#endif
vbdctrl = (UBYTE)(vbdctrl & 0x7f);
for(i = 0; i < 7; i ++)
{
if(value2lel[i] == (UINT8)vbdctrl)
break;
}
if(i < 7)
*amp = i;
else
*amp = 1; /* default */
}
/* add end */
unsigned short Set_MainboardType(unsigned short mainboard_type)
{
/* 2004/06/08, zhq, add for production test purpose.
0 indicate 188 serial of mainboard.
1 indicate 288 serial of mainboard.
2 indicate 388 serial of mainboard.
3 indicate 588 serial of mainboard.
etc.
*/
return Set_MainboardType_MMI(mainboard_type);
}
unsigned short Get_MainboardType(unsigned short* mainboard_type)
{
/* 2004/06/08, zhq, add for production test purpose.
0 indicate 188 serial of mainboard.
1 indicate 288 serial of mainboard.
2 indicate 388 serial of mainboard.
3 indicate 588 serial of mainboard.
etc.
*/
return Get_MainboardType_MMI(mainboard_type);
}
unsigned short Set_Encrypt_Key(unsigned short encrypt_key)
{
return Set_Encrypt_Key_MMI(encrypt_key);
}
unsigned short Get_Encrypt_Key(unsigned short* encrypt_key)
{
return Get_Encrypt_Key_MMI(encrypt_key);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -