aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/tile/include/arch/uart.h
blob: 07966970adaddb10ca33d7e390495f9924755ac7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
/*
 * Copyright 2013 Tilera Corporation. All Rights Reserved.
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License
 *   as published by the Free Software Foundation, version 2.
 *
 *   This program is distributed in the hope that it will be useful, but
 *   WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
 *   NON INFRINGEMENT.  See the GNU General Public License for
 *   more details.
 */

/* Machine-generated file; do not edit. */

#ifndef __ARCH_UART_H__
#define __ARCH_UART_H__

#include <arch/abi.h>
#include <arch/uart_def.h>

#ifndef __ASSEMBLER__

/* Divisor. */

__extension__
typedef union
{
  struct
  {
#ifndef __BIG_ENDIAN__
    /*
     * Baud Rate Divisor.  Desired_baud_rate = REF_CLK frequency / (baud *
     * 16).
     *                       Note: REF_CLK is always 125 MHz, the default
     * divisor = 68, baud rate = 125M/(68*16) = 115200 baud.
     */
    uint_reg_t divisor    : 12;
    /* Reserved. */
    uint_reg_t __reserved : 52;
#else   /* __BIG_ENDIAN__ */
    uint_reg_t __reserved : 52;
    uint_reg_t divisor    : 12;
#endif
  };

  uint_reg_t word;
} UART_DIVISOR_t;

/* FIFO Count. */

__extension__
typedef union
{
  struct
  {
#ifndef __BIG_ENDIAN__
    /*
     * n: n active entries in the receive FIFO (max is 2**8). Each entry has
     * 8 bits.
     * 0: no active entry in the receive FIFO (that is empty).
     */
    uint_reg_t rfifo_count  : 9;
    /* Reserved. */
    uint_reg_t __reserved_0 : 7;
    /*
     * n: n active entries in the transmit FIFO (max is 2**8). Each entry has
     * 8 bits.
     * 0: no active entry in the transmit FIFO (that is empty).
     */
    uint_reg_t tfifo_count  : 9;
    /* Reserved. */
    uint_reg_t __reserved_1 : 7;
    /*
     * n: n active entries in the write FIFO (max is 2**2). Each entry has 8
     * bits.
     * 0: no active entry in the write FIFO (that is empty).
     */
    uint_reg_t wfifo_count  : 3;
    /* Reserved. */
    uint_reg_t __reserved_2 : 29;
#else   /* __BIG_ENDIAN__ */
    uint_reg_t __reserved_2 : 29;
    uint_reg_t wfifo_count  : 3;
    uint_reg_t __reserved_1 : 7;
    uint_reg_t tfifo_count  : 9;
    uint_reg_t __reserved_0 : 7;
    uint_reg_t rfifo_count  : 9;
#endif
  };

  uint_reg_t word;
} UART_FIFO_COUNT_t;

/* FLAG. */

__extension__
typedef union
{
  struct
  {
#ifndef __BIG_ENDIAN__
    /* Reserved. */
    uint_reg_t __reserved_0 : 1;
    /* 1: receive FIFO is empty */
    uint_reg_t rfifo_empty  : 1;
    /* 1: write FIFO is empty. */
    uint_reg_t wfifo_empty  : 1;
    /* 1: transmit FIFO is empty. */
    uint_reg_t tfifo_empty  : 1;
    /* 1: receive FIFO is full. */
    uint_reg_t rfifo_full   : 1;
    /* 1: write FIFO is full. */
    uint_reg_t wfifo_full   : 1;
    /* 1: transmit FIFO is full. */
    uint_reg_t tfifo_full   : 1;
    /* Reserved. */
    uint_reg_t __reserved_1 : 57;
#else   /* __BIG_ENDIAN__ */
    uint_reg_t __reserved_1 : 57;
    uint_reg_t tfifo_full   : 1;
    uint_reg_t wfifo_full   : 1;
    uint_reg_t rfifo_full   : 1;
    uint_reg_t tfifo_empty  : 1;
    uint_reg_t wfifo_empty  : 1;
    uint_reg_t rfifo_empty  : 1;
    uint_reg_t __reserved_0 : 1;
#endif
  };

  uint_reg_t word;
} UART_FLAG_t;

/*
 * Interrupt Vector Mask.
 * Each bit in this register corresponds to a specific interrupt. When set,
 * the associated interrupt will not be dispatched.
 */

