Exemple #1
0
void UBTNode::InitializeInSubtree(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, int32& NextInstancedIndex, EBTMemoryInit::Type InitType) const
{
    if (bCreateNodeInstance)
    {
        // composite nodes can't be instanced!
        check(IsA(UBTCompositeNode::StaticClass()) == false);

        UBTNode* NodeInstance = OwnerComp.NodeInstances.IsValidIndex(NextInstancedIndex) ? OwnerComp.NodeInstances[NextInstancedIndex] : NULL;
        if (NodeInstance == NULL)
        {
            NodeInstance = NewObject<UBTNode>(&OwnerComp, GetClass(), GetFName(), RF_NoFlags, (UObject*)(this));
            NodeInstance->InitializeNode(GetParentNode(), GetExecutionIndex(), GetMemoryOffset(), GetTreeDepth());
            NodeInstance->bIsInstanced = true;

            OwnerComp.NodeInstances.Add(NodeInstance);
        }
        check(NodeInstance);

        NodeInstance->SetOwner(OwnerComp.GetOwner());

        FBTInstancedNodeMemory* MyMemory = GetSpecialNodeMemory<FBTInstancedNodeMemory>(NodeMemory);
        MyMemory->NodeIdx = NextInstancedIndex;

        NodeInstance->OnInstanceCreated(OwnerComp);
        NextInstancedIndex++;
    }
    else
    {
        InitializeMemory(OwnerComp, NodeMemory, InitType);
    }
}
Exemple #2
0
//----------------------------------------------------------------------//
// DEPRECATED
//----------------------------------------------------------------------//
void UBTNode::InitializeMemory(UBehaviorTreeComponent* OwnerComp, uint8* NodeMemory, EBTMemoryInit::Type InitType) const
{
    if (OwnerComp)
    {
        InitializeMemory(*OwnerComp, NodeMemory, InitType);
    }
}
OpenMPManager::OpenMPManager(ProfileType pprofile, int num_threads,size_t total_memory): BaseManager(pprofile), total_threads(num_threads){
	printf("Utilizing Threading\n");
	//Initialize memory
	InitializeMemory(total_memory/2l); //Half the memory we specify
	//Initialize our threads
	//workers = new std::thread[total_threads];
	t_intens = new double*[total_threads];
	threads_done = new bool[total_threads];
	for(int i = 0; i < total_threads; i++)
		threads_done[i] = true;
	

}
void UBTNode::InitializeInSubtree(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, int32& NextInstancedIndex, EBTMemoryInit::Type InitType) const
{
	FBTInstancedNodeMemory* SpecialMemory = GetSpecialNodeMemory<FBTInstancedNodeMemory>(NodeMemory);
	if (SpecialMemory)
	{
		SpecialMemory->NodeIdx = INDEX_NONE;
	}

	if (bCreateNodeInstance)
	{
		// composite nodes can't be instanced!
		check(IsA(UBTCompositeNode::StaticClass()) == false);

		UBTNode* NodeInstance = OwnerComp.NodeInstances.IsValidIndex(NextInstancedIndex) ? OwnerComp.NodeInstances[NextInstancedIndex] : NULL;
		if (NodeInstance == NULL)
		{
			NodeInstance = (UBTNode*)StaticDuplicateObject(this, &OwnerComp);
			NodeInstance->InitializeNode(GetParentNode(), GetExecutionIndex(), GetMemoryOffset(), GetTreeDepth());
			NodeInstance->bIsInstanced = true;

			OwnerComp.NodeInstances.Add(NodeInstance);
		}

		check(NodeInstance);
		check(SpecialMemory);

		SpecialMemory->NodeIdx = NextInstancedIndex;

		NodeInstance->SetOwner(OwnerComp.GetOwner());
		NodeInstance->InitializeMemory(OwnerComp, NodeMemory, InitType);
		check(TreeAsset);
		NodeInstance->InitializeFromAsset(*TreeAsset);
		NodeInstance->OnInstanceCreated(OwnerComp);
		NextInstancedIndex++;
	}
	else
	{
		InitializeMemory(OwnerComp, NodeMemory, InitType);
	}
}
Exemple #5
0
static void EnvInitializeEnvironment(
  void *vtheEnvironment,
  struct symbolHashNode **symbolTable,
  struct floatHashNode **floatTable,
  struct integerHashNode **integerTable,
  struct bitMapHashNode **bitmapTable,
  struct externalAddressHashNode **externalAddressTable)
  {
   struct environmentData *theEnvironment = (struct environmentData *) vtheEnvironment;
   
   /*================================================*/
   /* Don't allow the initialization to occur twice. */
   /*================================================*/

   if (theEnvironment->initialized) return;
     
   /*================================*/
   /* Initialize the memory manager. */
   /*================================*/

   InitializeMemory(theEnvironment);

   /*===================================================*/
   /* Initialize environment data for various features. */
   /*===================================================*/
   
   InitializeCommandLineData(theEnvironment);
#if CONSTRUCT_COMPILER && (! RUN_TIME)
   InitializeConstructCompilerData(theEnvironment);
#endif
   InitializeConstructData(theEnvironment);
   InitializeEvaluationData(theEnvironment);
   InitializeExternalFunctionData(theEnvironment);
   InitializePrettyPrintData(theEnvironment);
   InitializePrintUtilityData(theEnvironment);
   InitializeScannerData(theEnvironment);
   InitializeSystemDependentData(theEnvironment);
   InitializeUserDataData(theEnvironment);
   InitializeUtilityData(theEnvironment);
#if DEBUGGING_FUNCTIONS
   InitializeWatchData(theEnvironment);
#endif
   
   /*===============================================*/
   /* Initialize the hash tables for atomic values. */
   /*===============================================*/

   InitializeAtomTables(theEnvironment,symbolTable,floatTable,integerTable,bitmapTable,externalAddressTable);

   /*=========================================*/
   /* Initialize file and string I/O routers. */
   /*=========================================*/

   InitializeDefaultRouters(theEnvironment);

   /*=========================================================*/
   /* Initialize some system dependent features such as time. */
   /*=========================================================*/

   InitializeNonportableFeatures(theEnvironment);

   /*=============================================*/
   /* Register system and user defined functions. */
   /*=============================================*/

   SystemFunctionDefinitions(theEnvironment);
   UserFunctions();
   EnvUserFunctions(theEnvironment);

   /*====================================*/
   /* Initialize the constraint manager. */
   /*====================================*/

   InitializeConstraints(theEnvironment);

   /*==========================================*/
   /* Initialize the expression hash table and */
   /* pointers to specific functions.          */
   /*==========================================*/

   InitExpressionData(theEnvironment);

   /*===================================*/
   /* Initialize the construct manager. */
   /*===================================*/

#if ! RUN_TIME
   InitializeConstructs(theEnvironment);
#endif

   /*=====================================*/
   /* Initialize the defmodule construct. */
   /*=====================================*/

   AllocateDefmoduleGlobals(theEnvironment);

   /*===================================*/
   /* Initialize the defrule construct. */
   /*===================================*/

#if DEFRULE_CONSTRUCT
   InitializeDefrules(theEnvironment);
#endif

   /*====================================*/
   /* Initialize the deffacts construct. */
   /*====================================*/

#if DEFFACTS_CONSTRUCT
   InitializeDeffacts(theEnvironment);
#endif

   /*=====================================================*/
   /* Initialize the defgeneric and defmethod constructs. */
   /*=====================================================*/

#if DEFGENERIC_CONSTRUCT
   SetupGenericFunctions(theEnvironment);
#endif

   /*=======================================*/
   /* Initialize the deffunction construct. */
   /*=======================================*/

#if DEFFUNCTION_CONSTRUCT
   SetupDeffunctions(theEnvironment);
#endif

   /*=====================================*/
   /* Initialize the defglobal construct. */
   /*=====================================*/

#if DEFGLOBAL_CONSTRUCT
   InitializeDefglobals(theEnvironment);
#endif

   /*=======================================*/
   /* Initialize the deftemplate construct. */
   /*=======================================*/

#if DEFTEMPLATE_CONSTRUCT
   InitializeDeftemplates(theEnvironment);
#endif

   /*=============================*/
   /* Initialize COOL constructs. */
   /*=============================*/

#if OBJECT_SYSTEM
   SetupObjectSystem(theEnvironment);
#endif

   /*=====================================*/
   /* Initialize the defmodule construct. */
   /*=====================================*/

   InitializeDefmodules(theEnvironment);

   /*======================================================*/
   /* Register commands and functions for development use. */
   /*======================================================*/

#if DEVELOPER
   DeveloperCommands(theEnvironment);
#endif

   /*=========================================*/
   /* Install the special function primitives */
   /* used by procedural code in constructs.  */
   /*=========================================*/

   InstallProcedurePrimitives(theEnvironment);

   /*==============================================*/
   /* Install keywords in the symbol table so that */
   /* they are available for command completion.   */
   /*==============================================*/

   InitializeKeywords(theEnvironment);

   /*========================*/
   /* Issue a clear command. */
   /*========================*/
   
   EnvClear(theEnvironment);

   /*=============================*/
   /* Initialization is complete. */
   /*=============================*/

   theEnvironment->initialized = TRUE;
  }
