⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bspcfg.c

📁 这是单板上DPRAM的驱动程序
💻 C
📖 第 1 页 / 共 2 页
字号:
 
SysSetVector(V_ALIGN, (void (*)())(probe_start + PROBE_ALIGN_OFFSET),
             VT_REG, 0, 0);
SysSetVector(V_PROGRAM, (void (*)())(probe_start + PROBE_INBRK_OFFSET),
             VT_REG, 0, 0);
SysSetVector(V_FLOAT,  (void (*)())(probe_start + PROBE_FPU_OFFSET),
             VT_REG, 0, 0);
 
if (ProcType == PPC601)
   SysSetVector(V_IOERROR, (void (*)())(probe_start + PROBE_IOCTRL_OFFSET),
                VT_REG, 0, 0);
 
if ((ProcType == PPC603) || (ProcType == PPC604))
   {
   SysSetVector(V_TRACE, (void (*)())(probe_start + PROBE_TRACE_OFFSET),
                VT_REG, 0, 0);
   SysSetVector(V_IA_BP, (void (*)())(probe_start + PROBE_IA_BRK_OFFSET),
                VT_REG, 0, 0);
   }
 
if (ProcType == PPC601)
   SysSetVector(V_RUNMODE, (void (*)())(probe_start + PROBE_RUNMODE_OFFSET),
                VT_REG, 0, 0);
 
if (ProcType == PPC821)
   {
   SysSetVector(V_SEI821, (void (*)())(probe_start + PROBE_INBRK_OFFSET),
                VT_REG, 0, 0);
   SysSetVector(V_TRACE, (void (*)())(probe_start + PROBE_TRACE_OFFSET),
                VT_REG, 0, 0);
   SysSetVector(V_IA_BP821, (void (*)())(probe_start + PROBE_IA_BRK_OFFSET),
                VT_REG, 0, 0);
   SysSetVector(V_DA_BP821, (void (*)())(probe_start + PROBE_IA_BRK_OFFSET),
                VT_REG, 0, 0);
   SysSetVector(V_RESET, HwAbortHandler, VT_RESET8xx, 0, 0);
   }
}
#endif  /* (SC_PROBE) */



void BspPsosUp(void)
{
ULONG msrORval;
unsigned long ilevel;

msrORval = 0;

#if (BSP_FPU == YES)
msrORval = MSR_FP | MSR_FE0 | MSR_FE1;
#endif

/*---------------------------------------------------------------------*/
/* Set the pointers to the pSOS and pMONT interrupt entry/exit         */
/* routines.  These are defined in, and used by,                       */
/* bsps/devices/powerpc/isr_a.s.                                       */
/*---------------------------------------------------------------------*/
ilevel = splx(MAX_ILEV);

#if (SC_PSOS || SC_PSOSM)
ptrPsosEnter = (void (*)()) (((ULONG) anchor->psosct->kc_psoscode)
   + ENTRY_START_OFFSET + (PSOS_I_ENTER_OFFSET * ENTRY_LENGTH));

ptrPsosExit  = (void (*)()) (((ULONG) anchor->psosct->kc_psoscode)
   + ENTRY_START_OFFSET + (PSOS_I_RETURN_OFFSET * ENTRY_LENGTH));
#endif

#if (SC_PMONT)
ptrPmontEnter= (void (*)()) (((ULONG) anchor->pmct->code)
   + ENTRY_START_OFFSET + (PMONT_I_ENTER_OFFSET * ENTRY_LENGTH));

ptrPmontExit = (void (*)()) (((ULONG) anchor->pmct->code)
   + ENTRY_START_OFFSET + (PMONT_I_RETURN_OFFSET * ENTRY_LENGTH));
#endif

   /*------------------------------------------------------------------*/
   /* If pMONT is present in the system Install the pSOSpMontIntWrapper*/
   /* otherwise install the pSOSInt Wrapper                            */
   /*------------------------------------------------------------------*/
#if (BSP_CPU == PPC403GA)
    #if SC_PMONT
        SysSetVector(V_TIMERS,  pSOSpMontIntWrapper, VT_STACK3,  0, 0);
        SysSetVector(V_INTRPT,  pSOSpMontIntWrapper, VT_INTR403, 0, 0);
    #else
        SysSetVector(V_TIMERS,  pSOSIntWrapper,      VT_STACK3,  0, 0);
        SysSetVector(V_INTRPT,  pSOSIntWrapper,      VT_INTR403, 0, 0);
    #endif
#else
    #if SC_PMONT
        SysSetVector(V_INTRPT,  PmontIsr, VT_STACK, msrORval, 0);
        SysSetVector(V_DCRMNTR, PmontIsr, VT_STACK, msrORval, 0);
    #else
        SysSetVector(V_INTRPT,  PsosIsr,      VT_STACK, msrORval, 0);
        SysSetVector(V_DCRMNTR, PsosIsr,      VT_STACK, msrORval, 0);
    #endif
#endif

splx(ilevel);
}