__extension__
typedef union
{
  struct
  {
#ifndef __BIG_ENDIAN__
    /* Read data FIFO read and no data available */
    uint_reg_t rdat_err       : 1;
    /* Write FIFO was written but it was full */
    uint_reg_t wdat_err       : 1;
    /* Stop bit not found when current data was received */
    uint_reg_t frame_err      : 1;
    /* Parity error was detected when current data was received */
    uint_reg_t parity_err     : 1;
    /* Data was received but the receive FIFO was full */
    uint_reg_t rfifo_overflow : 1;
    /*
     * An almost full event is reached when data is to be written to the
     * receive FIFO, and the receive FIFO has more than or equal to
     * BUFFER_THRESHOLD.RFIFO_AFULL bytes.
     */
    uint_reg_t rfifo_afull    : 1;
    /* Reserved. */
    uint_reg_t __reserved_0   : 1;
    /* An entry in the transmit FIFO was popped */
    uint_reg_t tfifo_re       : 1;
    /* An entry has been pushed into the receive FIFO */
    uint_reg_t rfifo_we       : 1;
    /* An entry of the write FIFO has been popped */
    uint_reg_t wfifo_re       : 1;
    /* Rshim read receive FIFO in protocol mode */
    uint_reg_t rfifo_err      : 1;
    /*
     * An almost empty event is reached when data is to be read from the
     * transmit FIFO, and the transmit FIFO has less than or equal to
     * BUFFER_THRESHOLD.TFIFO_AEMPTY bytes.
     */
    uint_reg_t tfifo_aempty   : 1;
    /* Reserved. */
    uint_reg_t __reserved_1   : 52;
#else   /* __BIG_ENDIAN__ */
    uint_reg_t __reserved_1   : 52;
    uint_reg_t tfifo_aempty   : 1;
    uint_reg_t rfifo_err      : 1;
    uint_reg_t wfifo_re       : 1;
    uint_reg_t rfifo_we       : 1;
    uint_reg_t tfifo_re       : 1;
    uint_reg_t __reserved_0   : 1;
    uint_reg_t rfifo_afull    : 1;
    uint_reg_t rfifo_overflow : 1;
    uint_reg_t parity_err     : 1;
    uint_reg_t frame_err      : 1;
    uint_reg_t wdat_err       : 1;
    uint_reg_t rdat_err       : 1;
#endif
  };

  uint_reg_t word;
} UART_INTERRUPT_MASK_t;

/*
 * Interrupt vector, write-one-to-clear.
 * Each bit in this register corresponds to a specific interrupt. Hardware
 * sets the bit when the associated condition has occurred. Writing a 1
 * clears the status bit.
 */

__extension__
typedef union
{
  struct
  {
#ifndef __BIG_ENDIAN__
    /* Read data FIFO read and no data available */
    uint_reg_t rdat_err       : 1;
    /* Write FIFO was written but it was full */
    uint_reg_t wdat_err       : 1;
    /* Stop bit not found when current data was received */
    uint_reg_t frame_err      : 1;
    /* Parity error was detected when current data was received */
    uint_reg_t parity_err     : 1;
    /* Data was received but the receive FIFO was full */
    uint_reg_t rfifo_overflow : 1;
    /*
     * Data was received and the receive FIFO is now almost full (more than
     * BUFFER_THRESHOLD.RFIFO_AFULL bytes in it)
     */
    uint_reg_t rfifo_afull    : 1;
    /* Reserved. */
    uint_reg_t __reserved_0   : 1;
    /* An entry in the transmit FIFO was popped */
    uint_reg_t tfifo_re       : 1;
    /* An entry has been pushed into the receive FIFO */
    uint_reg_t rfifo_we       : 1;
    /* An entry of the write FIFO has been popped */
    uint_reg_t wfifo_re       : 1;
    /* Rshim read receive FIFO in protocol mode */
    uint_reg_t rfifo_err      : 1;
    /*
     * Data was read from the transmit FIFO and now it is almost empty (less
     * than or equal to BUFFER_THRESHOLD.TFIFO_AEMPTY bytes in it).
     */
    uint_reg_t tfifo_aempty   : 1;
    /* Reserved. */
    uint_reg_t __reserved_1   : 52;
#else   /* __BIG_ENDIAN__ */
    uint_reg_t __reserved_1   : 52;
    uint_reg_t tfifo_aempty   : 1;
    uint_reg_t rfifo_err      : 1;
    uint_reg_t wfifo_re       : 1;
    uint_reg_t rfifo_we       : 1;
    uint_reg_t tfifo_re       : 1;
    uint_reg_t __reserved_0   : 1;
    uint_reg_t rfifo_afull    : 1;
    uint_reg_t rfifo_overflow : 1;
    uint_reg_t parity_err     : 1;
    uint_reg_t frame_err      : 1;
    uint_reg_t wdat_err       : 1;
    uint_reg_t rdat_err       : 1;
#endif
  };

  uint_reg_t word;
} UART_INTERRUPT_STATUS_t;

/* Type. */

__extension__
typedef union
{
  struct
  {
#ifndef __BIG_ENDIAN__
    /* Number of stop bits, rx and tx */
    uint_reg_t sbits        : 1;
    /* Reserved. */
    uint_reg_t __reserved_0 : 1;
    /* Data word size, rx and tx */
    uint_reg_t dbits        : 1;
    /* Reserved. */
    uint_reg_t __reserved_1 : 1;
    /* Parity selection, rx and tx */
    uint_reg_t ptype        : 3;
    /* Reserved. */
    uint_reg_t __reserved_2 : 57;
#else   /* __BIG_ENDIAN__ */
    uint_reg_t __reserved_2 : 57;
    uint_reg_t ptype        : 3;
    uint_reg_t __reserved_1 : 1;
    uint_reg_t dbits        : 1;
    uint_reg_t __reserved_0 : 1;
    uint_reg_t sbits        : 1;
#endif
  };

  uint_reg_t word;
} UART_TYPE_t;
#endif /* !defined(__ASSEMBLER__) */

#endif /* !defined(__ARCH_UART_H__) */