source:
rtems/c/src/libchip/serial/z85c30_reg.c
@
74172b7d
Last change on this file since 74172b7d was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47 | |
---|---|
|
|
File size: 1.4 KB |
Rev | Line | |
---|---|---|
[8414c033] | 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 | |
[c499856] | 12 | * http://www.rtems.org/license/LICENSE. |
[8414c033] | 13 | */ |
14 | ||
15 | #include <rtems.h> | |
16 | ||
[364e8918] | 17 | #include <libchip/z85c30.h> |
18 | ||
[8414c033] | 19 | #ifndef _Z85C30_MULTIPLIER |
20 | #define _Z85C30_MULTIPLIER 1 | |
21 | #define _Z85C30_NAME(_X) _X | |
[a3d3d9a] | 22 | #define _Z85C30_TYPE uint8_t |
[8414c033] | 23 | #endif |
24 | ||
25 | /* | |
26 | * Z85C30 Get Register Routine | |
27 | */ | |
28 | ||
[ee4f57d] | 29 | uint8_t _Z85C30_NAME(z85c30_get_register)( |
[642c500] | 30 | uintptr_t ulCtrlPort, |
[ee4f57d] | 31 | uint8_t ucRegNum |
[8414c033] | 32 | ) |
33 | { | |
34 | _Z85C30_TYPE *port; | |
[ee4f57d] | 35 | uint8_t data; |
[8414c033] | 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; | |
[f246caf] | 46 | rtems_interrupt_enable(level); |
[8414c033] | 47 | |
48 | return data; | |
49 | } | |
50 | ||
51 | /* | |
52 | * Z85C30 Set Register Routine | |
53 | */ | |
54 | ||
55 | void _Z85C30_NAME(z85c30_set_register)( | |
[642c500] | 56 | uintptr_t ulCtrlPort, |
[ee4f57d] | 57 | uint8_t ucRegNum, |
58 | uint8_t ucData | |
[8414c033] | 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; | |
[f246caf] | 71 | rtems_interrupt_enable(level); |
[8414c033] | 72 | } |
Note: See TracBrowser
for help on using the repository browser.