4.104.115
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 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.com/license/LICENSE. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #include <rtems.h> |
---|
18 | |
---|
19 | #ifndef _Z85C30_MULTIPLIER |
---|
20 | #define _Z85C30_MULTIPLIER 1 |
---|
21 | #define _Z85C30_NAME(_X) _X |
---|
22 | #define _Z85C30_TYPE uint8_t |
---|
23 | #endif |
---|
24 | |
---|
25 | /* |
---|
26 | * Z85C30 Get Register Routine |
---|
27 | */ |
---|
28 | |
---|
29 | uint8_t _Z85C30_NAME(z85c30_get_register)( |
---|
30 | uint32_t ulCtrlPort, |
---|
31 | uint8_t ucRegNum |
---|
32 | ) |
---|
33 | { |
---|
34 | _Z85C30_TYPE *port; |
---|
35 | uint8_t data; |
---|
36 | rtems_interrupt_level level; |
---|
37 | |
---|
38 | port = (_Z85C30_TYPE *)ulCtrlPort; |
---|
39 | |
---|
40 | rtems_interrupt_disable(level); |
---|
41 | |
---|
42 | if(ucRegNum) { |
---|
43 | *port = ucRegNum; |
---|
44 | } |
---|
45 | data = *port; |
---|
46 | rtems_interrupt_enable(level); |
---|
47 | |
---|
48 | return data; |
---|
49 | } |
---|
50 | |
---|
51 | /* |
---|
52 | * Z85C30 Set Register Routine |
---|
53 | */ |
---|
54 | |
---|
55 | void _Z85C30_NAME(z85c30_set_register)( |
---|
56 | uint32_t ulCtrlPort, |
---|
57 | uint8_t ucRegNum, |
---|
58 | uint8_t ucData |
---|
59 | ) |
---|
60 | { |
---|
61 | _Z85C30_TYPE *port; |
---|
62 | rtems_interrupt_level level; |
---|
63 | |
---|
64 | port = (_Z85C30_TYPE *)ulCtrlPort; |
---|
65 | |
---|
66 | rtems_interrupt_disable(level); |
---|
67 | if(ucRegNum) { |
---|
68 | *port = ucRegNum; |
---|
69 | } |
---|
70 | *port = ucData; |
---|
71 | rtems_interrupt_enable(level); |
---|
72 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.