コード例 #1
0
ファイル: bspstart.c プロジェクト: AoLaD/rtems
void _BSP_Fatal_error(unsigned int v)
{
  RTEMS_UNUSED rtems_interrupt_level level;

  rtems_interrupt_disable(level);

  printk("\n%s FATAL ERROR %x\n", rtems_get_version_string(), v);

  BSP_ask_for_reset();
}
コード例 #2
0
ファイル: bspstart.c プロジェクト: AoLaD/rtems
void BSP_panic(char *s)
{
  RTEMS_UNUSED rtems_interrupt_level level;

  rtems_interrupt_disable(level);

  printk("\n%s PANIC %s\n", rtems_get_version_string(), s);

  BSP_ask_for_reset();
}
コード例 #3
0
ファイル: bspstart.c プロジェクト: Fyleo/rtems
void _BSP_Fatal_error(unsigned int v)
{
  __attribute__((unused)) rtems_interrupt_level level;

  rtems_interrupt_disable(level);

  printk("\n%s FATAL ERROR %x\n", rtems_get_version_string(), v);

  BSP_ask_for_reset();
}
コード例 #4
0
ファイル: bspstart.c プロジェクト: Fyleo/rtems
void BSP_panic(char *s)
{
  __attribute__((unused)) rtems_interrupt_level level;

  rtems_interrupt_disable(level);

  printk("\n%s PANIC %s\n", rtems_get_version_string(), s);

  BSP_ask_for_reset();
}
コード例 #5
0
ファイル: bspstart.c プロジェクト: cloud-hot/rtems
void _BSP_Fatal_error(unsigned n)
{
  rtems_interrupt_level level;

  rtems_interrupt_disable(level);

  printk("%s PANIC ERROR %u\n", rtems_get_version_string(), n);

  while (1) {
    /* Do nothing */
  }
}
コード例 #6
0
ファイル: bspstart.c プロジェクト: cloud-hot/rtems
void BSP_panic(char *s)
{
  rtems_interrupt_level level;

  rtems_interrupt_disable(level);

  printk("%s PANIC %s\n", rtems_get_version_string(), s);

  while (1) {
    /* Do nothing */
  }
}
コード例 #7
0
ファイル: rtems_init.c プロジェクト: ukaea/epics
/*
 * RTEMS Startup task
 */
rtems_task
Init (rtems_task_argument ignored)
{
    int                 i;
    char               *argv[3]         = { NULL, NULL, NULL };
    char               *cp;
    rtems_task_priority newpri;
    rtems_status_code   sc;
    rtems_time_of_day   now;

    /*
     * Explain why we're here
     */
    logReset();

    /*
     * Architecture-specific hooks
     */
    if (epicsRtemsInitPreSetBootConfigFromNVRAM(&rtems_bsdnet_config) != 0)
        delayedPanic("epicsRtemsInitPreSetBootConfigFromNVRAM");
    if (rtems_bsdnet_config.bootp == NULL) {
        extern void setBootConfigFromNVRAM(void);
        setBootConfigFromNVRAM();
    }
    if (epicsRtemsInitPostSetBootConfigFromNVRAM(&rtems_bsdnet_config) != 0)
        delayedPanic("epicsRtemsInitPostSetBootConfigFromNVRAM");

    /*
     * Override RTEMS configuration
     */
    rtems_task_set_priority (
                     RTEMS_SELF,
                     epicsThreadGetOssPriorityValue(epicsThreadPriorityIocsh),
                     &newpri);

    /*
     * Create a reasonable environment
     */
    initConsole ();
    putenv ("TERM=xterm");
    putenv ("IOCSH_HISTSIZE=20");

    /*
     * Display some OS information
     */
    printf("\n***** RTEMS Version: %s *****\n",
        rtems_get_version_string());

    /*
     * Start network
     */
    if ((cp = getenv("EPICS_TS_NTP_INET")) != NULL)
        rtems_bsdnet_config.ntp_server[0] = cp;
    if (rtems_bsdnet_config.network_task_priority == 0)
    {
        unsigned int p;
        if (epicsThreadHighestPriorityLevelBelow(epicsThreadPriorityScanLow, &p)
                                            == epicsThreadBooleanStatusSuccess)
        {
            rtems_bsdnet_config.network_task_priority = epicsThreadGetOssPriorityValue(p);
        }
    }
    printf("\n***** Initializing network *****\n");
    rtems_bsdnet_initialize_network();
    initialize_remote_filesystem(argv, initialize_local_filesystem(argv));

    /*
     * More environment: iocsh prompt and hostname
     */
    {
        char hostname[1024];
        gethostname(hostname, 1023);
        char *cp = mustMalloc(strlen(hostname)+3, "iocsh prompt");
        sprintf(cp, "%s> ", hostname);
        epicsEnvSet ("IOCSH_PS1", cp);
        epicsEnvSet("IOC_NAME", hostname);
    }

    /*
     * Use BSP-supplied time of day if available otherwise supply default time.
     * It is very likely that other time synchronization facilities in EPICS
     * will soon override this value.
     */
    if (rtems_clock_get(RTEMS_CLOCK_GET_TOD,&now) != RTEMS_SUCCESSFUL) {
        now.year = 2001;
        now.month = 1;
        now.day = 1;
        now.hour = 0;
        now.minute = 0;
        now.second = 0;
        now.ticks = 0;
        if ((sc = rtems_clock_set (&now)) != RTEMS_SUCCESSFUL)
            printf ("***** Can't set time: %s\n", rtems_status_text (sc));
    }
    if (getenv("TZ") == NULL) {
        const char *tzp = envGetConfigParamPtr(&EPICS_TIMEZONE);
        if (tzp == NULL) {
            printf("Warning -- no timezone information available -- times will be displayed as GMT.\n");
        }
        else {
            char tz[10];
            int minWest, toDst = 0, fromDst = 0;
            if(sscanf(tzp, "%9[^:]::%d:%d:%d", tz, &minWest, &toDst, &fromDst) < 2) {
                printf("Warning: EPICS_TIMEZONE (%s) unrecognizable -- times will be displayed as GMT.\n", tzp);
            }
            else {
                char posixTzBuf[40];
                char *p = posixTzBuf;
                p += sprintf(p, "%cST%d:%.2d", tz[0], minWest/60, minWest%60);
                if (toDst != fromDst)
                    p += sprintf(p, "%cDT", tz[0]);
                epicsEnvSet("TZ", posixTzBuf);
            }
        }
    }
    tzset();
    osdTimeRegister();

    /*
     * Run the EPICS startup script
     */
    printf ("***** Starting EPICS application *****\n");
    iocshRegisterRTEMS ();
    set_directory (argv[1]);
    epicsEnvSet ("IOC_STARTUP_SCRIPT", argv[1]);
    atexit(exitHandler);
    i = main ((sizeof argv / sizeof argv[0]) - 1, argv);
    printf ("***** IOC application terminating *****\n");
    epicsThreadSleep(1.0);
    epicsExit(0);
}
コード例 #8
0
ファイル: bspstart.c プロジェクト: AoLaD/rtems
/*
 *  BSP start routine.  Called by boot_card().
 *
 *  This routine does the bulk of the system initialization.
 */
