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

📄 sysinit.c

📁 psos for mips bsp
💻 C
📖 第 1 页 / 共 3 页
字号:
    Print("\n\t#############################################################\n");
    Print("\t#                                                           #\n");
    Print("\t# GSblkSetup needs more memory to configure all the MBLK's  #\n");
    Print("\t# configured in gsblk_bufcfg structure.                     #\n");
    Print("\t#                                                           #\n");
    Print("\t# You need to re-configure your GS Blocks according to      #\n");
    Print("\t# Your memory requirements.                                 #\n");
    Print("\t#                                                           #\n");
    Print("\t# Modify GS_BUFS_xx in \"sys_conf.h\" file or configure       #\n");
    Print("\t# more memory for the Board and re-run the application.     #\n");
    Print("\t#                                                           #\n");
    Print("\t#############################################################\n");

           for (i=0; i<50; i++)
           {
             Delay100ms();
           }
       }
        }
#endif

/*---------------------------------------------------------------------*/
/* If interactive dialog is configured, do it now.                     */
/*---------------------------------------------------------------------*/
#if SC_STARTUP_DIALOG
    #if (SC_SD_PARAMETERS == SYS_CONF)
       #error "SC_SD_PARAMETERS must be STORAGE if SC_STARTUP_DIALOG is YES"
    #endif

    if ((Dialog() == YES) || (storage_update == TRUE))
        {
        Print("Updating parameter storage. "
              "This may take a while...");

        /*-------------------------------------------------------------*/
        /* Save changed system variables in parameter storage area     */
        /*-------------------------------------------------------------*/
        NVVars.magic = MAGIC;
        NVVars.SysVars_CheckSum = CheckSum(&SysVars, sizeof(SysVars));

        #if BSP_PARMS
            NVVars.BspVars_CheckSum = CheckSum(&BspVars, sizeof(BspVars));
        #endif

        #if SC_APP_PARMS
            NVVars.AppVars_CheckSum = CheckSum(&AppVars, sizeof(AppVars));
        #endif

        StorageWrite(sizeof(NVVars), 0, &NVVars);
        Print("Done\n");
        }
#else
 UNUSED_PARAMETER(storage_update);
#endif

/*---------------------------------------------------------------------*/
/* The parameters are now set - so do the following:                   */
/*    * Call BSP to advise it of VME base address (if appropriate)     */
/*    * Advise BSP and application of "final" values of their          */
/*      parameters (if appropriate)                                    */
/*---------------------------------------------------------------------*/
#if BSP_VME
    SetVmeAddress(SysVars.VmeBaseAddr);
#endif

#if BSP_PARMS
    BspUse(BspVars);
#endif

#if SC_APP_PARMS
    AppUse(AppVars);
#endif

/*---------------------------------------------------------------------*/
/* Check that the parameters make sense, then build the component      */
/* configuration tables                                                */
/*---------------------------------------------------------------------*/
AdjustSysVars();

FreeMemPtr = BuildConfigTables(FreeMemPtr);

/*---------------------------------------------------------------------*/
/* Check FreeMemPtr to make sure it has not over run memory!           */
/* NOTE: If pSOS+ has been configured into the system, the FreeMemPtr  */
/*       is now part of pSOS+ region zero!  So it can't be used to     */
/*       allocate any more memory after this.                          */
/*---------------------------------------------------------------------*/
if (FreeMemPtr > LastByte)
    SysInitFail(MemErrMsg);

#if BSP_NEW_SERIAL
    /*-----------------------------------------------------------------*/
    /* Initialize the lower serial driver.                             */
    /*-----------------------------------------------------------------*/
    SysBaud = SysVars.DefBaud;
    SerialInit();
    ProbeIOReinit();
#else
    /*-----------------------------------------------------------------*/
    /* Set up serial driver again (in case baud rate changed).         */
    /*-----------------------------------------------------------------*/
    SerialSetup(SysVars.DefBaud, PROBE_CON_SER_PORT, SC_RBUG_PORT);
    SerialPollInit();
    SerialPollOn();
    Delay100ms();
#endif


