OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [libchip/] [rtc/] [icm7170_reg.c] - Blame information for rev 620

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  This file contains a typical set of register access routines which may be
3
 *  used with the icm7170 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
 *  Copyright assigned to U.S. Government, 1994.
11
 *
12
 *  The license and distribution terms for this file may be
13
 *  found in the file LICENSE in this distribution or at
14
 *  http://www.OARcorp.com/rtems/license.html.
15
 *
16
 *  $Id: icm7170_reg.c,v 1.2 2001-09-27 12:01:42 chris Exp $
17
 */
18
 
19
#include <rtems.h>
20
 
21
#ifndef _ICM7170_MULTIPLIER
22
#define _ICM7170_MULTIPLIER 1
23
#define _ICM7170_NAME(_X) _X
24
#define _ICM7170_TYPE unsigned8
25
#endif
26
 
27
#define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \
28
  (_ICM7170_TYPE *)((_base) + ((_reg) * _ICM7170_MULTIPLIER ))
29
 
30
/*
31
 *  ICM7170 Get Register Routine
32
 */
33
 
34
unsigned32 _ICM7170_NAME(icm7170_get_register)(
35
  unsigned32  ulCtrlPort,
36
  unsigned8   ucRegNum
37
)
38
{
39
  _ICM7170_TYPE *port;
40
 
41
  port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum );
42
 
43
  return *port;
44
}
45
 
46
/*
47
 *  ICM7170 Set Register Routine
48
 */
49
 
50
void  _ICM7170_NAME(icm7170_set_register)(
51
  unsigned32  ulCtrlPort,
52
  unsigned8   ucRegNum,
53
  unsigned32  ucData
54
)
55
{
56
  _ICM7170_TYPE *port;
57
 
58
  port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum );
59
 
60
  *port = ucData;
61
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.