|
//那位高手帮忙解读一下该段代码
NTSTATUS CDeviceBoardIWI::SetToMode(ULONG Mode)
{
if(GetCurrentMode() == Mode) return STATUS_SUCCESS;
NTSTATUS Status = STATUS_SUCCESS;
switch(Mode) {
case MODE_DTv:
case MODE_Standby:
m_Device->EP_SetGPIORegister(3, 1);
m_Device->EP_SetGPIORegister(2, 1);
if(m_AudioADCType == AUDIO_WM8775) {
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x19, 0x02);
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x2a, 0x01);
}
else if(m_AudioADCType == AUDIO_WM8950) {
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x00, 0x00);
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x02, 0x1B);
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x04, 0x15);
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x09, 0x10);
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x0C, 0x09);
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x36, 0x80);
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x41, 0x38);
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x46, 0x0F);
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x58, 0x03);
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x5A, 0x10);
Status |= m_Device->EP_I2CWrite(0x01, 0x34, 0x5F, 0x00);
}
if(m_VideoDecoder) m_VideoDecoder->ModeSavePower();
break;
case MODE_Video:
m_Device->EP_SetGPIORegister(3, 1);
m_Device->EP_Sleep(500000);
if(m_VideoDecoder) Status |= m_VideoDecoder->ModePowerUp();
else Status = STATUS_INSUFFICIENT_RESOURCES;
if(!NT_SUCCESS (Status)) {
SetDeviceStatus(STATUS_Error);
return Status;
}
break;
}
CDeviceBoard::SetToMode(Mode);
m_Device->EP_ProgramWriteKey(g_RegProgram_AudioMonoToStereo, 1);
return Status;
}
|
|