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 | |
---|
30 | unsigned8 _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 | |
---|
56 | void _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 | |
---|
80 | unsigned8 _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 | |
---|
94 | void _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 | } |
---|