#if (SC_PSOS && SC_QBIND)
dummy  = QuickSvcCallPsos;
#endif

#if (SC_QBIND && SC_PSOSM)
dummy = QuickSvcCallPsosm;
#endif

/*---------------------------------------------------------------------*/
/* Start pROBE+ running, if it is present.  Otherwise, transfer        */
/* control directly to pSOS+.                                          */
/*---------------------------------------------------------------------*/
#if SC_PROBE
        if(SysVars.DebugMode == DBG_XS)

            Print("pROBE+ is now ready to talk to the host debugger"
                  " over the serial channel...\n");
	    else if (SysVars.DebugMode == DBG_XN)
            Print("pROBE+ is now ready to talk to the host debugger"
                  " over the network...\n");

#if (SC_PROBE == USEROM)
    pROBE_tmp = (ULONG(*)(void))((ULONG)(NodeCfg.probect->td_code) +
    ENTRY_START_OFFSET + (ENTRY_LENGTH * PROBE_INIT_OFFSET));
    rc = (*pROBE_tmp)();
                                                              
#else
    rc = pROBE_Init();

#endif 

    while(1)
    {
       ULONG i;

       Print("pROBE+ Initialization Failed, Error Code 0x%08X\n", rc);
    
       for (i=0; i<50; i++)
       {
         Delay100ms();
       }
    }

#elif (SC_PSOS || SC_PSOSM)

#if !BSP_NEW_SERIAL
    SerialPollOff();
#else
    ProbeExit();
#endif

#if ((SC_PSOS == USEROM) || (SC_PSOSM == USEROM))
    pSOS_tmp = (ULONG(*)(void))((ULONG)(NodeCfg.psosct->kc_psoscode) +
    ENTRY_START_OFFSET);
    rc = (*pSOS_tmp)();

#else
    rc = 0;
    PSOS_INIT();
#endif

   UNUSED_PARAMETER(rc);

#else

#if !BSP_NEW_SERIAL
    SerialPollOff();
#else
    ProbeExit();
#endif

    rc = 0;
    AppCode();   /* Not using pSOS or pROBE */

    UNUSED_PARAMETER(rc);
#endif

}


/***********************************************************************/
/*     SysStartCO: System startup callout used to register service     */
/*              extension tables, create Task-Specific Data entries,   */
/*              and register task callouts, by individually calling    */
/*              the system start callouts for the kernel, components,  */
/*              BSPs, and drivers.                                     */
/*                                                                     */
/*     NOTE:    No blocking calls can be made from the system startup  */
/*              callout, and since the multi-processing has not been   */
/*              initialized yet, no calls that can generate an RSC     */
/*              should be made (this rules out certain *_ident calls). */
/*                                                                     */
/*              Remember this is a WARM startup call-out from pSOS+    */
/*              kernel.                                                */
/***********************************************************************/
void SysStartCO(void)
{
    PsosUpFlag = 1;

    /*-----------------------------------------------------------------*/
    /* Call the BspSysStartCO() in bspcfg.c file to clean up any BSP   */
    /* dependent Global's or any DATA.                                 */
    /*-----------------------------------------------------------------*/
    BspSysStartCO();

    /*-----------------------------------------------------------------*/
    /* Call the InitSerialMux() in ser_mplx.c file to clean up the     */
    /* Dynamically added Serial Drivers from the MUX Table.            */
    /*-----------------------------------------------------------------*/
#if (BSP_USE_SERIAL_MUX == YES)
    InitSerialMux();
#endif

    /*-----------------------------------------------------------------*/
    /* Call RtecSysStartCO() for RTEC library to re-initialize during  */
    /* pSOS+ Warm startup.                                             */
    /*-----------------------------------------------------------------*/
#if SC_RTEC
    RtecSysStartCO();
#endif

#if (SC_PSOS || SC_PSOSM)
    /*-----------------------------------------------------------------*/
    /* Call DrvSysStartCO() given in "drv_conf.c" file of the sample   */
    /* application directory, So that it will make callouts to any     */
    /* driver that needs clean-up.                                     */
    /*-----------------------------------------------------------------*/
    DrvSysStartCO();

    /*-----------------------------------------------------------------*/
    /* Depending on which component are present in the system make a   */
    /* callouts to corresponding CompSysStartCO() in their respective  */
    /* configuration files "Compcfg.c" in this directory.              */
    /*-----------------------------------------------------------------*/
    PsosSysStartCO();
#endif

#if (SC_PROFILER)
    ProfilerSysStartCO();
#endif

#if ((!SC_PNA) && (SC_PNET))
    PnetSysStartCO();
#endif

#if SC_POSIX
    PosixSysStartCO();
#endif

}

