Changeset fe6ef776 in rtems for c/src/lib/libbsp/i386


Ignore:
Timestamp:
Oct 15, 1996, 9:39:27 PM (24 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
9e406d9
Parents:
6c58b6f
Message:

updated to format of 3.6.0

Location:
c/src/lib/libbsp/i386/i386ex
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/i386ex/include/bsp.h

    r6c58b6f rfe6ef776  
    2222#include <rtems.h>
    2323#include <iosupp.h>
     24#include <console.h>
     25#include <clockdrv.h>
    2426
    2527/*
     
    8991#define Is_rx_ready( _status ) ( (_status) & 0x01 )
    9092
    91 /* Timer constants: WE DON'T use THESE */
    92 
    93 #define IERA   0x106     /* Interrupt Enable Register A */
    94 #define IMRA   0x112     /* Interrupt Mask Register A */
    95 #define TACR   0x118     /* Timer A Control Register */
    96 #define TADR   0x11e     /* Timer A Data Register */
    97 
    98 #define IERB   0x108     /* Interrupt Enable Register B */
    99 #define TBCR   0x11a     /* Timer B Control Register */
    100 #define TBDR   0x120     /* Timer B Data Register */
    101 
    10293/* Structures */
    10394
  • c/src/lib/libbsp/i386/i386ex/startup/bspstart.c

    r6c58b6f rfe6ef776  
    2121 */
    2222
    23 #include <rtems.h>
    2423#include <bsp.h>
     24#include <rtems/libio.h>
     25 
    2526#include <libcsupport.h>
    26 
    27 #include <stackchk.h>
    28 
    29 #include <stdio.h>
     27 
     28#include <fcntl.h>
     29
     30#ifdef PRINTON
     31extern char inbyte(void);
    3032extern void outbyte(char);
     33#endif
    3134
    3235/*
     
    4043rtems_cpu_table Cpu_table;
    4144
     45char *rtems_progname;
     46
    4247/*      Initialize whatever libc we are using
    4348 *      called from postdriver hook
    4449 */
    45 
     50 
    4651void bsp_libc_init()
    4752{
    4853    extern int end;
    4954    rtems_unsigned32        heap_start;
    50 
     55 
    5156    heap_start = (rtems_unsigned32) &end;
    5257    if (heap_start & (CPU_ALIGNMENT-1))
    5358        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
    54 
     59 
    5560    RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
    56 
     61 
     62    /*
     63     *  Init the RTEMS libio facility to provide UNIX-like system
     64     *  calls for use by newlib (ie: provide __open, __close, etc)
     65     *  Uses malloc() to get area for the iops, so must be after malloc init
     66     */
     67 
     68    rtems_libio_init();
     69 
    5770    /*
    5871     * Set up for the libc handling.
    5972     */
    60 
     73 
    6174    if (BSP_Configuration.ticks_per_timeslice > 0)
    6275        libc_init(1);                /* reentrant if possible */
    6376    else
    6477        libc_init(0);                /* non-reentrant */
    65 
     78}
     79
     80/*
     81 *  Function:   bsp_pretasking_hook
     82 *  Created:    95/03/10
     83 *
     84 *  Description:
     85 *      BSP pretasking hook.  Called just before drivers are initialized.
     86 *      Used to setup libc and install any BSP extensions.
     87 *
     88 *  NOTES:
     89 *      Must not use libc (to do io) from here, since drivers are
     90 *      not yet initialized.
     91 *
     92 */
     93 
     94void
     95bsp_pretasking_hook(void)
     96{
     97    bsp_libc_init();
     98 
     99#ifdef STACK_CHECKER_ON
    66100    /*
    67101     *  Initialize the stack bounds checker
     102     *  We can either turn it on here or from the app.
    68103     */
    69 
    70 #ifdef STACK_CHECKER_ON
     104 
    71105    Stack_check_Initialize();
    72106#endif
    73 
    74 }
    75 extern char inbyte(void);
    76 extern void outbyte(char);
    77 
    78 int bsp_start(
     107 
     108#ifdef RTEMS_DEBUG
     109    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
     110#endif
     111}
     112
     113
     114/*
     115 * After drivers are setup, register some "filenames"
     116 * and open stdin, stdout, stderr files
     117 *
     118 * Newlib will automatically associate the files with these
     119 * (it hardcodes the numbers)
     120 */
     121 
     122void
     123bsp_postdriver_hook(void)
     124{
     125  int stdin_fd, stdout_fd, stderr_fd;
     126  int error_code;
     127 
     128  error_code = 'S' << 24 | 'T' << 16;
     129 
     130  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
     131    rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
     132 
     133  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
     134    rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
     135 
     136  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
     137    rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
     138 
     139  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
     140    rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
     141}
     142
     143
     144int main(
    79145  int argc,
    80146  char **argv,
     
    82148)
    83149{
     150
    84151#ifdef PRINTON   
    85 
    86152  outbyte('a');
    87153  outbyte('b');
    88154  outbyte('c');
    89155  outbyte ('S');
    90 
    91 #endif
     156#endif
     157
     158  if ((argc > 0) && argv && argv[0])
     159    rtems_progname = argv[0];
     160  else
     161    rtems_progname = "RTEMS";
    92162
    93163  /*
     
    95165   */
    96166
    97   Cpu_table.pretasking_hook = NULL;
    98 
    99   Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
    100 
    101   Cpu_table.postdriver_hook = NULL;   /* Call our main() for constructors */
    102 
     167  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
     168 
     169  Cpu_table.predriver_hook = NULL;
     170 
     171  Cpu_table.postdriver_hook = bsp_postdriver_hook;
     172 
    103173  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
    104 
     174 
    105175  Cpu_table.do_zero_of_workspace = TRUE;
    106 
     176 
    107177  Cpu_table.interrupt_table_segment = get_ds();
    108 
     178 
    109179  Cpu_table.interrupt_table_offset = (void *)Interrupt_descriptor_table;
    110 
     180 
    111181  Cpu_table.interrupt_stack_size = 4096;
    112 
    113   Cpu_table.extra_system_initialization_stack = 0;
     182 
     183  Cpu_table.extra_mpci_receive_server_stack = 0;
    114184
    115185  /*
     
    122192     RAM_END - BSP_Configuration.work_space_size;
    123193
    124  
    125194
    126195#ifdef SPRINTON
     
    136205   */
    137206
    138   BSP_Configuration.maximum_regions++;
     207  BSP_Configuration.RTEMS_api_configuration->maximum_regions++;
    139208
    140209  /*
     
    156225  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
    157226  /* does not return */
    158   /* no cleanup necessary for Force CPU-386 */
     227  /* no cleanup necessary for i386ex */
    159228  for (;;);  /* was return 0 to go to the debug monitor */
    160229}
Note: See TracChangeset for help on using the changeset viewer.