RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
bsps
shared
dev
rtc
icm7170_reg.c
1
/* SPDX-License-Identifier: BSD-2-Clause */
2
3
/*
4
* This file contains a typical set of register access routines which may be
5
* used with the icm7170 chip if accesses to the chip are as follows:
6
*
7
* + registers are accessed as bytes
8
* + registers are only byte-aligned (no address gaps)
9
*
10
* COPYRIGHT (c) 1989-1997.
11
* On-Line Applications Research Corporation (OAR).
12
*
13
* Redistribution and use in source and binary forms, with or without
14
* modification, are permitted provided that the following conditions
15
* are met:
16
* 1. Redistributions of source code must retain the above copyright
17
* notice, this list of conditions and the following disclaimer.
18
* 2. Redistributions in binary form must reproduce the above copyright
19
* notice, this list of conditions and the following disclaimer in the
20
* documentation and/or other materials provided with the distribution.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
* POSSIBILITY OF SUCH DAMAGE.
33
*/
34
35
#include <
rtems.h
>
36
#include <libchip/rtc.h>
37
#include <libchip/icm7170.h>
38
39
#ifndef _ICM7170_MULTIPLIER
40
#define _ICM7170_MULTIPLIER 1
41
#define _ICM7170_NAME(_X) _X
42
#define _ICM7170_TYPE uint8_t
43
#endif
44
45
#define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \
46
(_ICM7170_TYPE *)((_base) + ((_reg) * _ICM7170_MULTIPLIER ))
47
48
/*
49
* ICM7170 Get Register Routine
50
*/
51
52
uint32_t _ICM7170_NAME(icm7170_get_register)(
53
uintptr_t ulCtrlPort,
54
uint8_t ucRegNum
55
)
56
{
57
_ICM7170_TYPE *port;
58
59
port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum );
60
61
return
*port;
62
}
63
64
/*
65
* ICM7170 Set Register Routine
66
*/
67
68
void
_ICM7170_NAME(icm7170_set_register)(
69
uintptr_t ulCtrlPort,
70
uint8_t ucRegNum,
71
uint32_t ucData
72
)
73
{
74
_ICM7170_TYPE *port;
75
76
port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum );
77
78
*port = ucData;
79
}
rtems.h
This header file defines the RTEMS Classic API.
Generated by
1.18.0