RTEMS 6.1-rc4
Loading...
Searching...
No Matches
satcan.h
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * Header file for RTEMS SATCAN FPGA driver
5 *
6 * COPYRIGHT (c) 2009.
7 * Cobham Gaisler AB.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef __SATCAN_H__
32#define __SATCAN_H__
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38/* Config structure passed to SatCAN_init(..) */
39typedef struct {
40 /* Configuration */
41 int nodeno;
42 int dps;
43 /* Callback functions */
44 void (*ahb_irq_callback)(void);
45 void (*pps_irq_callback)(void);
46 void (*m5_irq_callback)(void);
47 void (*m4_irq_callback)(void);
48 void (*m3_irq_callback)(void);
49 void (*m2_irq_callback)(void);
50 void (*m1_irq_callback)(void);
51 void (*sync_irq_callback)(void);
52 void (*can_irq_callback)(unsigned int fifo);
54
55#define SATCAN_HEADER_SIZE 4
56#define SATCAN_HEADER_NMM_POS 3
57#define SATCAN_PAYLOAD_SIZE 8
58
59/* SatCAN message */
60typedef struct {
61 unsigned char header[SATCAN_HEADER_SIZE]; /* Header of SatCAN message */
62 unsigned char payload[SATCAN_PAYLOAD_SIZE]; /* Payload of SatCAN message */
64
65/* SatCAN modify register structure */
66typedef struct {
67 unsigned int reg;
68 unsigned int val;
70
71/* Driver interface */
72int satcan_register(satcan_config *conf);
73
74/* SatCAN interrupt IDs */
75#define SATCAN_IRQ_NONACT_TO_ACT 0
76#define SATCAN_IRQ_ACTIVE_TO_NONACT 1
77#define SATCAN_IRQ_STR1_TO_DPS 2
78#define SATCAN_IRQ_DPS_TO_STR1 3
79#define SATCAN_IRQ_STR2_TO_DPS 4
80#define SATCAN_IRQ_DPS_TO_STR2 5
81#define SATCAN_IRQ_STR3_TO_DPS 6
82#define SATCAN_IRQ_DPS_TO_STR3 7
83#define SATCAN_IRQ_PLD1_TO_DPS 8
84#define SATCAN_IRQ_DPS_TO_PLD1 9
85#define SATCAN_IRQ_PLD2_TO_DPS 10
86#define SATCAN_IRQ_DPS_TO_PLD2 11
87#define SATCAN_IRQ_SYNC 16
88#define SATCAN_IRQ_TIME_MARKER1 17
89#define SATCAN_IRQ_TIME_MARKER2 18
90#define SATCAN_IRQ_TIME_MARKER3 19
91#define SATCAN_IRQ_TIME_MARKER4 20
92#define SATCAN_IRQ_TIME_MARKER5 21
93#define SATCAN_IRQ_EOD1 22
94#define SATCAN_IRQ_EOD2 23
95#define SATCAN_IRQ_TOD 24
96#define SATCAN_IRQ_CRITICAL 25
97
98/* IOC */
99#define SATCAN_IOC_DMA_2K 1 /* Use DMA area for 2K messages */
100#define SATCAN_IOC_DMA_8K 2 /* Use DMA area for 8K messages */
101#define SATCAN_IOC_GET_REG 3 /* Provides direct read access to all core registers */
102#define SATCAN_IOC_SET_REG 4 /* Provides direct write access to all core registers */
103#define SATCAN_IOC_OR_REG 5 /* Provides direct read access to all core registers */
104#define SATCAN_IOC_AND_REG 6 /* Provides direct write access to all core registers */
105#define SATCAN_IOC_EN_TX1_DIS_TX2 7 /* Enable DMA TX channel 1, Disable DMA TX channel 2 */
106#define SATCAN_IOC_EN_TX2_DIS_TX1 8 /* Enable DMA TX channel 2, Disable DMA TX channel 1 */
107#define SATCAN_IOC_GET_DMA_MODE 9 /* Returns the current DMA mode */
108#define SATCAN_IOC_SET_DMA_MODE 10 /* Sets the DMA mode */
109#define SATCAN_IOC_ACTIVATE_DMA 11 /* Directly activate DMA channel */
110#define SATCAN_IOC_DEACTIVATE_DMA 12 /* Directly deactivate DMA channel */
111#define SATCAN_IOC_DMA_STATUS 13 /* Returns status of directly activated DMA */
112#define SATCAN_IOC_GET_DOFFSET 14 /* Get TX DMA offset */
113#define SATCAN_IOC_SET_DOFFSET 15 /* Set TX DMA offset */
114#define SATCAN_IOC_GET_TIMEOUT 16 /* Set TX DMA timeout */
115#define SATCAN_IOC_SET_TIMEOUT 17 /* Get TX DMA timeout */
116
117
118/* Values used to select core register with IOC_SET_REG/IOC_GET_REG */
119#define SATCAN_SWRES 0 /* Software reset */
120#define SATCAN_INT_EN 1 /* Interrupt enable */
121#define SATCAN_FIFO 3 /* FIFO read */
122#define SATCAN_FIFO_RES 4 /* FIFO reset */
123#define SATCAN_TSTAMP 5 /* Current time stamp */
124#define SATCAN_CMD0 6 /* Command register 0 */
125#define SATCAN_CMD1 7 /* Command register 1 */
126#define SATCAN_START_CTC 8 /* Start cycle time counter */
127#define SATCAN_RAM_BASE 9 /* RAM offset address */
128#define SATCAN_STOP_CTC 10 /* Stop cycle time counter / DPS active status */
129#define SATCAN_DPS_ACT 10 /* Stop cycle time counter / DPS active status */
130#define SATCAN_PLL_RST 11 /* DPLL reset */
131#define SATCAN_PLL_CMD 12 /* DPLL command */
132#define SATCAN_PLL_STAT 13 /* DPLL status */
133#define SATCAN_PLL_OFF 14 /* DPLL offset */
134#define SATCAN_DMA 15 /* DMA channel enable */
135#define SATCAN_DMA_TX_1_CUR 16 /* DMA channel 1 TX current address */
136#define SATCAN_DMA_TX_1_END 17 /* DMA channel 1 TX end address */
137#define SATCAN_DMA_TX_2_CUR 18 /* DMA channel 2 TX current address */
138#define SATCAN_DMA_TX_2_END 19 /* DMA channel 2 TX end address */
139#define SATCAN_RX 20 /* CAN RX enable / Filter start ID */
140#define SATCAN_FILTER_START 20 /* CAN RX enable / Filter start ID */
141#define SATCAN_FILTER_SETUP 21 /* Filter setup / Filter stop ID */
142#define SATCAN_FILTER_STOP 21 /* Filter setup / Filter stop ID */
143#define SATCAN_WCTRL 32 /* Wrapper status/control register */
144#define SATCAN_WIPEND 33 /* Wrapper interrupt pending register */
145#define SATCAN_WIMASK 34 /* Wrapper interrupt mask register */
146#define SATCAN_WAHBADDR 35 /* Wrapper AHB address register */
147
148
149/* Values used to communicate DMA mode */
150#define SATCAN_DMA_MODE_USER 0
151#define SATCAN_DMA_MODE_SYSTEM 1
152
153/* Values used to directly activate DMA channel */
154#define SATCAN_DMA_ENABLE_TX1 1
155#define SATCAN_DMA_ENABLE_TX2 2
156
157#ifdef __cplusplus
158}
159#endif
160
161#endif /* __SATCAN_H__ */
Definition: satcan.h:39
Definition: satcan.h:60
Definition: satcan.h:66