Changeset 3a4ae6c in rtems for c/src/lib/libbsp/m68k/mvme162


Ignore:
Timestamp:
09/11/95 19:35:39 (28 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/m68k/mvme162
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c

    r5072b07 r3a4ae6c  
    2828#include <stdlib.h>
    2929
    30 #include <rtems.h>
    3130#include <bsp.h>
    32 #include <clockdrv.h>
     31#include <rtems/libio.h>
    3332
    3433#define MS_COUNT          1000            /* T2's countdown constant (1 ms) */
     
    3938rtems_isr_entry  Old_ticker;
    4039
    41 rtems_device_driver Clock_initialize(
    42   rtems_device_major_number major,
    43   rtems_device_minor_number minor,
    44   void *pargp,
    45   rtems_id tid,
    46   rtems_unsigned32 *rval
    47 )
     40void Clock_exit( void );
     41 
     42#define CLOCK_VECTOR (VBR0 * 0x10 + 0x9)
     43/*
     44 * These are set by clock driver during its init
     45 */
     46 
     47rtems_device_major_number rtems_clock_major = ~0;
     48rtems_device_minor_number rtems_clock_minor;
     49 
     50
     51/*
     52 *  ISR Handler
     53 */
     54
     55rtems_isr Clock_isr(rtems_vector_number vector)
    4856{
    49   Install_clock( Clock_isr );
    50 }
     57  Clock_driver_ticks += 1;
     58  lcsr->timer_cnt_2 = 0;            /* clear counter */
     59  lcsr->intr_clear |= 0x02000000;
    5160
    52 void ReInstall_clock(rtems_isr_entry clock_isr)
    53 {
    54   rtems_unsigned32 isrlevel;
    55 
    56   rtems_interrupt_disable( isrlevel );
    57   (void) set_vector( clock_isr, VBR0 * 0x10 + 0x9, 1 );
    58   rtems_interrupt_enable( isrlevel );
     61  if ( Clock_isrs == 1 ) {
     62    rtems_clock_tick();
     63    Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
     64  }
     65  else
     66    Clock_isrs -= 1;
    5967}
    6068
     
    6775  if ( BSP_Configuration.ticks_per_timeslice ) {
    6876    Old_ticker =
    69       (rtems_isr_entry) set_vector( clock_isr, VBR0 * 0x10 + 0x9, 1 );
     77      (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
    7078    lcsr->vector_base |= MASK_INT;   /* unmask VMEchip2 interrupts */
    7179    lcsr->to_ctl = 0xE7;             /* prescaler to 1 MHz (see Appendix A1) */
     
    8088    atexit( Clock_exit );
    8189  }
     90}
    8291
     92void ReInstall_clock(rtems_isr_entry clock_isr)
     93{
     94  rtems_unsigned32 isrlevel;
     95
     96  rtems_interrupt_disable( isrlevel );
     97  (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
     98  rtems_interrupt_enable( isrlevel );
    8399}
    84100
     
    87103/* Dummy for now. See other m68k BSP's for code examples */
    88104}
     105
     106rtems_device_driver Clock_initialize(
     107  rtems_device_major_number major,
     108  rtems_device_minor_number minor,
     109  void *pargp
     110)
     111{
     112  Install_clock( Clock_isr );
     113 
     114  /*
     115   * make major/minor avail to others such as shared memory driver
     116   */
     117 
     118  rtems_clock_major = major;
     119  rtems_clock_minor = minor;
     120 
     121  return RTEMS_SUCCESSFUL;
     122}
     123 
     124rtems_device_driver Clock_control(
     125  rtems_device_major_number major,
     126  rtems_device_minor_number minor,
     127  void *pargp
     128)
     129{
     130    rtems_libio_ioctl_args_t *args = pargp;
     131 
     132    if (args == 0)
     133        goto done;
     134 
     135    /*
     136     * This is hokey, but until we get a defined interface
     137     * to do this, it will just be this simple...
     138     */
     139 
     140    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
     141    {
     142        Clock_isr(CLOCK_VECTOR);
     143    }
     144    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
     145    {
     146        ReInstall_clock(args->buffer);
     147    }
     148 
     149done:
     150    return RTEMS_SUCCESSFUL;
     151}
     152
  • c/src/lib/libbsp/m68k/mvme162/console/console.c

    r5072b07 r3a4ae6c  
    2222#define M162_INIT
    2323
    24 #include <rtems.h>
    25 #include "console.h"
    26 #include "bsp.h"
    27 #include "ringbuf.h"
     24#include <bsp.h>
     25#include <rtems/libio.h>
     26#include <ringbuf.h>
    2827
    2928Ring_buffer_t  Buffer[2];
     
    5554  rtems_device_major_number  major,
    5655  rtems_device_minor_number  minor,
    57   void                      *arg,
    58   rtems_id                   self,
    59   rtems_unsigned32          *status
     56  void                      *arg
    6057)
    6158{
    6259  int     i;
     60  rtems_status_code status;
    6361 
    6462  /*
     
    8078  mcchip->SCC_int_ctl = 0x13;     /* SCC IEN, IPL3 */
    8179
    82   *status = RTEMS_SUCCESSFUL;
     80  status = rtems_io_register_name(
     81    "/dev/console",
     82    major,
     83    (rtems_device_minor_number) 0
     84  );
     85 
     86  if (status != RTEMS_SUCCESSFUL)
     87    rtems_fatal_error_occurred(status);
     88 
     89  status = rtems_io_register_name(
     90    "/dev/tty00",
     91    major,
     92    (rtems_device_minor_number) 0
     93  );
     94 
     95  if (status != RTEMS_SUCCESSFUL)
     96    rtems_fatal_error_occurred(status);
     97 
     98  status = rtems_io_register_name(
     99    "/dev/tty01",
     100    major,
     101    (rtems_device_minor_number) 0
     102  );
     103 
     104  if (status != RTEMS_SUCCESSFUL)
     105    rtems_fatal_error_occurred(status);
     106 
     107  return RTEMS_SUCCESSFUL;
    83108}
    84109
     
    101126 */
    102127
    103 char char_wait(int port)
     128char inbyte(int port)
    104129{
    105130  unsigned char tmp_char;
     
    114139 */
    115140
    116 void char_put(int port, char ch)
     141void outbyte(int port, char ch)
    117142{
    118143  while (1) {
     
    123148
    124149/*
    125  *    Map port A (1) to stdin, stdout, and stderr.
    126  *    Map everything else to port B (0).
    127  */
    128 
    129 int __read(int fd, char *buf, int nbytes)
    130 {
    131   int i, port;
    132 
    133   if ( fd <= 2 ) port = 1;
    134   else           port = 0;
    135 
    136   for (i = 0; i < nbytes; i++) {
    137     *(buf + i) = char_wait(port);
    138     if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
    139       (*(buf + i++)) = '\n';
    140       (*(buf + i)) = 0;
     150 *  Open entry point
     151 */
     152
     153rtems_device_driver console_open(
     154  rtems_device_major_number major,
     155  rtems_device_minor_number minor,
     156  void                    * arg
     157)
     158{
     159  return RTEMS_SUCCESSFUL;
     160}
     161 
     162/*
     163 *  Close entry point
     164 */
     165
     166rtems_device_driver console_close(
     167  rtems_device_major_number major,
     168  rtems_device_minor_number minor,
     169  void                    * arg
     170)
     171{
     172  return RTEMS_SUCCESSFUL;
     173}
     174
     175/*
     176 * read bytes from the serial port. We only have stdin.
     177 */
     178
     179rtems_device_driver console_read(
     180  rtems_device_major_number major,
     181  rtems_device_minor_number minor,
     182  void                    * arg
     183)
     184{
     185  rtems_libio_rw_args_t *rw_args;
     186  char *buffer;
     187  int maximum;
     188  int count = 0;
     189 
     190  rw_args = (rtems_libio_rw_args_t *) arg;
     191
     192  buffer = rw_args->buffer;
     193  maximum = rw_args->count;
     194
     195  if ( minor > 1 )
     196    return RTEMS_INVALID_NUMBER;
     197
     198  for (count = 0; count < maximum; count++) {
     199    buffer[ count ] = inbyte( minor );
     200    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
     201      buffer[ count++ ]  = '\n';
     202      buffer[ count ]  = 0;
    141203      break;
    142204    }
    143205  }
    144   return (i);
    145 }
    146 
    147 /*
    148  *  Map port A (1) to stdin, stdout, and stderr.
    149  *  Map everything else to port B (0).
    150  */
    151 
    152 int __write(int fd, char *buf, int nbytes)
    153 {
    154   int i, port;
    155  
    156   if ( fd <= 2 ) port = 1;
    157   else           port = 0;
    158  
    159   for (i = 0; i < nbytes; i++) {
    160     if (*(buf + i) == '\n') {
    161       char_put (port, '\r');
     206
     207  rw_args->bytes_moved = count;
     208  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
     209}
     210
     211/*
     212 * write bytes to the serial port. Stdout and stderr are the same.
     213 */
     214
     215rtems_device_driver console_write(
     216  rtems_device_major_number major,
     217  rtems_device_minor_number minor,
     218  void                    * arg
     219)
     220{
     221  int count;
     222  int maximum;
     223  rtems_libio_rw_args_t *rw_args;
     224  char *buffer;
     225
     226  rw_args = (rtems_libio_rw_args_t *) arg;
     227
     228  buffer = rw_args->buffer;
     229  maximum = rw_args->count;
     230
     231  if ( minor > 1 )
     232    return RTEMS_INVALID_NUMBER;
     233
     234  for (count = 0; count < maximum; count++) {
     235    if ( buffer[ count ] == '\n') {
     236      outbyte('\r', minor );
    162237    }
    163     char_put (port, *(buf + i));
    164   }
    165   return (nbytes);
    166 }
     238    outbyte( buffer[ count ], minor  );
     239  }
     240  return maximum;
     241}
     242
     243/*
     244 *  IO Control entry point
     245 */
     246
     247rtems_device_driver console_control(
     248  rtems_device_major_number major,
     249  rtems_device_minor_number minor,
     250  void                    * arg
     251)
     252{
     253  return RTEMS_SUCCESSFUL;
     254}
  • c/src/lib/libbsp/m68k/mvme162/include/bsp.h

    r5072b07 r3a4ae6c  
    2929
    3030#include <rtems.h>
     31#include <clockdrv.h>
     32#include <console.h>
    3133#include <iosupp.h>
    3234
     
    249251#endif
    250252
     253/*
     254 *  Device Driver Table Entries
     255 */
     256
     257/*
     258 * NOTE: Use the standard Console driver entry
     259 */
     260 
     261/*
     262 * NOTE: Use the standard Clock driver entry
     263 */
     264
     265/*
     266 * How many libio files we want
     267 */
     268
     269#define BSP_LIBIO_MAX_FDS       20
     270
    251271/* miscellaneous stuff assumed to exist */
    252272
  • c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c

    r5072b07 r3a4ae6c  
    2828 */
    2929
    30 #include <rtems.h>
    3130#include <bsp.h>
     31#include <rtems/libio.h>
     32 
    3233#include <libcsupport.h>
    33 #include <z8036.h>
     34 
     35#include <string.h>
     36#include <fcntl.h>
     37 
     38#ifdef STACK_CHECKER_ON
     39#include <stackchk.h>
     40#endif
    3441
    3542/*
     
    4249
    4350rtems_cpu_table Cpu_table;
     51
     52char *rtems_progname;
    4453
    4554/*      Initialize whatever libc we are using
     
    5968
    6069    /*
     70     *  Init the RTEMS libio facility to provide UNIX-like system
     71     *  calls for use by newlib (ie: provide __open, __close, etc)
     72     *  Uses malloc() to get area for the iops, so must be after malloc init
     73     */
     74
     75    rtems_libio_init();
     76
     77    /*
    6178     * Set up for the libc handling.
    6279     */
     
    7693}
    7794
    78 int bsp_start(
     95/*
     96 * After drivers are setup, register some "filenames"
     97 * and open stdin, stdout, stderr files
     98 *
     99 * Newlib will automatically associate the files with these
     100 * (it hardcodes the numbers)
     101 */
     102 
     103void
     104bsp_postdriver_hook(void)
     105{
     106  int stdin_fd, stdout_fd, stderr_fd;
     107 
     108  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
     109    rtems_fatal_error_occurred('STD0');
     110 
     111  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
     112    rtems_fatal_error_occurred('STD1');
     113 
     114  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
     115    rtems_fatal_error_occurred('STD2');
     116 
     117  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
     118    rtems_fatal_error_occurred('STIO');
     119}
     120
     121int main(
    79122  int argc,
    80123  char **argv,
     
    85128  int             index;
    86129
     130  if ((argc > 0) && argv && argv[0])
     131    rtems_progname = argv[0];
     132  else
     133    rtems_progname = "RTEMS";
     134
    87135  /*
    88136   *  162Bug Vectors are at 0xFFE00000
     
    122170  Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
    123171
    124   Cpu_table.postdriver_hook = NULL;   /* Call our main() for constructors */
     172  Cpu_table.postdriver_hook = bsp_postdriver_hook;
    125173
    126174  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
     
    162210#endif
    163211
     212  /*
     213   * Tell libio how many fd's we want and allow it to tweak config
     214   */
     215
     216  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
     217
    164218  BSP_Configuration.work_space_start = (void *)
    165219     (RAM_END - BSP_Configuration.work_space_size);
Note: See TracChangeset for help on using the changeset viewer.