Changeset b06e68ef in rtems for c/src/lib/libbsp


Ignore:
Timestamp:
08/17/95 19:51:51 (27 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
95fbca1
Parents:
3b438fa
Message:

Numerous miscellaneous features incorporated from Tony Bennett
(tbennett@…) including the following major additions:

+ variable length messages
+ named devices
+ debug monitor
+ association tables/variables

Location:
c/src/lib/libbsp
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h

    r3b438fa rb06e68ef  
    2222
    2323#include <rtems.h>
    24 #include <iosupp.h>
     24#include <clockdrv.h>
     25#include <rtems/ttydrv.h>
     26#include <libcsupport.h>
    2527
    2628/*
     
    6668
    6769/*
     70 * Todo: this should be put somewhere else
     71 */
     72
     73#undef CLOCK_DRIVER_TABLE_ENTRY
     74#define CLOCK_DRIVER_TABLE_ENTRY { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control }
     75rtems_device_driver Clock_control(
     76  rtems_device_major_number major,
     77  rtems_device_minor_number minor,
     78  void *pargp
     79);
     80
     81/*
    6882 * We printf() to a buffer if multiprocessing, *or* if this is set.
    6983 * ref: src/lib/libbsp/hppa/simhppa/iosupp/consupp.c
     
    7286extern int use_print_buffer;
    7387
     88/*
     89 * When not doing printf to a buffer, we do printf thru RTEMS libio
     90 * and our tty driver.  Set it up so that console is right.
     91 */
     92
     93#define CONSOLE_DRIVER_TABLE_ENTRY \
     94  { tty_initialize, tty_open, tty_close, tty_read, tty_write, tty_control }
     95
     96/*
     97 * How many libio files we want
     98 */
     99#define BSP_LIBIO_MAX_FDS       20
     100
    74101#define HPPA_INTERRUPT_EXTERNAL_MPCI        HPPA_INTERRUPT_EXTERNAL_10
     102
     103rtems_isr_entry set_vector(rtems_isr_entry, rtems_vector_number, int);
    75104
    76105void bsp_start( void );
  • c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c

    r3b438fa rb06e68ef  
    11/*
    2  *      @(#)bspstart.c  1.14 - 95/05/16
    3  *     
     2 *      @(#)bspstart.c  1.16 - 95/06/28
    43 */
    54
     
    2524 *  notice must appear in all copies of this file and its derivatives.
    2625 *
    27  *  bspstart.c,v 1.2 1995/05/09 20:17:33 joel Exp
    28  */
    29 
     26 *  $Id$
     27 */
     28
     29#include <rtems.h>
    3030#include <bsp.h>
     31#include <rtems/libio.h>
     32
    3133#include <libcsupport.h>
    3234
    3335#include <string.h>
     36#include <fcntl.h>
    3437
    3538#ifdef STACK_CHECKER_ON
     
    129132
    130133    /*
     134     * Init the RTEMS libio facility to provide UNIX-like system
     135     *  calls for use by newlib (ie: provide __open, __close, etc)
     136     *  Uses malloc() to get area for the iops, so must be after malloc init
     137     */
     138
     139    rtems_libio_init();
     140
     141    /*
    131142     * Set up for the libc handling.
     143     * XXX; this should allow for case of some other non-clock interrupts
    132144     */
    133145
     
    218230    Stack_check_Initialize();
    219231#endif
     232}
     233
     234/*
     235 * After drivers are setup, register some "filenames"
     236 * and open stdin, stdout, stderr files
     237 *
     238 * Newlib will automatically associate the files with these
     239 * (it hardcodes the numbers)
     240 */
     241
     242void
     243bsp_postdriver_hook(void)
     244{
     245    int stdin_fd, stdout_fd, stderr_fd;
     246   
     247    if ((stdin_fd = __open("/dev/tty00", O_RDONLY, 0)) == -1)
     248        rtems_fatal_error_occurred('STD0');
     249
     250    if ((stdout_fd = __open("/dev/tty00", O_WRONLY, 0)) == -1)
     251        rtems_fatal_error_occurred('STD1');
     252
     253    if ((stderr_fd = __open("/dev/tty00", O_WRONLY, 0)) == -1)
     254        rtems_fatal_error_occurred('STD2');
     255
     256    if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
     257        rtems_fatal_error_occurred('STIO');
    220258}
    221259
     
    290328    Cpu_table.predriver_hook = NULL;
    291329
    292     Cpu_table.postdriver_hook = NULL;
     330    Cpu_table.postdriver_hook = bsp_postdriver_hook;    /* register drivers */
    293331
    294332    Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
     
    343381
    344382#ifdef STACK_CHECKER_ON
    345   /*
    346    * Add 1 extension for stack checker
    347    */
     383    /*
     384     * Add 1 extension for stack checker
     385     */
    348386
    349387    BSP_Configuration.maximum_extensions++;
     
    351389
    352390#if SIMHPPA_FAST_IDLE
    353   /*
    354    * Add 1 extension for fast idle
    355    */
     391    /*
     392     * Add 1 extension for fast idle
     393     */
    356394
    357395    BSP_Configuration.maximum_extensions++;
    358396#endif
     397
     398    /*
     399     * Tell libio how many fd's we want and allow it to tweak config
     400     */
     401
     402    rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
    359403
    360404    /*
  • c/src/lib/libbsp/shmdr/poll.c

    r3b438fa rb06e68ef  
    1717 *  notice must appear in all copies of this file and its derivatives.
    1818 *
    19  *  poll.c,v 1.2 1995/05/09 20:22:57 joel Exp
     19 *  $Id$
    2020 */
    2121
    2222#include <rtems.h>
    2323#include <rtems/sysstate.h>
     24#include <rtems/libio.h>
     25
    2426#include "shm.h"
    25 #include "clockdrv.h"
    2627
    2728void Shm_Poll()
    2829{
    2930  rtems_unsigned32 tmpfront;
     31  rtems_libio_ioctl_args_t args;
    3032
    31   Clock_isr( 0 );             /* invoke standard clock ISR */
    32 
     33  /* invoke clock isr */
     34  args.iop = 0;
     35  args.command = rtems_build_name('I', 'S', 'R', ' ');
     36  (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args);
    3337
    3438  /*
     
    4044  if (_System_state_Is_up(_System_state_Get()))
    4145  {
    42       /* enable_tracing(); */
    43       /* ticks += 1; */
    44       Shm_Lock( Shm_Local_receive_queue );
    4546      tmpfront = Shm_Local_receive_queue->front;
    46       Shm_Unlock( Shm_Local_receive_queue );
    47       if ( Shm_Convert(tmpfront) != Shm_Locked_queue_End_of_list ) {
    48         rtems_multiprocessing_announce();
    49         Shm_Interrupt_count++;
     47      if ( Shm_Convert(tmpfront) != Shm_Locked_queue_End_of_list )
     48      {
     49          rtems_multiprocessing_announce();
     50          Shm_Interrupt_count++;
    5051      }
    5152  }
  • c/src/lib/libbsp/shmdr/setckvec.c

    r3b438fa rb06e68ef  
    2020
    2121#include <rtems.h>
     22#include <rtems/libio.h>
     23
    2224#include "shm.h"
    23 #include "clockdrv.h"
    2425
    2526rtems_isr Shm_setclockvec()
    2627{
    27   ReInstall_clock( Shm_Poll );
     28    rtems_libio_ioctl_args_t args;
     29    args.iop = 0;
     30    args.command = rtems_build_name('N', 'E', 'W', ' ');
     31    args.buffer = (void *) Shm_Poll;
     32
     33    (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args);
    2834}
  • c/src/lib/libbsp/shmdr/shm.h

    r3b438fa rb06e68ef  
    2020#ifndef __SHM_h
    2121#define __SHM_h
     22
     23#include <clockdrv.h>
    2224
    2325#ifdef __cplusplus
     
    519521rtems_mpci_table MPCI_table  = {
    520522  100000,                     /* default timeout value in ticks */
     523  MAX_PACKET_SIZE,            /* maximum packet size */
    521524  Shm_Initialization,         /* initialization procedure   */
    522525  Shm_Get_packet,             /* get packet procedure       */
  • c/src/lib/libbsp/shmdr/shm_driver.h

    r3b438fa rb06e68ef  
    2020#ifndef __SHM_h
    2121#define __SHM_h
     22
     23#include <clockdrv.h>
    2224
    2325#ifdef __cplusplus
     
    519521rtems_mpci_table MPCI_table  = {
    520522  100000,                     /* default timeout value in ticks */
     523  MAX_PACKET_SIZE,            /* maximum packet size */
    521524  Shm_Initialization,         /* initialization procedure   */
    522525  Shm_Get_packet,             /* get packet procedure       */
  • c/src/lib/libbsp/unix/posix/clock/clock.c

    r3b438fa rb06e68ef  
    11/*  Clock
    22 *
    3  *  This routine initializes the interval timer on the
    4  *  PA-RISC CPU.  The tick frequency is specified by the bsp.
     3 *  This routine generates clock ticks using standard POSIX services.
     4 *  The tick frequency is specified by the bsp.
    55 *
    66 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
     
    1616
    1717#include <rtems.h>
     18#include <rtems/libio.h>
     19#include <bsp.h>
    1820
     21/*
     22 *  In order to get the types and prototypes used in this file under
     23 *  Solaris 2.3, it is necessary to pull the following magic.
     24 */
     25 
     26#if defined(solaris)
     27#warning "Ignore the undefining __STDC__ warning"
     28#undef __STDC__
     29#define __STDC__ 0
     30#undef  _POSIX_C_SOURCE
     31#endif
     32 
    1933#include <stdlib.h>
    2034#include <stdio.h>
    2135#include <signal.h>
    2236#include <time.h>
    23 #include <sys/time.h>
    2437
    2538extern rtems_configuration_table Configuration;
    26 extern sigset_t                  UNIX_SIGNAL_MASK;
    2739
    28 /*
    29  * Function prototypes
    30  */
    31 
    32 void Install_clock();
    33 void Clock_isr();
    34 void Clock_exit();
    35 
    36 /*
    37  * CPU_HPPA_CLICKS_PER_TICK is either a #define or an rtems_unsigned32
    38  *   allocated and set by bsp_start()
    39  */
    40 
    41 #ifndef CPU_HPPA_CLICKS_PER_TICK
    42 extern rtems_unsigned32 CPU_HPPA_CLICKS_PER_TICK;
    43 #endif
     40void Clock_exit(void);
    4441
    4542volatile rtems_unsigned32 Clock_driver_ticks;
    4643
    47 struct itimerval  new;
     44/*
     45 * These are set by clock driver during its init
     46 */
    4847
    49 rtems_device_driver
    50 Clock_initialize(
    51   rtems_device_major_number major,
    52   rtems_device_minor_number minor,
    53   void *pargp,
    54   rtems_id tid,
    55   rtems_unsigned32 *rval
    56 )
    57 {
    58     Install_clock(Clock_isr);
    59 }
    60 
    61 void
    62 ReInstall_clock(rtems_isr_entry new_clock_isr)
    63 {
    64     rtems_unsigned32  isrlevel = 0;
    65 
    66     rtems_interrupt_disable(isrlevel);
    67     (void)set_vector(new_clock_isr, SIGALRM, 1);
    68     rtems_interrupt_enable(isrlevel);
    69 }
     48rtems_device_major_number rtems_clock_major = ~0;
     49rtems_device_minor_number rtems_clock_minor;
    7050
    7151void
    7252Install_clock(rtems_isr_entry clock_isr)
    7353{
     54    struct itimerval  new;
     55
    7456    Clock_driver_ticks = 0;
    7557
     
    8769
    8870void
     71ReInstall_clock(rtems_isr_entry new_clock_isr)
     72{
     73    rtems_unsigned32  isrlevel = 0;
     74
     75    rtems_interrupt_disable(isrlevel);
     76    (void)set_vector(new_clock_isr, SIGALRM, 1);
     77    rtems_interrupt_enable(isrlevel);
     78}
     79
     80void
    8981Clock_isr(int vector)
    9082{
    9183    Clock_driver_ticks++;
    92 
    9384    rtems_clock_tick();
    9485}
     
    10293Clock_exit(void)
    10394{
     95    struct itimerval  new;
    10496     struct sigaction  act;
    10597
     
    122114    (void)set_vector(0, SIGALRM, 1);
    123115}
     116
     117rtems_device_driver
     118Clock_initialize(
     119  rtems_device_major_number major,
     120  rtems_device_minor_number minor,
     121  void *pargp
     122)
     123{
     124    Install_clock((rtems_isr_entry) Clock_isr);
     125
     126    /*
     127     * make major/minor avail to others such as shared memory driver
     128     */
     129    rtems_clock_major = major;
     130    rtems_clock_minor = minor;
     131
     132    return RTEMS_SUCCESSFUL;
     133}
     134
     135rtems_device_driver Clock_control(
     136  rtems_device_major_number major,
     137  rtems_device_minor_number minor,
     138  void *pargp
     139)
     140{
     141    rtems_libio_ioctl_args_t *args = pargp;
     142
     143    if (args == 0)
     144        goto done;
     145
     146    /*
     147     * This is hokey, but until we get a defined interface
     148     * to do this, it will just be this simple...
     149     */
     150
     151    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
     152    {
     153        Clock_isr(SIGALRM);
     154    }
     155    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
     156    {
     157        ReInstall_clock(args->buffer);
     158    }
     159   
     160done:
     161    return RTEMS_SUCCESSFUL;
     162}
  • c/src/lib/libbsp/unix/posix/console/console.c

    r3b438fa rb06e68ef  
    2929console_initialize(rtems_device_major_number major,
    3030                   rtems_device_minor_number minor,
    31                    void                    * arg,
    32                    rtems_id                  self,
    33                    rtems_unsigned32        * status)
     31                   void                    * arg
     32)
    3433{
    35     *status = RTEMS_SUCCESSFUL;
     34    return RTEMS_SUCCESSFUL;
    3635}
    3736
  • c/src/lib/libbsp/unix/posix/include/bsp.h

    r3b438fa rb06e68ef  
    7979 
    8080/* #define INTERRUPT_EXTERNAL_MPCI        SIGUSR1 */
     81
     82/*
     83 * Console driver init
     84 */
     85 
     86rtems_device_driver console_initialize(
     87  rtems_device_major_number, rtems_device_minor_number minor, void *);
     88 
     89#define CONSOLE_DRIVER_TABLE_ENTRY \
     90  { console_initialize, NULL, NULL, NULL, NULL, NULL }
     91 
     92/*
     93 * NOTE: Use the standard Clock driver entry
     94 */
    8195 
    8296/* functions */
Note: See TracChangeset for help on using the changeset viewer.