RTEMS
6.1-rc5
Loading...
Searching...
No Matches
bsps
include
grlib
grctm.h
1
/* SPDX-License-Identifier: BSD-2-Clause */
2
3
/* GRCTM - CCSDS Time Manager - register driver interface.
4
*
5
* COPYRIGHT (c) 2009.
6
* Cobham Gaisler AB
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions
10
* are met:
11
* 1. Redistributions of source code must retain the above copyright
12
* notice, this list of conditions and the following disclaimer.
13
* 2. Redistributions in binary form must reproduce the above copyright
14
* notice, this list of conditions and the following disclaimer in the
15
* documentation and/or other materials provided with the distribution.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
* POSSIBILITY OF SUCH DAMAGE.
28
*/
29
30
#ifndef __GRCTM_H__
31
#define __GRCTM_H__
32
33
#define DAT0_IRQ 0x1
34
#define DAT1_IRQ 0x2
35
#define DAT2_IRQ 0x4
36
#define PULSE0_IRQ 0x10
37
#define PULSE1_IRQ 0x20
38
#define PULSE2_IRQ 0x40
39
#define PULSE3_IRQ 0x80
40
#define PULSE4_IRQ 0x100
41
#define PULSE5_IRQ 0x200
42
#define PULSE6_IRQ 0x400
43
#define PULSE7_IRQ 0x800
44
45
struct
grctm_regs
{
46
volatile
unsigned
int
grr;
47
volatile
unsigned
int
gcr;
48
volatile
unsigned
int
gsr;
49
volatile
unsigned
int
unused[2];
50
volatile
unsigned
int
pfr;
51
volatile
unsigned
int
etcr;
52
volatile
unsigned
int
etfr;
53
volatile
unsigned
int
dcr0;
54
volatile
unsigned
int
dfr0;
55
volatile
unsigned
int
dcr1;
56
volatile
unsigned
int
dfr1;
57
volatile
unsigned
int
dcr2;
58
volatile
unsigned
int
dfr2;
59
volatile
unsigned
int
stcr;
60
volatile
unsigned
int
stfr;
61
volatile
unsigned
int
pdr[8];
62
volatile
unsigned
int
pimsr;
63
volatile
unsigned
int
pimr;
64
volatile
unsigned
int
pisr;
65
volatile
unsigned
int
pir;
66
volatile
unsigned
int
imr;
67
volatile
unsigned
int
picr;
68
volatile
unsigned
int
unused1[2];
69
volatile
unsigned
int
etir;
70
volatile
unsigned
int
fsir;
71
volatile
unsigned
int
serconf;
72
volatile
unsigned
int
unused2;
73
volatile
unsigned
int
twsc;
74
volatile
unsigned
int
twadj;
75
volatile
unsigned
int
twtx;
76
volatile
unsigned
int
twrx;
77
};
78
79
struct
grctm_stats
{
80
81
/* IRQ Stats */
82
unsigned
int
nirqs;
83
unsigned
int
pulse;
84
};
85
86
/* Function ISR callback prototype */
87
typedef
void (*grctm_isr_t)(
unsigned
int
pimr,
void
*data);
88
89
/* Open a GRCTM device by minor number. */
90
extern
void
*grctm_open(
int
minor);
91
92
/* Close a previously opened GRCTM device */
93
extern
void
grctm_close(
void
*spwcuc);
94
95
/* Hardware Reset of GRCTM */
96
extern
int
grctm_reset(
void
*grctm);
97
98
/* Enable Interrupts at Interrupt controller */
99
extern
void
grctm_int_enable(
void
*grctm);
100
101
/* Disable Interrupts at Interrupt controller */
102
extern
void
grctm_int_disable(
void
*grctm);
103
104
/* Clear Statistics gathered by the driver */
105
extern
void
grctm_clr_stats(
void
*grctm);
106
107
/* Get Statistics gathered by the driver */
108
extern
void
grctm_get_stats(
void
*grctm,
struct
grctm_stats
*stats);
109
110
/* Register an Interrupt handler and custom data, the function call is
111
* removed by setting func to NULL.
112
*/
113
extern
void
grctm_int_register(
void
*grctm, grctm_isr_t func,
void
*data);
114
115
/* Enable external synchronisation (from spwcuc) */
116
extern
void
grctm_enable_ext_sync(
void
*grctm);
117
118
/* Disable external synchronisation (from spwcuc) */
119
extern
void
grctm_disable_ext_sync(
void
*grctm);
120
121
/* Enable TimeWire synchronisation */
122
extern
void
grctm_enable_tw_sync(
void
*grctm);
123
124
/* Disable TimeWire synchronisation */
125
extern
void
grctm_disable_tw_sync(
void
*grctm);
126
127
/* Disable frequency synthesizer from driving ET */
128
extern
void
grctm_disable_fs(
void
*grctm);
129
130
/* Enable frequency synthesizer to drive ET */
131
extern
void
grctm_enable_fs(
void
*grctm);
132
133
/* Return elapsed coarse time */
134
extern
unsigned
int
grctm_get_et_coarse(
void
*grctm);
135
136
/* Return elapsed fine time */
137
extern
unsigned
int
grctm_get_et_fine(
void
*grctm);
138
139
/* Return elapsed time (coarse and fine) */
140
extern
unsigned
long
long
grctm_get_et(
void
*grctm);
141
142
/* Return 1 if specified datation has been latched */
143
extern
int
grctm_is_dat_latched(
void
*grctm,
int
dat);
144
145
/* Set triggering edge of datation input */
146
extern
void
grctm_set_dat_edge(
void
*grctm,
int
dat,
int
edge);
147
148
/* Return latched datation coarse time */
149
extern
unsigned
int
grctm_get_dat_coarse(
void
*grctm,
int
dat);
150
151
/* Return latched datation fine time */
152
extern
unsigned
int
grctm_get_dat_fine(
void
*grctm,
int
dat);
153
154
/* Return latched datation ET */
155
extern
unsigned
long
long
grctm_get_dat_et(
void
*grctm,
int
dat);
156
157
/* Return current pulse configuration */
158
extern
unsigned
int
grctm_get_pulse_reg(
void
*grctm,
int
pulse);
159
160
/* Set pulse register */
161
extern
void
grctm_set_pulse_reg(
void
*grctm,
int
pulse,
unsigned
int
val);
162
163
/* Configure pulse: pp = period, pw = width, pl = level, en = enable */
164
extern
void
grctm_cfg_pulse(
void
*grctm,
int
pulse,
int
pp,
int
pw,
int
pl,
int
en);
165
166
/* Enable pulse output */
167
extern
void
grctm_enable_pulse(
void
*grctm,
int
pulse);
168
169
/* Disable pulse output */
170
extern
void
grctm_disable_pulse(
void
*grctm,
int
pulse);
171
172
/* Clear interrupts */
173
extern
void
grctm_clear_irqs(
void
*grctm,
int
irqs);
174
175
/* Enable interrupts */
176
extern
void
grctm_enable_irqs(
void
*grctm,
int
irqs);
177
178
/* Set Frequency synthesizer increment */
179
void
grctm_set_fs_incr(
void
*grctm,
int
incr);
180
181
/* Set ET increment */
182
void
grctm_set_et_incr(
void
*grctm,
int
incr);
183
184
/* Get register base address */
185
struct
grctm_regs
*grctm_get_regs(
void
*grctm);
186
187
/* Register the GRCTM driver to Driver Manager */
188
extern
void
grctm_register(
void
);
189
190
#endif
grctm_regs
Definition:
grctm.h:45
grctm_stats
Definition:
grctm.h:79
Generated by
1.9.6