int main() { SetDebugThrow_(debugAction_Debugger); SetDebugSignal_(debugAction_Debugger); InitializeHeap(3); UQDGlobals::InitializeToolbox(&qd); new LGrowZone(20000); CFreeAmp theApp; theApp.Run(); return 0; }
//---------------------------------------------------------------------------- VertexCollapse::VertexCollapse (int iVQuantity, Vector3*& rakVertex, bool bClosed, int*& raiMap, int& riEQuantity, int*& raiEdge) { raiMap = new int[iVQuantity]; if ( bClosed ) { riEQuantity = iVQuantity; raiEdge = new int[2*riEQuantity]; if ( iVQuantity == 3 ) { raiMap[0] = 0; raiMap[1] = 1; raiMap[2] = 3; raiEdge[0] = 0; raiEdge[1] = 1; raiEdge[2] = 1; raiEdge[3] = 2; raiEdge[4] = 2; raiEdge[5] = 0; return; } } else { riEQuantity = iVQuantity-1; raiEdge = new int[2*riEQuantity]; if ( iVQuantity == 2 ) { raiMap[0] = 0; raiMap[1] = 1; raiEdge[0] = 0; raiEdge[1] = 1; return; } } // create the heap of records InitializeHeap(iVQuantity,rakVertex,bClosed); BuildHeap(); assert( IsValid() ); // create the level of detail information for the polyline int* aiCollapse = new int[iVQuantity]; CollapseVertices(iVQuantity,rakVertex,aiCollapse); ComputeEdges(iVQuantity,bClosed,aiCollapse,raiMap,riEQuantity,raiEdge); ReorderVertices(iVQuantity,rakVertex,aiCollapse,riEQuantity,raiEdge); delete[] aiCollapse; }
void main(void) { // --------------------------- // Set Debugging options // --------------------------- DEBUG_INITIALIZE(); #ifdef DEBUG #ifdef CHECK_FOR_MEMORY_LEAKS gDebugNewFlags |= dnDontFreeBlocks; #endif #if TARGET_OS_MAC if (AmIBeingMWDebugged() == true) { SetDebugThrow_(debugAction_Nothing);//debugAction_LowLevelDebugger); SetDebugSignal_(debugAction_Nothing);//debugAction_LowLevelDebugger); DEBUG_SET_LEVEL(DEBUG_SHOW_MOST); DEBUG_ENABLE_ERROR(DEBUG_TUTORIAL); gDebugBreakOnErrors = true; // metronub should catch debugger traps } else { SetDebugSignal_(debugAction_Nothing); SetDebugThrow_(debugAction_Nothing); DEBUG_SET_LEVEL(DEBUG_SHOW_ERRORS); gDebugBreakOnErrors = false; } #else // TARGET_OS_WIN32 SetDebugThrow_(debugAction_Nothing);//debugAction_LowLevelDebugger); SetDebugSignal_(debugAction_Nothing);//debugAction_LowLevelDebugger); DEBUG_SET_LEVEL(DEBUG_SHOW_SOME); gDebugBreakOnErrors = true; // metronub should catch debugger traps gUseDebugMenu = true; #endif // TARGET_OS_MAC #else // non debug version SetDebugSignal_(debugAction_Nothing); SetDebugThrow_(debugAction_Nothing); DEBUG_SET_LEVEL(DEBUG_SHOW_ERRORS); #endif // --------------------------- // MacOS Initialization // --------------------------- #if TARGET_OS_MAC InitializeHeap(14); // Init Memory Manager: Param is num Master Ptr blocks to allocate #if !TARGET_API_MAC_CARBON UQDGlobals::InitializeToolbox(&qd); #endif // ! TARGET_CARBON #endif // TARGET_OS_MAC TutorialBuilderApp* theApp = new TutorialBuilderApp(); // replace this with your App type theApp->Run(); delete theApp; DEBUG_TERMINATE(); }
/** Do memory initialisation for QNC DDR3 SDRAM Controller @return EFI_SUCCESS Memory initialisation completed successfully. All other error conditions encountered result in an ASSERT. **/ EFI_STATUS MemoryInit ( VOID ) { MRC_PARAMS MrcData; EFI_BOOT_MODE BootMode; EFI_STATUS Status; EFI_STATUS_CODE_VALUE ErrorCodeValue; UINT16 PmswAdr; PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE MemoryMap[MAX_RANGES]; UINT8 NumRanges; EFI_PHYSICAL_ADDRESS BadMemoryAddress; EFI_PHYSICAL_ADDRESS FspReservedArea; UINT64 ReservedBytes; UINT32 RmuMainMemoryAddress; ErrorCodeValue = 0; // // It is critical that both of these data structures are initialized to 0. // This PEIM knows the number of DIMMs in the system and works with that // information. The MCH PEIM that consumes these data structures does not // know the number of DIMMs so it expects the entire structure to be // properly initialized. By initializing these to zero, all flags indicating // that the SPD is present or the row should be configured are set to false. // ZeroMem (&MrcData, sizeof(MrcData)); // // Determine boot mode // BootMode = GetBootMode(); // // Initialize Error type for reporting status code // switch (BootMode) { case BOOT_ON_FLASH_UPDATE: ErrorCodeValue = EFI_COMPUTING_UNIT_MEMORY + EFI_CU_MEMORY_EC_UPDATE_FAIL; break; case BOOT_ON_S3_RESUME: ErrorCodeValue = EFI_COMPUTING_UNIT_MEMORY + EFI_CU_MEMORY_EC_S3_RESUME_FAIL; break; default: ErrorCodeValue = EFI_COMPUTING_UNIT_MEMORY; break; } // // Specify MRC boot mode // switch (BootMode) { case BOOT_ON_S3_RESUME: case BOOT_ON_FLASH_UPDATE: MrcData.boot_mode = bmS3; break; case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES: MrcData.boot_mode = bmFast; break; default: MrcData.boot_mode = bmCold; break; } // // Configure MRC input parameters. // MrcConfigureFromMcFuses (&MrcData); MrcConfigureFromInfoHob (&MrcData); if (BootMode == BOOT_IN_RECOVERY_MODE) { // // Always do bmCold on recovery. // DEBUG ((DEBUG_INFO, "MemoryInit:Force bmCold on Recovery\n")); MrcData.boot_mode = bmCold; } else { // // Get the saved memory data if possible // if ((GetMrcDataPtr() != 0) && (GetMrcDataLength() != 0)) { ASSERT(GetMrcDataLength() == sizeof(MrcData.timings)); CopyMem (&MrcData.timings, (void *)GetMrcDataPtr(), GetMrcDataLength()); } else { switch (BootMode) { case BOOT_ON_S3_RESUME: case BOOT_ON_FLASH_UPDATE: DEBUG ((DEBUG_ERROR, "ERROR: MRC data missing - reboot\n")); REPORT_STATUS_CODE ( EFI_ERROR_CODE + EFI_ERROR_UNRECOVERED, ErrorCodeValue ); return FSP_STATUS_RESET_REQUIRED_COLD; break; default: MrcData.boot_mode = bmCold; break; } } } PmswAdr = (UINT16)(LpcPciCfg32 (R_QNC_LPC_GPE0BLK) & 0xFFFF) + R_QNC_GPE0BLK_PMSW; if( IoRead32 (PmswAdr) & B_QNC_GPE0BLK_PMSW_DRAM_INIT) { // MRC did not complete last execution, force cold boot path MrcData.boot_mode = bmCold; } // Mark MRC pending IoOr32 (PmswAdr, (UINT32)B_QNC_GPE0BLK_PMSW_DRAM_INIT); // // Call Memory Reference Code's Routines // Mrc (&MrcData); // Mark MRC completed IoAnd32 (PmswAdr, ~(UINT32)B_QNC_GPE0BLK_PMSW_DRAM_INIT); // // Get the Memory Map // NumRanges = MAX_RANGES; ZeroMem (MemoryMap, sizeof (PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE) * NumRanges); Status = GetMemoryMap ( MrcData.mem_size, (PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE *) MemoryMap, &NumRanges, &RmuMainMemoryAddress ); ASSERT_EFI_ERROR (Status); ASSERT(NumRanges <= MAX_RANGES); // // Locate the FSP reserved memory (last entry). // FspReservedArea = MemoryMap[NumRanges - 1].PhysicalAddress; ReservedBytes = MemoryMap[NumRanges - 1].RangeLength; // // Test the memory from 1M->TOM // if (BootMode != BOOT_ON_S3_RESUME) { if (BootMode != BOOT_ON_FLASH_UPDATE) { Status = BaseMemoryTest ( 0x100000, (MrcData.mem_size - 0x100000), Quick, &BadMemoryAddress ); ASSERT_EFI_ERROR (Status); } // // Assign physical memory to PEI // FspInstallPeiMemory (FspReservedArea, ReservedBytes); } // // Enable memory for use // PostInstallMemory (&MrcData, FALSE, RmuMainMemoryAddress); // // Save the memory configuration data into a HOB // HOB data size (stored in variable) is required to be multiple of 8 bytes // if (BootMode != BOOT_ON_S3_RESUME) { InitializeHeap((UINTN)FspReservedArea, (UINTN)ReservedBytes); BuildHobs (MemoryMap, NumRanges, FspReservedArea, ReservedBytes, &MrcData); } DEBUG ((EFI_D_INFO, "MemoryInit Complete.\n")); return EFI_SUCCESS; }