void bsp_start(void)
{
  uintptr_t          intrStackStart;
  uintptr_t          intrStackSize;

  ppc_cpu_id_t       myCpu;
  ppc_cpu_revision_t myCpuRevision;

  /* Set the character output function;  The application may override this */
  BSP_output_char = __bsp_outchar_to_memory;

  printk("RTEMS %s\n", rtems_get_version_string());

  /*
   * Get CPU identification dynamically. Note that the get_ppc_cpu_type()
   * function stores the result in global variables so that it can be used later...
   */
  myCpu         = get_ppc_cpu_type();
  myCpuRevision = get_ppc_cpu_revision();
  printk("CPU: 0x%04x,  Revision: 0x%04x = %d,  Name: %s\n",
         myCpu, myCpuRevision, myCpuRevision, get_ppc_cpu_type_name(myCpu));

  /*
   *  Initialize the device driver parameters
   */

  /* Timebase register ticks/microsecond;  The application may override these */
  bsp_clicks_per_usec        = 350;
  bsp_timer_internal_clock   = true;
  bsp_timer_average_overhead = 2;
  bsp_timer_least_valid      = 3;
  rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);

  /*
   * Initialize the interrupt related settings.
   */
  intrStackStart = CPU_UP_ALIGN((uint32_t)__bsp_ram_start);
  intrStackSize  = rtems_configuration_get_interrupt_stack_size();

  ppc_exc_initialize(intrStackStart, intrStackSize);

  /* Let the user know what parameters we were compiled with */
  printk("                  Base/Start     End         Size\n"
         "RAM:              0x%08x              0x%x\n"
         "RTEMS:                        0x%08x\n"
         "Interrupt Stack:  0x%08x              0x%x\n"
         "Stack:            0x%08x  0x%08x  0x%x\n"
         "Workspace:        0x%08x  0x%08x\n"
         "MsgArea:          0x%08x              0x%x\n"
         "Physical RAM                  0x%08x\n",
         (uint32_t)RamBase,                               (uint32_t)RamSize,
         (uint32_t)__rtems_end,
         intrStackStart,                                  intrStackSize,
         (uint32_t)__stack_base, (uint32_t)_stack,        (uint32_t)StackSize,
         (uint32_t)WorkAreaBase, (uint32_t)__bsp_ram_end,
         (uint32_t)MsgAreaBase,                           (uint32_t)MsgAreaSize,
         (uint32_t)__phy_ram_end);

  /*
   * Initialize RTEMS IRQ system
   */
  BSP_rtems_irq_mngt_init(0);

  /* Continue with application-specific initialization */
  app_bsp_start();
}