/********************************************************************************************* * name: Init1341 * func: Init philips 1341 chip * para: none * ret: none * modify: * comment: *********************************************************************************************/ void Init1341() { /* Port Initialize */ rPCONA = 0x1ff; // PA9(out):L3D rPCONB = 0x7CF; // PG5:L3M, PG4:L3C rPDATB = L3M|L3C; // L3M=H(start condition),L3C=H(start condition) /* L3 Interface */ _WrL3Addr(0x14+2); // status (000101xx+10) #ifdef FS441KHZ _WrL3Data(0x60,0); // 0,1,10,000,0 reset,256fs,no DCfilter,iis #else _WrL3Data(0x40,0); // 0,1,00,000,0 reset,512fs,no DCfilter,iis #endif _WrL3Addr(0x14+2); // status (000101xx+10) #ifdef FS441KHZ _WrL3Data(0x20,0); // 0,0,10,000,0 no reset,256fs,no DCfilter,iis #else _WrL3Data(0x00,0); // 0,0,00,000,0 no reset,512fs,no DCfilter,iis #endif _WrL3Addr(0x14+2); // status (000101xx+10) _WrL3Data(0x81,0); // 1,0,0,0,0,0,11 OGS=0,IGS=0,ADC_NI,DAC_NI,sngl speed,AonDon _WrL3Addr(0x14+0); // DATA0 (000101xx+00) _WrL3Data(0x0A,0); }
/* This routine initializes the i/o port used for L3-bus and then configures the UDA1330 */ static void Init1330( int SC384 ) { /****** I/O Port E Initialize ******/ /* port reconfiguration : PORTE 9,10,11 --> output pull-up disable L3_MODE, L3_CLK High */ if (SC384) SC384=1; rPEDAT = (rPEDAT & ~0xe00) | (L3M|L3C); rPEUP |= 0xe00; rPECON = (rPECON & (~(0x3f << 18))) | (0x15<<18); /****** send commands via L3 Interface Data bits 7 to 2 represent a 6-bit device address where bit 7 is the MSB. The address of the UDA1330ATS is 000101 (bit 7 to bit 2). ******/ /* status type transfer , data value - clock=512fs, MSB format */ _WrL3Addr(0x14+2); //STATUS (0) (000101xx+10) _WrL3Data( ((2-SC384)<<4)+ // 00, : 512,384,256fs (SC : System Clock Freq) (0<<1) // 000, : iis,lsb16,lsb18,lsb20,msb ,0); /* data type transfer , data value - full volume */ _WrL3Addr(0x14 + 0); /* DATA0 (000101xx+00) */ _WrL3Data(0x0 /* volume */ ,0); /* data type transfer , data value - de-emphasis, no muting */ _WrL3Addr(0x14 + 0); /* DATA0 (000101xx+00) */ _WrL3Data(0x80+ /* select de-emhasis/mute */ (2<<3) /* de-emp 44khz */ ,1); }