Changeset 3a4ae6c in rtems for c/src/lib/libbsp/no_cpu/no_bsp


Ignore:
Timestamp:
Sep 11, 1995, 7:35:39 PM (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
ced11f99
Parents:
5072b07
Message:

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

Location:
c/src/lib/libbsp/no_cpu/no_bsp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c

    r5072b07 r3a4ae6c  
    6161rtems_isr_entry  Old_ticker;
    6262
    63 /*
    64  *  Reinstall_clock
    65  *
    66  *  Install a clock tick handler without reprogramming the chip.  This
    67  *  is used by the polling shared memory device driver.
    68  */
    69 
    70 void ReInstall_clock(
    71   rtems_isr_entry clock_isr
    72 )
    73 {
    74   rtems_unsigned32 isrlevel = 0;
    75 
    76   /*
    77    *  Disable interrupts and install the clock ISR vector using the
    78    *  BSP dependent set_vector routine.  In the below example, the clock
    79    *  ISR is on vector 4 and is an RTEMS interrupt.
    80    */
    81 
    82   rtems_interrupt_disable( isrlevel );
    83    (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
    84   rtems_interrupt_enable( isrlevel );
     63void Clock_exit( void );
     64
     65
     66/*
     67 *  Isr Handler
     68 */
     69
     70rtems_isr Clock_isr(
     71  rtems_vector_number vector
     72)
     73{
     74/*
     75 * bump the number of clock driver ticks since initialization
     76 *
     77 * determine if it is time to announce the passing of tick as configured
     78 * to RTEMS through the rtems_clock_tick directive
     79 *
     80 * perform any timer dependent tasks
     81 */
    8582}
    8683
     
    125122
    126123/*
     124 *  Reinstall_clock
     125 *
     126 *  Install a clock tick handler without reprogramming the chip.  This
     127 *  is used by the polling shared memory device driver.
     128 */
     129
     130void ReInstall_clock(
     131  rtems_isr_entry clock_isr
     132)
     133{
     134  rtems_unsigned32 isrlevel = 0;
     135
     136  /*
     137   *  Disable interrupts and install the clock ISR vector using the
     138   *  BSP dependent set_vector routine.  In the below example, the clock
     139   *  ISR is on vector 4 and is an RTEMS interrupt.
     140   */
     141
     142  rtems_interrupt_disable( isrlevel );
     143   (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
     144  rtems_interrupt_enable( isrlevel );
     145}
     146
     147/*
    127148 *  Clean up before the application exits
    128149 */
     
    150171)
    151172{
    152   Install_clock((rtems_isr_entry) Clock_isr);
    153 
     173  Install_clock( Clock_isr );
     174 
    154175  /*
    155176   * make major/minor avail to others such as shared memory driver
    156177   */
     178 
    157179  rtems_clock_major = major;
    158     rtems_clock_minor = minor;
    159 
     180  rtems_clock_minor = minor;
     181 
    160182  return RTEMS_SUCCESSFUL;
    161183}
  • c/src/lib/libbsp/no_cpu/no_bsp/console/console.c

    r5072b07 r3a4ae6c  
    1515#define NO_BSP_INIT
    1616
    17 #include <rtems.h>
    18 #include "console.h"
    19 #include "bsp.h"
     17#include <bsp.h>
     18#include <rtems/libio.h>
    2019
    2120/*  console_initialize
     
    3332  rtems_device_major_number  major,
    3433  rtems_device_minor_number  minor,
    35   void                      *arg,
    36   rtems_id                   self,
    37   rtems_unsigned32          *status
    38 )
    39 {
    40   *status = RTEMS_SUCCESSFUL;
     34  void                      *arg
     35)
     36{
     37  rtems_status_code status;
     38 
     39  status = rtems_io_register_name(
     40    "/dev/console",
     41    major,
     42    (rtems_device_minor_number) 0
     43  );
     44 
     45  if (status != RTEMS_SUCCESSFUL)
     46    rtems_fatal_error_occurred(status);
     47 
     48  return RTEMS_SUCCESSFUL;
    4149}
    4250
     
    111119}
    112120
    113 /*
    114  * __read  -- read bytes from the serial port. Ignore fd, since
    115  *            we only have stdin.
    116  */
    117 
    118 int __read(
    119   int fd,
    120   char *buf,
    121   int nbytes
    122 )
    123 {
    124   int i = 0;
    125 
    126   for (i = 0; i < nbytes; i++) {
    127     *(buf + i) = inbyte();
    128     if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
    129       (*(buf + i++)) = '\n';
    130       (*(buf + i)) = 0;
     121
     122/*
     123 *  Open entry point
     124 */
     125
     126rtems_device_driver console_open(
     127  rtems_device_major_number major,
     128  rtems_device_minor_number minor,
     129  void                    * arg
     130)
     131{
     132  return RTEMS_SUCCESSFUL;
     133}
     134 
     135/*
     136 *  Close entry point
     137 */
     138
     139rtems_device_driver console_close(
     140  rtems_device_major_number major,
     141  rtems_device_minor_number minor,
     142  void                    * arg
     143)
     144{
     145  return RTEMS_SUCCESSFUL;
     146}
     147
     148/*
     149 * read bytes from the serial port. We only have stdin.
     150 */
     151
     152rtems_device_driver console_read(
     153  rtems_device_major_number major,
     154  rtems_device_minor_number minor,
     155  void                    * arg
     156)
     157{
     158  rtems_libio_rw_args_t *rw_args;
     159  char *buffer;
     160  int maximum;
     161  int count = 0;
     162 
     163  rw_args = (rtems_libio_rw_args_t *) arg;
     164
     165  buffer = rw_args->buffer;
     166  maximum = rw_args->count;
     167
     168  for (count = 0; count < maximum; count++) {
     169    buffer[ count ] = inbyte();
     170    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
     171      buffer[ count++ ]  = '\n';
     172      buffer[ count ]  = 0;
    131173      break;
    132174    }
    133175  }
    134   return (i);
    135 }
    136 
    137 /*
    138  * __write -- write bytes to the serial port. Ignore fd, since
    139  *            stdout and stderr are the same. Since we have no filesystem,
    140  *            open will only return an error.
    141  */
    142 
    143 int __write(
    144   int fd,
    145   char *buf,
    146   int nbytes
    147 )
    148 {
    149   int i;
    150 
    151   for (i = 0; i < nbytes; i++) {
    152     if (*(buf + i) == '\n') {
    153       outbyte ('\r');
     176
     177  rw_args->bytes_moved = count;
     178  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
     179}
     180
     181/*
     182 * write bytes to the serial port. Stdout and stderr are the same.
     183 */
     184
     185rtems_device_driver console_write(
     186  rtems_device_major_number major,
     187  rtems_device_minor_number minor,
     188  void                    * arg
     189)
     190{
     191  int count;
     192  int maximum;
     193  rtems_libio_rw_args_t *rw_args;
     194  char *buffer;
     195
     196  rw_args = (rtems_libio_rw_args_t *) arg;
     197
     198  buffer = rw_args->buffer;
     199  maximum = rw_args->count;
     200
     201  for (count = 0; count < maximum; count++) {
     202    if ( buffer[ count ] == '\n') {
     203      outbyte('\r');
    154204    }
    155     outbyte (*(buf + i));
     205    outbyte( buffer[ count ] );
    156206  }
    157   return (nbytes);
    158 }
     207  return maximum;
     208}
     209
     210/*
     211 *  IO Control entry point
     212 */
     213
     214rtems_device_driver console_control(
     215  rtems_device_major_number major,
     216  rtems_device_minor_number minor,
     217  void                    * arg
     218)
     219{
     220  return RTEMS_SUCCESSFUL;
     221}
  • c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h

    r5072b07 r3a4ae6c  
    2424
    2525#include <rtems.h>
     26#include <console.h>
    2627#include <clockdrv.h>
    2728
     
    7071
    7172/*
    72  * Console driver init
     73 *  Device Driver Table Entries
    7374 */
    74  
    75 rtems_device_driver console_initialize(
    76   rtems_device_major_number, rtems_device_minor_number minor, void *);
    77  
    78 #define CONSOLE_DRIVER_TABLE_ENTRY \
    79   { console_initialize, NULL, NULL, NULL, NULL, NULL }
     75
     76/*
     77 * NOTE: Use the standard Console driver entry
     78 */
    8079 
    8180/*
    8281 * NOTE: Use the standard Clock driver entry
    8382 */
     83
     84/*
     85 * How many libio files we want
     86 */
     87
     88#define BSP_LIBIO_MAX_FDS       20
    8489
    8590/* functions */
  • c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c

    r5072b07 r3a4ae6c  
    2121 */
    2222
    23 #include <rtems.h>
    2423#include <bsp.h>
    25 #include <shm.h>
     24#include <rtems/libio.h>
     25 
    2626#include <libcsupport.h>
     27 
     28#include <string.h>
     29#include <fcntl.h>
     30 
     31#ifdef STACK_CHECKER_ON
     32#include <stackchk.h>
     33#endif
    2734
    2835/*
     
    3643
    3744rtems_cpu_table Cpu_table;
     45
     46char *rtems_progname;
    3847
    3948/*      Initialize whatever libc we are using
     
    6069
    6170    /*
     71     *  Init the RTEMS libio facility to provide UNIX-like system
     72     *  calls for use by newlib (ie: provide __open, __close, etc)
     73     *  Uses malloc() to get area for the iops, so must be after malloc init
     74     */
     75
     76    rtems_libio_init();
     77
     78    /*
    6279     * Set up for the libc handling.
    6380     */
     
    7794}
    7895
    79 int bsp_start(
     96/*
     97 * After drivers are setup, register some "filenames"
     98 * and open stdin, stdout, stderr files
     99 *
     100 * Newlib will automatically associate the files with these
     101 * (it hardcodes the numbers)
     102 */
     103 
     104void
     105bsp_postdriver_hook(void)
     106{
     107  int stdin_fd, stdout_fd, stderr_fd;
     108 
     109  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
     110    rtems_fatal_error_occurred('STD0');
     111 
     112  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
     113    rtems_fatal_error_occurred('STD1');
     114 
     115  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
     116    rtems_fatal_error_occurred('STD2');
     117 
     118  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
     119    rtems_fatal_error_occurred('STIO');
     120}
     121
     122int main(
    80123  int argc,
    81124  char **argv,
     
    83126)
    84127{
     128  if ((argc > 0) && argv && argv[0])
     129    rtems_progname = argv[0];
     130  else
     131    rtems_progname = "RTEMS";
     132
    85133  /*
    86134   *  Allocate the memory for the RTEMS Work Space.  This can come from
     
    119167#endif
    120168
     169#ifdef STACK_CHECKER_ON
     170    /*
     171     * Add 1 extension for stack checker
     172     */
     173 
     174    BSP_Configuration.maximum_extensions++;
     175#endif
     176
     177  /*
     178   * Tell libio how many fd's we want and allow it to tweak config
     179   */
     180
     181  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
     182
    121183  /*
    122184   *  Need to "allocate" the memory for the RTEMS Workspace and
     
    139201  Cpu_table.predriver_hook = bsp_libc_init;    /* RTEMS resources available */
    140202
    141   Cpu_table.postdriver_hook = NULL;
     203  Cpu_table.postdriver_hook = bsp_postdriver_hook;
    142204
    143205  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
Note: See TracChangeset for help on using the changeset viewer.