Esempio n. 1
0
void Init_Cpu(void)
{
    __set_PSP((uint32_t)msp_top);
    __set_PRIMASK(1);
    __set_FAULTMASK(1);
    __set_CONTROL(0);

    #if (CN_CPU_OPTIONAL_FPU == 1)
        pg_scb_reg->CPACR = (3UL << 20)|(3UL << 22);    //使能FPU
        pg_scb_reg->FPCCR = (1UL << 31);                //关闭lazy stacking
    #endif
    switch(pg_scb_reg->CPUID)
    {
//        case cn_revision_r0p1://todo
//            break;    //好像没什么要做的
    }

    extern void WDT_Disable(void);
    WDT_Disable();  //关狗

    extern void SysClockInit(void);
    SysClockInit();

    extern void SDRAM_Init(void);
    SDRAM_Init();

    extern void Cache_Init(void);
    Cache_Init();

    Load_Preload();
}
Esempio n. 2
0
/*
 * ========================
 * Memory_Init
 * ========================
 */
void
Memory_Init(void *buf, int size)
{
    int p;
    int zonesize = DYNAMIC_SIZE;

    hunk_base = (byte*)buf;
    hunk_size = size;
    hunk_low_used = 0;
    hunk_high_used = 0;

    Cache_Init();
    p = COM_CheckParm("-zone");
    if (p) {
	if (p < com_argc - 1)
	    zonesize = Q_atoi(com_argv[p + 1]) * 1024;
	else
	    Sys_Error("%s: you must specify a size in KB after -zone",
		      __func__);
    }
    mainzone = (memzone_t*)Hunk_AllocName(zonesize, "zone");
    Z_ClearZone(mainzone, zonesize);

    /* Needs to be added after the zone init... */
    Cmd_AddCommand("flush", Cache_Flush);
    Cmd_AddCommand("hunk", Hunk_f);
    Cmd_AddCommand("cache", Cache_f);
}
Esempio n. 3
0
File: zone.cpp Progetto: m4c0/Quake
/*
========================
Memory_Init
========================
*/
void Memory_Init (void *buf, int size)
{
	hunk_base = (byte *)buf;
	hunk_size = size;
	hunk_low_used = 0;
	hunk_high_used = 0;
	
	Cache_Init ();
}
Esempio n. 4
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void Memory_Init ( void )
{
	hunk_base = (byte *)host_parms.membase;
	hunk_size = host_parms.memsize;
	hunk_low_used = 0;
	hunk_high_used = 0;
	
	Cache_Init ();
}
Esempio n. 5
0
void Memory_Init (void *buf, int size)
{
	int p;
	int zonesize = ZONE_MINSIZE;

	hunk_base = (byte *) buf;
	hunk_size = size;
	hunk_low_used = 0;
	hunk_high_used = 0;

#if !defined(SERVERONLY)
	Cache_Init ();
#endif	/* SERVERONLY */

	p = COM_CheckParm ("-zone");
	if (p && p < com_argc-1)
	{
		zonesize = atoi (com_argv[p+1]) * 1024;
		if (zonesize < ZONE_MINSIZE && !COM_CheckParm ("-forcemem"))
		{
			Sys_Printf ("Requested zone size (%d Kb) too little, using %d Kb.\n", zonesize/1024, ZONE_MINSIZE_KB);
			Sys_Printf ("If you are sure, use the -forcemem switch.\n");
			zonesize = ZONE_MINSIZE;
		}
		else if (zonesize > ZONE_MAXSIZE && !COM_CheckParm ("-forcemem"))
		{
			Sys_Printf ("Requested zone size (%d Kb) too large, using %d Kb.\n", zonesize/1024, ZONE_MAXSIZE_KB);
			Sys_Printf ("If you are sure, use the -forcemem switch.\n");
			zonesize = ZONE_MAXSIZE;
		}
	}
	mainzone = (memzone_t *) Hunk_AllocName (zonesize, "zone");
	Memory_InitZone (mainzone, Z_MAINZONE, zonesize);

#if !defined(SERVERONLY)
// initialize a 256 KB secondary zone for static textures
	if (!isDedicated)
	{
		sec_zone = (memzone_t *) Hunk_AllocName (ZONE_MINSIZE, "sec_zone");
		Memory_InitZone (sec_zone, Z_SECZONE, ZONE_MINSIZE);
	}

	Cmd_AddCommand ("flush", Cache_Flush);
#endif	/* SERVERONLY */

#if Z_DEBUG_COMMANDS
	Cmd_AddCommand ("sys_memory", Memory_Display_f);
	Cmd_AddCommand ("sys_zone", Zone_Display_f);
	Cmd_AddCommand ("sys_stats", Memory_Stats_f);
#if !defined(SERVERONLY)
	Cmd_AddCommand ("sys_cache", Cache_Display_f);
#endif	/* SERVERONLY */
#endif	/* Z_DEBUG_COMMANDS */
}
Esempio n. 6
0
teJIP_Status eJIP_Init(tsJIP_Context *psJIP_Context, teJIP_ContextType eJIP_ContextType)
{
    tsJIP_Private *psJIP_Private;
    DBG_vPrintf(DBG_FUNCTION_CALLS, "%s\n", __FUNCTION__);
    
    psJIP_Private = malloc(sizeof(tsJIP_Private));
    if (!psJIP_Private)
    {
        return E_JIP_ERROR_NO_MEM;
    }
    
    memset(psJIP_Context, 0, sizeof(tsJIP_Context));
    memset(psJIP_Private, 0, sizeof(tsJIP_Private));
    
    psJIP_Private->eJIP_ContextType = eJIP_ContextType;
    
    eLockCreate(&psJIP_Private->sLock);
    eJIPLockLock(&psJIP_Private->sLock);
    
    if (Network_Init(&psJIP_Private->sNetworkContext, psJIP_Context) != E_NETWORK_OK)
    {
        free(psJIP_Private);
        return E_JIP_ERROR_FAILED;
    }
    
    if (Cache_Init(psJIP_Context, &psJIP_Private->sCache) != E_JIP_OK)
    {
        free(psJIP_Private);
        return E_JIP_ERROR_FAILED;
    }
    
    /* No registered network change handler */
    psJIP_Private->prCbNetworkChange = NULL;
    
    /* Save private context into public */
    psJIP_Context->pvPriv = psJIP_Private;
    
    /* No nodes in the network */
    memset(&psJIP_Context->sNetwork, 0, sizeof(tsNetwork));
    
    /* Point the network's owner context to this context */
    psJIP_Context->sNetwork.psOwnerContext = psJIP_Context;

    /* Set up the multicast interface index - send on all interfaces by default. */
    psJIP_Context->iMulticastInterface = -1;
    
    /* Set up the multicast attempts to the default */
    psJIP_Context->iMulticastSendCount = 2;
    
    eJIPLockUnlock(&psJIP_Private->sLock);
    
    return E_JIP_OK;
}
Esempio n. 7
0
/*
========================
Memory_Init
========================
*/
void Memory_Init (void *buf, int size)
{
	int p;
	int zonesize = DYNAMIC_SIZE;

	hunk_base = (byte *)buf;
	hunk_size = size;
	hunk_low_used = 0;
	hunk_high_used = 0;
	
	Cache_Init ();
	p = COM_CheckParm ("-zone");
	if (p)
	{
		if (p < com_argc-1)
			zonesize = Q_atoi (com_argv[p+1]) * 1024;
		else
			Sys_Error ("Memory_Init: you must specify a size in KB after -zone");
	}
	mainzone = (memzone_t *)Hunk_AllocName (zonesize, "zone" );
	Z_ClearZone (mainzone, zonesize);
}