//////////////////////////////////////////////////////////// /// Initialize the application //////////////////////////////////////////////////////////// bool ApplicationInitialize() { // Initialize mutex MutexInitialize(&AppMutex); // Start it AppSetRun(false); // Platform Initialize #ifdef SYSTEM_MACOS InitializeWorkingDirectory(); // Specific in MacOS #endif if (!UsersInitialize()) return false; // Initialize database if (!DataBaseInitialize()) return false; // Initialize protocol if (!ProtocolInitialize(12993)) return false; // Initialize console if (!ConsoleInitialize()) return false; // Run it AppSetRun(true); return true; }
/****************************************************************************** * * Function : main * * Description: The main entry point * *****************************************************************************/ int main( void ) { S16 DeviceSelected; PLX_STATUS rc; PLX_DEVICE_KEY DeviceKey; PLX_DEVICE_OBJECT Device; ConsoleInitialize(); Cons_clear(); Cons_printf( "\n\n" "\t\t PLX Local->PCI Interrupt Sample Application\n" "\t\t January 2008\n\n" ); /************************************ * Select Device ************************************/ DeviceSelected = SelectDevice( &DeviceKey ); if (DeviceSelected == -1) { ConsoleEnd(); exit(0); } rc = PlxPci_DeviceOpen( &DeviceKey, &Device ); if (rc != ApiSuccess) { Cons_printf("\n ERROR: Unable to find or select a PLX device\n"); PlxSdkErrorDisplay(rc); _Pause; ConsoleEnd(); exit(-1); } Cons_clear(); Cons_printf( "\nSelected: %04x %04x [b:%02x s:%02x f:%x]\n\n", DeviceKey.DeviceId, DeviceKey.VendorId, DeviceKey.bus, DeviceKey.slot, DeviceKey.function ); // Verify chip is supported switch (DeviceKey.PlxChip) { case 0x9050: case 0x9030: case 0x9080: case 0x9054: case 0x9056: case 0x9656: case 0x8311: break; default: Cons_printf( "ERROR: Device (%04X) does not support generic Local-to-PCI interrupt\n", DeviceKey.PlxChip ); goto _Exit_App; } /************************************ * Perform the DMA ************************************/ InterruptTest( &Device ); /************************************ * Close the Device ***********************************/ _Exit_App: PlxPci_DeviceClose( &Device ); _Pause; Cons_printf("\n\n"); ConsoleEnd(); exit(0); }
/****************************************************************************** * * Function : main * * Description: The main entry point * *****************************************************************************/ int main( void ) { S16 DeviceSelected; PLX_STATUS rc; PLX_DEVICE_KEY DeviceKey; PLX_DEVICE_OBJECT Device; ConsoleInitialize(); Cons_clear(); Cons_printf( "\n\n" "\t\t PLX DMA Sample Application\n\n" ); /************************************ * Select Device ************************************/ DeviceSelected = SelectDevice_DMA( &DeviceKey ); if (DeviceSelected == -1) { ConsoleEnd(); exit(0); } rc = PlxPci_DeviceOpen( &DeviceKey, &Device ); if (rc != ApiSuccess) { Cons_printf("\n ERROR: Unable to find or select a PLX device\n"); PlxSdkErrorDisplay(rc); _Pause; ConsoleEnd(); exit(-1); } Cons_clear(); Cons_printf( "\nSelected: %04x %04x [b:%02x s:%02x f:%x]\n\n", DeviceKey.DeviceId, DeviceKey.VendorId, DeviceKey.bus, DeviceKey.slot, DeviceKey.function ); /************************************ * Perform the DMA ************************************/ if (((DeviceKey.PlxChip & 0xF000) == 0x8000) && (DeviceKey.PlxChip != 0x8311)) { PerformDma_8000( &Device ); } else { Cons_printf( "ERROR: DMA not supported by the selected device (%04X)\n", DeviceKey.PlxChip ); goto _Exit_App; } /************************************ * Close the Device ***********************************/ _Exit_App: PlxPci_DeviceClose( &Device ); _Pause; Cons_printf("\n\n"); ConsoleEnd(); exit(0); }