RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
bsps
shared
dev
serial
mc68681_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 mc68681 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
37
#include <
libchip/serial.h
>
38
#include <libchip/mc68681.h>
39
40
#ifndef _MC68681_MULTIPLIER
41
#define _MC68681_MULTIPLIER 1
42
#define _MC68681_NAME(_X) _X
43
#define _MC68681_TYPE uint8_t
44
#endif
45
46
#define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \
47
(_MC68681_TYPE *)((_base) + ((_reg) * _MC68681_MULTIPLIER ))
48
49
/*
50
* MC68681 Get Register Routine
51
*/
52
53
uint8_t _MC68681_NAME(mc68681_get_register)(
54
uintptr_t ulCtrlPort,
55
uint8_t ucRegNum
56
)
57
{
58
_MC68681_TYPE *port;
59
60
port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum );
61
62
return
*port;
63
}
64
65
/*
66
* MC68681 Set Register Routine
67
*/
68
69
void
_MC68681_NAME(mc68681_set_register)(
70
uintptr_t ulCtrlPort,
71
uint8_t ucRegNum,
72
uint8_t ucData
73
)
74
{
75
_MC68681_TYPE *port;
76
77
port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum );
78
79
*port = ucData;
80
}
rtems.h
This header file defines the RTEMS Classic API.
serial.h
The generic libchip serial driver interface.
Generated by
1.18.0