source: rtems/c/src/libchip/serial/mc68681_reg.c @ aa314cf

4.115
Last change on this file since aa314cf was f806289, checked in by Andreas Heinig <andreas.heinig@…>, on 02/27/13 at 13:38:57

libchip/serial: Fixed warnings

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  This file contains a typical set of register access routines which may be
3 *  used with the mc68681 chip if accesses to the chip are as follows:
4 *
5 *    + registers are accessed as bytes
6 *    + registers are only byte-aligned (no address gaps)
7 *
8 *  COPYRIGHT (c) 1989-1997.
9 *  On-Line Applications Research Corporation (OAR).
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.rtems.com/license/LICENSE.
14 */
15
16#include <rtems.h>
17
18#include <libchip/serial.h>
19#include <libchip/mc68681.h>
20
21#ifndef _MC68681_MULTIPLIER
22#define _MC68681_MULTIPLIER 1
23#define _MC68681_NAME(_X) _X
24#define _MC68681_TYPE uint8_t
25#endif
26
27#define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \
28  (_MC68681_TYPE *)((_base) + ((_reg) * _MC68681_MULTIPLIER ))
29
30/*
31 *  MC68681 Get Register Routine
32 */
33
34uint8_t   _MC68681_NAME(mc68681_get_register)(
35  uintptr_t   ulCtrlPort,
36  uint8_t     ucRegNum
37)
38{
39  _MC68681_TYPE *port;
40
41  port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum );
42
43  return *port;
44}
45
46/*
47 *  MC68681 Set Register Routine
48 */
49
50void  _MC68681_NAME(mc68681_set_register)(
51  uintptr_t   ulCtrlPort,
52  uint8_t     ucRegNum,
53  uint8_t     ucData
54)
55{
56  _MC68681_TYPE *port;
57
58  port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum );
59
60  *port = ucData;
61}
Note: See TracBrowser for help on using the repository browser.