阅读:1199回复:0
请教AC97音频驱动问题
在AC97驱动程序中 DURAUDIO_Initialize (void)函数的作用是不是对南桥芯片的PCI枚举并初始化音频寄存器?
在这个函数中Device[DevIndex].ID;是指对PCI进行从1-32枚举时各个设备的ID号吗?能够直接调用的吗? PDURAUDIO DURAUDIO_Initialize (void) { PDURAUDIO pGeode; OS_DbgMsg("DURAUDIO_Initialize\n"); pGeode=(PDURAUDIO) OS_AllocateMemory(sizeof(DURAUDIO)); if (pGeode==NULL) { OS_DbgMsg("Could not allocate Memory for pGeode.\n"); return FALSE; } memset (pGeode, 0, sizeof(DURAUDIO)); if(!DURAUDIO_InitAudioRegs(pGeode)) { OS_DbgMsg("DURAUDIO_InitAudioRegs failure.\n"); return FALSE; } // // Setup Flags for input and output buffers // // v_nNextPage: Points to the next buffer to be filled with data. // v_fMoreData: Flag that signals if there is more data coming. // pGeode->AudioChannel[CHANNEL0_PLAYBACK].v_fMoreData = FALSE; pGeode->AudioChannel[CHANNEL1_RECORD].v_fMoreData = FALSE; pGeode->AudioChannel[CHANNEL0_PLAYBACK].fAllocated = FALSE; pGeode->AudioChannel[CHANNEL1_RECORD].fAllocated = FALSE; return pGeode; } unsigned long DURAUDIO_InitAudioRegs(PDURAUDIO pGeode) { unsigned long F3BAR0_Phys, config_data, pci_config_addr; unsigned short i, DevIndex, pci_cmd, NBIndex; // // PCI Audio/DMA init // // Go probe for PCI device reg spaces... // NOTE: This loop checks that the 5530 Bridge Header is found. // for(i=0;i<32;i++) { // // Iterate over all dev numbers in PCI Config addr reg. // pci_config_addr = 0x80000000 | (i<<11); //Function 0 // // Get Vendor_ID+dev_id reg (1st word in PCI Header). // OS_WritePortULong( PCI_CADDR, pci_config_addr ); config_data = OS_ReadPortULong( PCI_CDATA ); // // Check if the device is one of ours... // for (DevIndex=0; Device[DevIndex].ID; ++DevIndex) ///////////////////////////////////////Device[DevIndex].ID { if (Device[DevIndex].ID==config_data) goto Found_Device; } } // // Didn't find the Device ID. Return. // OS_DbgMsg("Cant find PCI Audio dev!\n"); return ( FALSE ); // // Found the device ID. Now initialize the device. // Found_Device:; OS_DbgMsg("Found Device: %s\n", Device[DevIndex].Name); pGeode->fCS5535 = Device[DevIndex].fCS5535; if (pGeode->fCS5535) { // // Get CPU Vendor_ID // OS_WritePortULong( PCI_CADDR, 0x80000800 ); config_data = OS_ReadPortULong( PCI_CDATA ); // // Check/display CPU name // for (NBIndex = 0; CPUInfo[NBIndex].VendorID; ++NBIndex) { if (CPUInfo[NBIndex].VendorID == config_data) goto Found_CPU_Info; } OS_DbgMsg("Can't find CPU information!\n"); return ( FALSE ); Found_CPU_Info:; OS_DbgMsg("Found CPU information: %s\n", CPUInfo[NBIndex].CPUName); } |
|