RTEMS 6.1-rc6
Loading...
Searching...
No Matches
grspw.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
8/*
9 * COPYRIGHT (c) 2007.
10 * Cobham Gaisler AB.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef __GRSPW_H__
35#define __GRSPW_H__
36
47#include <grlib/ambapp.h>
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53#define SPW_LINKERR_EVENT RTEMS_EVENT_0
54
55typedef struct {
56 unsigned int rxsize;
57 unsigned int txdsize;
58 unsigned int txhsize;
60
61#define GRSPW_PKTSEND_OPTION_HDR_CRC 0x1
62#define GRSPW_PKTSEND_OPTION_DATA_CRC 0x2
63#define GRSPW_PKTSEND_OPTION_NOCRCLEN(len) ((len & 0xf) << 8)
64#define GRSPW_PKTSEND_OPTION_NOCRCLEN_MASK 0xf00
65
66typedef struct {
67 unsigned int hlen;
68 char *hdr;
69 unsigned int dlen;
70 char *data;
71 unsigned int sent;
72 unsigned int options;
74
75typedef struct {
76 unsigned int tx_link_err;
77 unsigned int rx_rmap_header_crc_err;
78 unsigned int rx_rmap_data_crc_err;
79 unsigned int rx_eep_err;
80 unsigned int rx_truncated;
81 unsigned int parity_err;
82 unsigned int escape_err;
83 unsigned int credit_err;
84 unsigned int write_sync_err;
85 unsigned int disconnect_err;
86 unsigned int early_ep;
87 unsigned int invalid_address;
88 unsigned int packets_sent;
89 unsigned int packets_received;
90} spw_stats;
91
92typedef struct {
93 unsigned int nodeaddr;
94 unsigned int destkey;
95 unsigned int clkdiv; /* Note: contain both CLKDIVSTART and CLKDIVRUN, but IOCTL_SET_CLKDIV* commands are split into two */
96 unsigned int rxmaxlen;
97 unsigned int timer;
98 unsigned int disconnect;
99 unsigned int promiscuous;
100 unsigned int rmapen;
101 unsigned int rmapbufdis;
102 unsigned int linkdisabled;
103 unsigned int linkstart;
104
105 unsigned int check_rmap_err; /* check incoming packets for rmap errors */
106 unsigned int rm_prot_id; /* remove protocol id from incoming packets */
107 unsigned int tx_blocking; /* use blocking tx */
108 unsigned int tx_block_on_full; /* block when all tx_buffers are used */
109 unsigned int rx_blocking; /* block when no data is available */
110 unsigned int disable_err; /* disable link automatically when link error is detected */
111 unsigned int link_err_irq; /* generate an interrupt when link error occurs */
112 rtems_id event_id; /* task id that should receive link err irq event */
113
114 unsigned int is_rmap;
115 unsigned int is_rxunaligned;
116 unsigned int is_rmapcrc;
117
118 unsigned int nodemask;
119 unsigned int keep_source; /* copy source address to user-buffer in read() operations
120 * Note that rm_prot_id has no effect when keep_source is
121 * set.
122 */
123 unsigned int rtimeout; /* Read timeout if != 0 */
124} spw_config;
125
126#define SPACEWIRE_IOCTRL_SET_NODEADDR 1
127#define SPACEWIRE_IOCTRL_SET_RXBLOCK 2
128#define SPACEWIRE_IOCTRL_SET_DESTKEY 4
129#define SPACEWIRE_IOCTRL_SET_CLKDIV 5
130#define SPACEWIRE_IOCTRL_SET_TIMER 6
131#define SPACEWIRE_IOCTRL_SET_DISCONNECT 7
132#define SPACEWIRE_IOCTRL_SET_PROMISCUOUS 8
133#define SPACEWIRE_IOCTRL_SET_RMAPEN 9
134#define SPACEWIRE_IOCTRL_SET_RMAPBUFDIS 10
135#define SPACEWIRE_IOCTRL_SET_CHECK_RMAP 11
136#define SPACEWIRE_IOCTRL_SET_RM_PROT_ID 12
137#define SPACEWIRE_IOCTRL_SET_TXBLOCK 14
138#define SPACEWIRE_IOCTRL_SET_DISABLE_ERR 15
139#define SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ 16
140#define SPACEWIRE_IOCTRL_SET_EVENT_ID 17
141#define SPACEWIRE_IOCTRL_SET_PACKETSIZE 20
142#define SPACEWIRE_IOCTRL_GET_LINK_STATUS 23
143#define SPACEWIRE_IOCTRL_GET_CONFIG 25
144#define SPACEWIRE_IOCTRL_GET_STATISTICS 26
145#define SPACEWIRE_IOCTRL_CLR_STATISTICS 27
146#define SPACEWIRE_IOCTRL_SEND 28
147#define SPACEWIRE_IOCTRL_LINKDISABLE 29
148#define SPACEWIRE_IOCTRL_LINKSTART 30
149#define SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL 31
150#define SPACEWIRE_IOCTRL_SET_COREFREQ 32
151#define SPACEWIRE_IOCTRL_SET_CLKDIVSTART 33
152#define SPACEWIRE_IOCTRL_SET_NODEMASK 34
153#define SPACEWIRE_IOCTRL_SET_KEEP_SOURCE 35
154#define SPACEWIRE_IOCTRL_SET_TCODE_CTRL 36
155#define SPACEWIRE_IOCTRL_SET_TCODE 37
156#define SPACEWIRE_IOCTRL_GET_TCODE 38
157#define SPACEWIRE_IOCTRL_SET_READ_TIMEOUT 39
158
159#define SPACEWIRE_IOCTRL_START 64
160#define SPACEWIRE_IOCTRL_STOP 65
161
162/* Defines what register bits that will be touched
163 * for SPACEWIRE_IOCTRL_SET_TCODE_CTRL
164 */
165#define SPACEWIRE_TCODE_CTRL_IE_MSK 0x001
166#define SPACEWIRE_TCODE_CTRL_TT_MSK 0x004
167#define SPACEWIRE_TCODE_CTRL_TR_MSK 0x008
168
169/* Defines what register bits that should be set
170 * for SPACEWIRE_IOCTRL_SET_TCODE_CTRL
171 */
172#define SPACEWIRE_TCODE_CTRL_IE 0x100
173#define SPACEWIRE_TCODE_CTRL_TT 0x400
174#define SPACEWIRE_TCODE_CTRL_TR 0x800
175
176/* SPACEWIRE_IOCTRL_SET_TCODE argument mask */
177#define SPACEWIRE_TCODE_TCODE 0x0ff
178#define SPACEWIRE_TCODE_SET 0x100 /* Set Timecode register */
179#define SPACEWIRE_TCODE_TX 0x400
180
181void grspw_register_drv (void);
182
183void grspw_print(int options);
184
185/* Global GRSPW Function pointer called upon timecode receive interrupt */
186extern void (*grspw_timecode_callback)
187 (void *pDev, void *regs, int minor, unsigned int tc);
188
189
190#ifdef __cplusplus
191}
192#endif
193
196#endif /* __GRSPW_H__ */
Objects_Id rtems_id
This type represents RTEMS object identifiers.
Definition: types.h:94
Definition: grspw.h:92
Definition: grspw.h:55
Definition: grspw.h:66
Definition: grspw.h:75