RTEMS  5.1
alt_16550_uart.h
Go to the documentation of this file.
1 
7 /*
8  * Altera - SoC UART Manager
9  */
10 
11 /*****************************************************************************
12  *
13  * Copyright 2013 Altera Corporation. All Rights Reserved.
14  *
15  * Redistribution and use in source and binary forms, with or without
16  * modification, are permitted provided that the following conditions are met:
17  *
18  * 1. Redistributions of source code must retain the above copyright notice,
19  * this list of conditions and the following disclaimer.
20  *
21  * 2. Redistributions in binary form must reproduce the above copyright notice,
22  * this list of conditions and the following disclaimer in the documentation
23  * and/or other materials provided with the distribution.
24  *
25  * 3. The name of the author may not be used to endorse or promote products
26  * derived from this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR
29  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO
31  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
34  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
35  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
36  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
37  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  *
39  *****************************************************************************/
40 
41 #ifndef __ALT_16550_UART_H__
42 #define __ALT_16550_UART_H__
43 
44 #include "hwlib.h"
45 #include "alt_clock_manager.h"
46 
47 #ifdef __cplusplus
48 extern "C"
49 {
50 #endif
51 
81 typedef enum ALT_16550_DEVICE_e
82 {
87 
92 
98 }
100 
106 typedef struct ALT_16550_HANDLE_s
107 {
109  void * location;
110  alt_freq_t clock_freq;
111  uint32_t data;
112  uint32_t fcr;
113 }
115 
148  void * location,
149  alt_freq_t clock_freq,
150  ALT_16550_HANDLE_t * handle);
151 
167 
180 
192 
205 
222  char * item);
223 
239  char item);
240 
260 {
265 
271 
277 
283 }
285 
291 {
296 
301 
307 
313 }
315 
328 
341 
383  char * buffer,
384  size_t count);
385 
425  const char * buffer,
426  size_t count);
427 
443 
459 
475 
491  uint32_t * size);
492 
508  uint32_t * size);
509 
533  uint32_t * level);
534 
558  uint32_t * level);
559 
581 
603 
626 {
646 }
648 
668  uint32_t * baudrate);
669 
691  uint32_t baudrate);
692 
711  uint32_t * divisor);
712 
734  uint32_t divisor);
735 
756 {
764 
786 
797 
818 
825 
830 }
832 
851 
863 
881 
893 
909 
921 
937 
949 
961 
979  ALT_16550_INT_STATUS_t * status);
980 
999 {
1006 
1014 
1022 
1029 
1038 
1046 
1054 
1062 }
1064 
1089 
1109 
1132 
1144 
1159 
1174 
1189 
1204 
1224 
1243 
1260 
1276 
1292  uint32_t * status);
1293 
1311 {
1316 
1321 
1326 
1331 }
1333 
1338 {
1343 
1349 }
1351 
1356 {
1361 
1367 
1373 }
1375 
1381 {
1390 
1401 
1427 
1439 
1451 
1461 
1474 
1480 }
1482 
1503  ALT_16550_DATABITS_t databits,
1504  ALT_16550_PARITY_t parity,
1505  ALT_16550_STOPBITS_t stopbits);
1506 
1519 
1531 
1547  uint32_t * status);
1548 
1557 #ifdef __cplusplus
1558 }
1559 #endif
1560 
1561 #endif /* __ALT_16550_UART_H__ */
ALT_STATUS_CODE alt_16550_fifo_trigger_set_rx(ALT_16550_HANDLE_t *handle, ALT_16550_FIFO_TRIGGER_RX_t trigger)
Definition: alt_16550_uart.c:636
Definition: alt_16550_uart.h:1037
enum ALT_16550_PARITY_e ALT_16550_PARITY_t
ALT_STATUS_CODE alt_16550_baudrate_set(ALT_16550_HANDLE_t *handle, uint32_t baudrate)
Definition: alt_16550_uart.c:733
ALT_STATUS_CODE alt_16550_modem_enable_dtr(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1157
enum ALT_16550_DEVICE_e ALT_16550_DEVICE_t
ALT_STATUS_CODE alt_16550_fifo_trigger_set_tx(ALT_16550_HANDLE_t *handle, ALT_16550_FIFO_TRIGGER_TX_t trigger)
Definition: alt_16550_uart.c:674
Definition: alt_16550_uart.h:1450
ALT_STATUS_CODE alt_16550_int_disable_line(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:848
enum ALT_16550_DATABITS_e ALT_16550_DATABITS_t
ALT_STATUS_CODE alt_16550_modem_enable_out2(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1133
ALT_16550_PARITY_e
Definition: alt_16550_uart.h:1355
Definition: alt_16550_uart.h:270
ALT_STATUS_CODE alt_16550_int_disable_all(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:866
Definition: alt_16550_uart.h:632
ALT_16550_DEVICE_e
Definition: alt_16550_uart.h:81
Definition: alt_16550_uart.h:643
Definition: alt_16550_uart.h:1438
Definition: alt_16550_uart.h:630
Definition: alt_16550_uart.h:276
Definition: alt_16550_uart.h:282
Definition: alt_16550_uart.h:1389
ALT_16550_LINE_STATUS_e
Definition: alt_16550_uart.h:1380
Definition: alt_16550_uart.h:1320
Definition: alt_16550_uart.h:1366
ALT_STATUS_CODE alt_16550_fifo_size_get_tx(ALT_16550_HANDLE_t *handle, uint32_t *size)
Definition: alt_16550_uart.c:558
Definition: alt_16550_uart.h:629
ALT_STATUS_CODE alt_16550_fifo_size_get_rx(ALT_16550_HANDLE_t *handle, uint32_t *size)
Definition: alt_16550_uart.c:535
Definition: alt_16550_uart.h:785
ALT_16550_STOPBITS_e
Definition: alt_16550_uart.h:1337
Definition: alt_16550_uart.h:1426
Definition: alt_16550_uart.h:1330
enum ALT_16550_INT_STATUS_e ALT_16550_INT_STATUS_t
Definition: alt_16550_uart.h:86
ALT_STATUS_CODE alt_16550_loopback_disable(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1115
enum ALT_16550_BAUDRATE_e ALT_16550_BAUDRATE_t
Definition: alt_16550_uart.h:636
Definition: alt_16550_uart.h:1005
Definition: alt_16550_uart.h:627
enum ALT_16550_STOPBITS_e ALT_16550_STOPBITS_t
ALT_STATUS_CODE alt_16550_uninit(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:250
Definition: alt_16550_uart.h:1045
ALT_STATUS_CODE alt_16550_read(ALT_16550_HANDLE_t *handle, char *item)
Definition: alt_16550_uart.c:286
Definition: alt_16550_uart.h:1028
ALT_STATUS_CODE alt_16550_fifo_level_get_tx(ALT_16550_HANDLE_t *handle, uint32_t *level)
Definition: alt_16550_uart.c:609
ALT_STATUS_CODE alt_16550_modem_disable_dtr(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1163
Definition: alt_16550_uart.h:312
ALT_STATUS_CODE alt_16550_line_status_get(ALT_16550_HANDLE_t *handle, uint32_t *status)
Definition: alt_16550_uart.c:1019
Definition: alt_16550_uart.h:628
Definition: rtemscompat1.h:15
Definition: alt_16550_uart.h:1372
ALT_STATUS_CODE alt_16550_line_break_enable(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:982
ALT_STATUS_CODE alt_16550_fifo_disable(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:367
ALT_16550_FIFO_TRIGGER_TX_e
Definition: alt_16550_uart.h:290
ALT_STATUS_CODE alt_16550_line_break_disable(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1000
ALT_STATUS_CODE alt_16550_int_disable_tx(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:836
uint32_t alt_freq_t
Definition: alt_clock_manager.h:66
Definition: alt_16550_uart.h:640
Definition: alt_16550_uart.h:1360
struct ALT_16550_HANDLE_s ALT_16550_HANDLE_t
ALT_STATUS_CODE alt_16550_int_disable_modem(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:860
enum ALT_16550_LINE_STATUS_e ALT_16550_LINE_STATUS_t
Definition: alt_16550_uart.h:637
ALT_STATUS_CODE alt_16550_int_enable_rx(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:818
Definition: alt_16550_uart.h:644
ALT_STATUS_CODE alt_16550_fifo_clear_rx(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:453
ALT_STATUS_CODE alt_16550_fifo_enable(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:347
Definition: alt_16550_uart.h:645
Definition: alt_16550_uart.h:306
ALT_STATUS_CODE alt_16550_fifo_write(ALT_16550_HANDLE_t *handle, const char *buffer, size_t count)
Definition: alt_16550_uart.c:419
Definition: alt_16550_uart.h:642
Definition: alt_16550_uart.h:1315
Definition: alt_16550_uart.h:1061
ALT_STATUS_CODE alt_16550_flowcontrol_enable(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1074
Definition: alt_16550_uart.h:106
ALT_STATUS_CODE alt_16550_modem_disable_out1(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1127
Definition: alt_16550_uart.h:641
ALT_STATUS_CODE alt_16550_fifo_read(ALT_16550_HANDLE_t *handle, char *buffer, size_t count)
Definition: alt_16550_uart.c:385
ALT_16550_BAUDRATE_e
Definition: alt_16550_uart.h:625
ALT_STATUS_CODE alt_16550_modem_disable_out2(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1139
Definition: alt_16550_uart.h:1325
enum ALT_16550_FIFO_TRIGGER_RX_e ALT_16550_FIFO_TRIGGER_RX_t
ALT_STATUS_CODE alt_16550_divisor_set(ALT_16550_HANDLE_t *handle, uint32_t divisor)
Definition: alt_16550_uart.c:763
Definition: alt_16550_uart.h:300
ALT_STATUS_CODE alt_16550_fifo_clear_all(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:505
ALT_STATUS_CODE alt_16550_flowcontrol_disable(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1097
ALT_STATUS_CODE alt_16550_enable(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:271
ALT_STATUS_CODE alt_16550_modem_disable_rts(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1151
ALT_STATUS_CODE alt_16550_fifo_clear_tx(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:479
Definition: alt_16550_uart.h:635
ALT_STATUS_CODE alt_16550_divisor_get(ALT_16550_HANDLE_t *handle, uint32_t *divisor)
Definition: alt_16550_uart.c:754
Definition: alt_16550_uart.h:1053
Definition: alt_16550_uart.h:639
ALT_STATUS_CODE alt_16550_int_enable_modem(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:854
ALT_STATUS_CODE alt_16550_init(ALT_16550_DEVICE_t device, void *location, alt_freq_t clock_freq, ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:189
Definition: alt_16550_uart.h:1473
enum ALT_16550_MODEM_STATUS_e ALT_16550_MODEM_STATUS_t
Definition: alt_16550_uart.h:633
ALT_STATUS_CODE alt_16550_line_config_set(ALT_16550_HANDLE_t *handle, ALT_16550_DATABITS_t databits, ALT_16550_PARITY_t parity, ALT_16550_STOPBITS_t stopbits)
Definition: alt_16550_uart.c:899
Definition: alt_16550_uart.h:1460
ALT_STATUS_CODE alt_16550_fifo_level_get_rx(ALT_16550_HANDLE_t *handle, uint32_t *level)
Definition: alt_16550_uart.c:582
Definition: alt_16550_uart.h:634
ALT_16550_DATABITS_e
Definition: alt_16550_uart.h:1310
ALT_16550_MODEM_STATUS_e
Definition: alt_16550_uart.h:998
enum ALT_16550_FIFO_TRIGGER_TX_e ALT_16550_FIFO_TRIGGER_TX_t
ALT_16550_INT_STATUS_e
Definition: alt_16550_uart.h:755
Definition: alt_16550_uart.h:817
int32_t ALT_STATUS_CODE
Definition: hwlib.h:60
ALT_STATUS_CODE alt_16550_modem_enable_rts(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1145
Definition: alt_16550_uart.h:638
Definition: alt_16550_uart.h:1479
ALT_STATUS_CODE alt_16550_disable(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:279
Definition: alt_16550_uart.h:763
Definition: alt_16550_uart.h:97
Definition: alt_16550_uart.h:264
Definition: alt_16550_uart.h:1013
ALT_STATUS_CODE alt_16550_modem_status_get(ALT_16550_HANDLE_t *handle, uint32_t *status)
Definition: alt_16550_uart.c:1169
ALT_16550_FIFO_TRIGGER_RX_e
Definition: alt_16550_uart.h:259
Definition: alt_16550_uart.h:631
Definition: alt_16550_uart.h:1021
Definition: alt_16550_uart.h:1348
Definition: alt_16550_uart.h:829
ALT_STATUS_CODE alt_16550_int_enable_line(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:842
Definition: alt_16550_uart.h:295
Definition: alt_16550_uart.h:1400
Definition: alt_16550_uart.h:1342
Definition: alt_16550_uart.h:91
unsigned size
Definition: tte.h:74
ALT_STATUS_CODE alt_16550_baudrate_get(ALT_16550_HANDLE_t *handle, uint32_t *baudrate)
Definition: alt_16550_uart.c:714
ALT_STATUS_CODE alt_16550_loopback_enable(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1103
Definition: alt_16550_uart.h:796
ALT_STATUS_CODE alt_16550_int_status_get(ALT_16550_HANDLE_t *handle, ALT_16550_INT_STATUS_t *status)
Definition: alt_16550_uart.c:879
ALT_STATUS_CODE alt_16550_int_disable_rx(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:824
ALT_STATUS_CODE alt_16550_int_enable_tx(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:830
ALT_STATUS_CODE alt_16550_modem_enable_out1(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:1121
ALT_STATUS_CODE alt_16550_write(ALT_16550_HANDLE_t *handle, char item)
Definition: alt_16550_uart.c:315
Definition: alt_16550_uart.h:824
ALT_STATUS_CODE alt_16550_reset(ALT_16550_HANDLE_t *handle)
Definition: alt_16550_uart.c:266