/***********************************************************************/
/* PssInformTick: Make use of the Real Time Clock interrupt            */
/*                Do the SMNI and SMKI checks for Polling.             */
/*                                                                     */
/* INPUTS: none                                                        */
/* OUTPUTS: none                                                       */
/* RETURNS: none                                                       */
/***********************************************************************/
void PssInformTick(void)
{
#if SC_PROFILER
       extern void __prof_clock(void);
       __prof_clock();
#endif
 
   /*------------------------------------------------------------------*/
   /* Implement Polling for SMKI.                                      */
   /*------------------------------------------------------------------*/
#if (BSP_SMEM && SC_PSOSM && (BSP_INT_MODE == 0))
   if (KiUp)
      ki_check();
#endif

   /*------------------------------------------------------------------*/
   /* See if USER TICK Handler is provided and call it.                */
   /*------------------------------------------------------------------*/
   if (PssUserTickHandler)
       (*PssUserTickHandler)();
}
 
#if SC_PLM && SC_BSP_SHLIB
 
extern const sl_header bsp_DISPATCH;
 
/***********************************************************************/
/* Bsp_LM_load: Callout for BSP Shared Library Load function           */
/***********************************************************************/
ULONG
Bsp_LM_load(const char *libname, ULONG scope, ULONG version,
          const void *libinfo, /* Out */ sl_attrib *attr)
{
    ULONG i;
 
#if PLM_DEBUG
        Print("Called Bsp_LM_load(%s, %s, %d.%d, %s, ...)\n",
                libname,
                (scope == SL_ANY ? "SL_ANY"
                 : scope == SL_COMP ? "SL_COMP"
                 : scope == SL_EXACT ? "SL_EXACT"
                 : "??"),
                PLM_MAJOR(version), PLM_MINOR(version), libinfo);
#endif
    return(0);
}
 
/***********************************************************************/
/* Bsp_LM_unload: Callout for BSP Shared Library UnLoad function       */
/***********************************************************************/
ULONG
Bsp_LM_unload(const sl_attrib *attr)
{
#if PLM_DEBUG
        Print("Called Bsp_LM_unload(0x%x) of %s\n",
                attr->libaddr,
                PLM_ADVANCE(attr->libaddr, const char *, attr->libaddr->name));
#endif
        return(0);
}
 
/***********************************************************************/
/* Bsp_LM_bind: Callout for BSP Shared Library Bind function           */
/***********************************************************************/
ULONG
Bsp_LM_bind(ULONG error, const char *libname, ULONG scope, ULONG version,
          const void *libinfo)
{
ULONG errcode;
sl_attrib attr;
ULONG index;
 
#if PLM_DEBUG
        Print("Called Bsp_LM_bind(0x%x, %s, %s, %d.%d, %s)\n",
                error, libname,
                (scope == SL_ANY ? "SL_ANY"
                 : scope == SL_COMP ? "SL_COMP"
                 : scope == SL_EXACT ? "SL_EXACT"
                 : "??"),
                PLM_MAJOR(version), PLM_MINOR(version), libinfo);
#endif
 
        attr.libaddr = &bsp_DISPATCH;
        attr.unloadmode = SL_MANUAL;
 
        /* Register the library */
        errcode = sl_register(attr.libaddr, &attr, &index);
 
        /* Did the register succeed? */
        if (errcode == 0) return (0); /* Yes, return success */
}
#endif /* SC_PLM && SC_BSP_SHLIB */

#ifdef __cplusplus
}
#endif

⌨️ 快捷键说明

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