4.104.115
Rev | Line | |
---|
[8d6e7120] | 1 | /* |
---|
| 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 | * |
---|
| 11 | * The license and distribution terms for this file may be |
---|
| 12 | * found in the file LICENSE in this distribution or at |
---|
[94365d9] | 13 | * http://www.rtems.com/license/LICENSE. |
---|
[8d6e7120] | 14 | * |
---|
| 15 | * $Id$ |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | #include <rtems.h> |
---|
| 19 | |
---|
| 20 | #ifndef _ICM7170_MULTIPLIER |
---|
| 21 | #define _ICM7170_MULTIPLIER 1 |
---|
| 22 | #define _ICM7170_NAME(_X) _X |
---|
[a3d3d9a] | 23 | #define _ICM7170_TYPE uint8_t |
---|
[8d6e7120] | 24 | #endif |
---|
| 25 | |
---|
| 26 | #define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \ |
---|
| 27 | (_ICM7170_TYPE *)((_base) + ((_reg) * _ICM7170_MULTIPLIER )) |
---|
| 28 | |
---|
[a3d3d9a] | 29 | /* |
---|
[8d6e7120] | 30 | * ICM7170 Get Register Routine |
---|
| 31 | */ |
---|
| 32 | |
---|
[ee4f57d] | 33 | uint32_t _ICM7170_NAME(icm7170_get_register)( |
---|
| 34 | uint32_t ulCtrlPort, |
---|
| 35 | uint8_t ucRegNum |
---|
[8d6e7120] | 36 | ) |
---|
| 37 | { |
---|
| 38 | _ICM7170_TYPE *port; |
---|
| 39 | |
---|
| 40 | port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); |
---|
| 41 | |
---|
| 42 | return *port; |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | /* |
---|
| 46 | * ICM7170 Set Register Routine |
---|
| 47 | */ |
---|
| 48 | |
---|
| 49 | void _ICM7170_NAME(icm7170_set_register)( |
---|
[ee4f57d] | 50 | uint32_t ulCtrlPort, |
---|
| 51 | uint8_t ucRegNum, |
---|
| 52 | uint32_t ucData |
---|
[8d6e7120] | 53 | ) |
---|
| 54 | { |
---|
| 55 | _ICM7170_TYPE *port; |
---|
| 56 | |
---|
| 57 | port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); |
---|
| 58 | |
---|
| 59 | *port = ucData; |
---|
| 60 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.