source: rtems/c/src/lib/libbsp/i386/pc386/console/rtd316.c @ 4977f07e

4.11
Last change on this file since 4977f07e was 4977f07e, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 9, 2014 at 5:56:18 PM

i386/pc386: Eliminate multiple warnings

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Driver for RTD316 ISA SCC Board
5 *
6 *  The RTD316 has a single Z85C30.
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2014.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#include <bsp.h>
19#include <termios.h>
20#include <stdio.h>
21#include <stdlib.h>
22
23#include <rtems/termiostypes.h>
24#include <libchip/serial.h>
25#include <libchip/z85c30.h>
26#include <rtems/bspIo.h>
27#include <bsp/rtd316.h>
28#include <rtems/score/i386.h>
29#include <rtems/console_private.h>
30
31#define RTD_CLOCK_RATE  (460800 * 32)
32
33uint8_t rtd316_com_get_register(uint32_t addr, uint8_t reg)
34{
35  register uint8_t val = 0;
36
37  outport_byte( addr, reg );
38  /* It appears the no delay is needed between the accesses. */
39  inport_byte( addr, val );
40
41  return val;
42}
43
44void rtd316_com_set_register(uint32_t addr,uint8_t reg, uint8_t val)
45{
46  outport_byte( addr, reg );
47  /* It appears the no delay is needed between the accesses. */
48  outport_byte( addr, val );
49}
50
51rtems_device_driver rtd316_initialize(
52  rtems_device_major_number  major,
53  rtems_device_minor_number  minor_arg,
54  void                      *arg
55)
56{
57  int           p;
58  console_tbl  *ports;
59  console_tbl  *port_p;
60
61  /*
62   *  Now allocate array of device structures and fill them in
63   */
64  ports = calloc( 2, sizeof( console_tbl ) );
65  port_p = ports;
66
67  for ( p=0 ; p<2 ; p++ ) {
68    char name[32];
69    sprintf( name, "/dev/rtd316_1_%d", p );
70    printk("Found %s\n", name );
71    port_p->sDeviceName   = strdup( name );
72    port_p->deviceType    = SERIAL_Z85C30;
73    #if 0
74      port_p->pDeviceFns  = &z85c30_fns_polled;
75    #else
76      port_p->pDeviceFns  = &z85c30_fns;
77    #endif
78
79    port_p->deviceProbe   = NULL;
80    port_p->pDeviceFlow   = NULL;
81    port_p->ulMargin      = 16;
82    port_p->ulHysteresis  = 8;
83    port_p->pDeviceParams = (void *) 9600;
84    port_p->getRegister   = rtd316_com_get_register;
85    port_p->setRegister   = rtd316_com_set_register;
86    port_p->getData       = NULL;
87    port_p->setData       = NULL;
88    port_p->ulClock       = RTD_CLOCK_RATE;
89    port_p->ulIntVector   = 9;
90
91    if ( p==0 ) {
92      port_p->ulDataPort    = 0;
93      port_p->ulCtrlPort1   = 0x340;
94      port_p->ulCtrlPort2   = 0x341;
95    } else {
96      port_p->ulDataPort    = 1;
97      port_p->ulCtrlPort1   = 0x342;
98      port_p->ulCtrlPort2   = 0x343;
99    }
100    port_p++;
101  }  /* end ports */
102
103  /*
104   *  Register the devices
105   */
106  console_register_devices( ports, 2 );
107
108  return RTEMS_SUCCESSFUL;
109}
Note: See TracBrowser for help on using the repository browser.