Exemple #6
0
int main() 
{

    rtx_dbug_outs((CHAR *)"rtx: Entering main()\r\n");

    /* get the third party test proc initialization info */
    __REGISTER_TEST_PROCS_ENTRY__();
	
	rtxEnd = &(_end);
	m_nextPid = 1;
	
	// Setting up trap # 0
    // Load vector table for trap # 0
    asm( "move.l #asm_trap_entry, %d0" );
    asm( "move.l %d0, 0x10000080" );
	
	#ifdef _DEBUG_
	rtx_dbug_outs( (CHAR*)"Start\r\n" );
	WriteHex((int)malloc(0) );
	rtx_dbug_outs( (CHAR*)" Address before PCBS\r\n" );
	#endif
	// Allocate and initialize pcbs and its stacks
	//rtxProcess* pcbs = AllocatePCBs( MAX_NUMPROCS );
	pcbs = AllocatePCBs( MAX_NUMPROCS );
	#ifdef _DEBUG_
	WriteHex((int)malloc(0) );
	rtx_dbug_outs( (CHAR*)" Address after PCBS\r\n" );
	#endif
	// Initialize the process manager
	rtxProcMan = InitProcessManager();
	#ifdef _DEBUG_
	WriteHex((int)malloc(0) );
	rtx_dbug_outs( (CHAR*)" Address after Procman?\r\n" );
	#endif
	// Create the null process
	rtxProcess* nullProc = CreateProcess( pcbs, null_process, AllocateStack(256), 0, NULLPROCPRIORITY );
	nullProc->status = READY;
	rtxProcMan->nullProc = nullProc;
	#ifdef _DEBUG_
	WriteHex((int)malloc(0) );
	rtx_dbug_outs( (CHAR*)" Address after nullproc?\r\n" );
	#endif
	//Create the Processes
	rtxProcess* cp2 = CreateProcess( pcbs, &keyboardCommandDecoder, AllocateStack(2048), KCDPID, MEDIUM );
	rtxProcess* cp1 = CreateProcess( pcbs, &CRTDisplay, AllocateStack(512), CRTPID, MEDIUM);
	rtxProcess* cp3 = CreateProcess( pcbs, &UART_PROCESS, AllocateStack(512), UARTPID, HIGH );
	
	CRT = cp1;
   	KCD = cp2;
	UART = cp3;	
	
	// Creating and enqueueing the test processes
	for( m_nextPid = 1 ; m_nextPid < (NUM_TEST_PROCS + 1); m_nextPid++ ){
		EnqueueProcess( 
			rtxProcMan, 
			CreateProcess( 
				pcbs, 
				g_test_proc[m_nextPid-1].entry, 
				AllocateStack( g_test_proc[m_nextPid-1].sz_stack ),
				g_test_proc[m_nextPid-1].pid,
				g_test_proc[m_nextPid-1].priority
			),
			READYQUEUE
		);
	}
	
	// Set the next pid to be 1 greater than last test proc pid
	//m_nextPid = g_test_proc[m_nextPid-2].pid + 1;
	
	// Initialize some of our own system processes
	
	EnqueueProcess( rtxProcMan, cp2,READYQUEUE);
	EnqueueProcess( rtxProcMan, cp1,READYQUEUE );

	
	
	// Initialize the scheduler
	InitializeScheduler( (ProcessManager*)(rtxProcMan) );
	
	// Time to allocate and initialize free memory
	UINT32 numTotalBlocks = ( (UINT32)0x10200000 - (UINT32)malloc(0)) / sizeof(MemoryBlock);
	
	//numTotalBlocks = 1;
	#ifdef _DEBUG_
	WriteHex((int)malloc(0) );
	rtx_dbug_outs( (CHAR*)" Address At start of freemem\r\n" );
	#endif
	// Allocate free memory and create memory table
	MemoryBlock* memstart = AllocateFreeMemory( sizeof(MemoryBlock), numTotalBlocks );
	#ifdef _DEBUG_
	WriteHex((int)malloc(0) );
	rtx_dbug_outs( (CHAR*)" Address after freemem?\r\n" );
	rtx_dbug_outs( (CHAR*)"Allocated Free Memory\r\n" );
	#endif
	InitMemQueue( &freeMemory );
	InitializeMemory( &freeMemory, memstart, numTotalBlocks );
	#ifdef _DEBUG_	
    rtx_dbug_outs( (CHAR*)"Number of free memory blocks: " );
    WriteNumber( freeMemory.count );	
    WriteLine();

	rtx_dbug_outs( (CHAR*)"Initialized Free Memory\r\n" );
	#endif
	
	UINT32 mask;
	
	//disable all interupts 
	asm( "move.w #0x2700,%sr" );
	
	coldfire_vbr_init();
	
	//store the serial ISR at user vector #64
	asm( "move.l #asm_serial_entry,%d0" );
	asm( "move.l %d0,0x10000100" );

	//reset the entire UART 
	SERIAL1_UCR = 0x10;

	//reset the receiver 
	SERIAL1_UCR = 0x20;
	
	//reset the transmitter 
	SERIAL1_UCR = 0x30;

	//reset the error condition
	SERIAL1_UCR = 0x40;

	//install the interupt
	SERIAL1_ICR = 0x17;
	SERIAL1_IVR = 64;

	//enable interrupts on rx only
	SERIAL1_IMR = 0x02;

	//set the baud rate
	SERIAL1_UBG1 = 0x00;
#ifdef _CFSERVER_           /* add -D_CFSERVER_ for cf-server build */
	SERIAL1_UBG2 = 0x49;    /* cf-server baud rate 19200 */ 
#else
	SERIAL1_UBG2 = 0x92;    /* lab board baud rate 9600 */
#endif 

	//set clock mode
	SERIAL1_UCSR = 0xDD;

	//setup the UART (no parity, 8 bits )
	SERIAL1_UMR = 0x13;
	
	//setup the rest of the UART (noecho, 1 stop bit )
	SERIAL1_UMR = 0x07;

	//setup for transmit and receive
	SERIAL1_UCR = 0x05;

	//enable interupts
	mask = SIM_IMR;
	mask &= 0x0003dfff;
	SIM_IMR = mask;

	//enable all interupts
	asm( "move.w #0x2000,%sr" );
	// end of keyboard interrupts
	
	
	// Start it up
	ScheduleNextProcess( rtxProcMan, NULL );
	
    return 0;
}