source: rtems/c/src/libchip/serial/z85c30_reg.c @ 849dc107

4.104.114.84.95
Last change on this file since 849dc107 was 8414c033, checked in by Joel Sherrill <joel.sherrill@…>, on 07/15/98 at 23:54:24

Added default z85c30 register access routines.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  This file contains a typical set of register access routines which may be
3 *  used with the z85c30 chip if accesses to the chip are as follows:
4 *
5 *    + registers are accessed as bytes
6 *
7 *  COPYRIGHT (c) 1989-1997.
8 *  On-Line Applications Research Corporation (OAR).
9 *  Copyright assigned to U.S. Government, 1994.
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.OARcorp.com/rtems/license.html.
14 *
15 *  $Id$
16 */
17
18#include <rtems.h>
19
20#ifndef _Z85C30_MULTIPLIER
21#define _Z85C30_MULTIPLIER 1
22#define _Z85C30_NAME(_X) _X
23#define _Z85C30_TYPE unsigned8
24#endif
25
26/*
27 *  Z85C30 Get Register Routine
28 */
29
30unsigned8 _Z85C30_NAME(z85c30_get_register)(
31  unsigned32  ulCtrlPort,
32  unsigned8   ucRegNum
33)
34{
35  _Z85C30_TYPE          *port;
36  unsigned8              data;
37  rtems_interrupt_level  level;
38
39  port = (_Z85C30_TYPE *)ulCtrlPort;
40
41  rtems_interrupt_disable(level);
42
43    if(ucRegNum) {
44      *port = ucRegNum;
45    }
46    data = *port;
47  rtems_interrupt_disable(level);
48
49  return data;
50}
51
52/*
53 *  Z85C30 Set Register Routine
54 */
55
56void _Z85C30_NAME(z85c30_set_register)(
57  unsigned32  ulCtrlPort,
58  unsigned8   ucRegNum,
59  unsigned8   ucData
60)
61{
62  _Z85C30_TYPE          *port;
63  rtems_interrupt_level  level;
64
65  port = (_Z85C30_TYPE *)ulCtrlPort;
66
67  rtems_interrupt_disable(level);
68    if(ucRegNum) {
69      *port = ucRegNum;
70    }
71    *port = ucData;
72  rtems_interrupt_disable(level);
73}
74
75
76/*
77 *  Z85C30 Get Data Routine
78 */
79
80unsigned8 _Z85C30_NAME(z85c30_get_data)(
81  unsigned32  ulDataPort
82)
83{
84  _Z85C30_TYPE *port;
85
86  port = (_Z85C30_TYPE *)ulDataPort;
87  return *port;
88}
89
90/*
91 *  Z85C30 Set Data Routine
92 */
93
94void _Z85C30_NAME(z85c30_set_data)(
95  unsigned32  ulDataPort,
96  unsigned8   ucData
97)
98{
99  _Z85C30_TYPE *port;
100
101  port = (_Z85C30_TYPE *)ulDataPort;
102  *port = ucData;
103}
Note: See TracBrowser for help on using the repository browser.