/***********************************************************************/
/* BspSetup: Setup BSP configuration                                   */
/*                                                                     */
/*      INPUTS: FreeMemPtr pointer to free memory area that can be     */
/*                used to allocate memory for the BSP.                 */
/*              NodeCfg pointer to the systems node configuration      */
/*                that can be used to see what and how components      */
/*                are configured into the system.                      */
/*                This will not be used.                               */
/*                                                                     */
/*     RETURNS: An updated pointer to free memory                      */
/*     OUTPUTS: NONE                                                   */
/*     NOTE(S): This function will be called from configs/std/sysinit.c*/
/*              SysInit function.  The call to BspSetup happens        */
/*              BEFORE ANY COMPONENT IS INITIALIZED therefore it       */
/*              cannot call any system calls or services.              */
/*                                                                     */
/***********************************************************************/
extern UCHAR *sd_init(UCHAR *FreeMemPtr);
extern char *UncachedBufferStart;
extern char UncachedBuffer[];

UCHAR *BspSetup(UCHAR *FreeMemPtr,  NODE_CT *NodeCfg)
{
unsigned long msrORval;   /* NEED TO SET THIS!!! */
void *psos_tmp;
static NODE_CT *unused_NodeCfg;
register ULONG cnt;
 
UncachedBufferStart=UncachedBuffer;
FreeMemPtr=sd_init(FreeMemPtr);
ProbeIOReinit();
msrORval = 0;
#if (BSP_FPU == YES)
msrORval = MSR_FP | MSR_FE0 | MSR_FE1;
#endif
 
#if ((BSP_LAN1_FLAGS) & (IFF_MULTICAST))
    #if (SC_LAN1_NMCAST > 0)
 
 
    FreeMemPtr = (UCHAR *)ALIGN((ULONG)FreeMemPtr, 4);
 
    lan_mcast.mc_refs = (ULONG *)FreeMemPtr;
    lan_mcast.max_num = SC_LAN1_NMCAST;
    lan_mcast.num_used = 0;
 
    FreeMemPtr += SC_LAN1_NMCAST * sizeof(ULONG);
 
    lan_mcast.mc_addr = (UCHAR *)FreeMemPtr;
 
    /*-----------------------------------------------------------------*/
    /* Clear all references counts.                                    */
    /*-----------------------------------------------------------------*/
    for (cnt = 0; cnt < SC_LAN1_NMCAST; cnt++)
        lan_mcast.mc_refs[cnt] = 0;
 
    /*-----------------------------------------------------------------*/
    /* Make room for the largest possible MC Setup command. Note the   */
    /* structure contains space for one multicast address already.     */
    /*-----------------------------------------------------------------*/
 
    FreeMemPtr += (SC_LAN1_NMCAST) * 6;
 
    for (cnt = (ULONG)lan_mcast.mc_addr; cnt < (ULONG)FreeMemPtr; cnt++)
        {
        *(UCHAR *)cnt = 0;
        }
 
    #else
 
    lan_mcast.mc_addr = (UCHAR *)NULL;
    lan_mcast.mc_refs = (ULONG *)NULL;
    lan_mcast.max_num = 0;
    lan_mcast.num_used = 0;
 
    #endif
#endif
 
#if ((SC_PSOS == USEROM) || (SC_PSOSM == USEROM))
 
#if (SC_BOOT_ROM == YES)
#error "Must not set USEROM for SC_PSOS or SC_PSOSM, with SC_BOOT_ROM enabled"
#endif /* SC_BOOT_ROM */
 
psos_tmp = (void *) 0;
 
/* Get the ptr to the ROM pSOS code */
if(oldanchor && oldanchor->psosct && oldanchor->psosct->kc_psoscode) {
    psos_tmp = (void *) ((ULONG)(oldanchor->psosct->kc_psoscode) +
                         (ULONG)(ENTRY_START_OFFSET +
                          (ENTRY_LENGTH * PSOS_SVC_OFFSET)));
} else {
    SysInitFail("ROM is missing pSOS+.");
}
 
#else
    psos_tmp = (void *) PSOS_SVC;
#endif
 
SysSetVector(V_SYSCALL, psos_tmp,   VT_SC, msrORval, 0);

unused_NodeCfg = NodeCfg;

#if SC_PROFILER
    __PROF_INFO_PTR = 0;
#endif
 
return(FreeMemPtr);
}

void BspInformTick()
{
#if SC_PROFILER
   if (((pip = __PROF_INFO_PTR) != (struct prof_info *)0) &&
       ((psp = pip->pi_stack) != (struct prof_stack * )0)
      )
       psp->ps_toptime++;
#endif
}

#include "sdevcfg.c"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -