summaryrefslogtreecommitdiffstats
path: root/bsps/include/grlib/apbuart.h
blob: 68bcf1bffaf561bfd6a151f414b65fa4fdf4bb00 (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
/**
 * @file
 * @ingroup uart
 */

/*
 *  COPYRIGHT (c) 2007.
 *  Gaisler Research
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 *
 */

#ifndef __APBUART_H__
#define __APBUART_H__

/**
 * @defgroup uart UART
 *
 * @ingroup RTEMSBSPsSharedGRLIB
 *
 * @brief Driver interface for APBUART
 *
 * @{
 */

#include "ambapp.h"
#include "grlib.h"

#ifdef __cplusplus
extern "C" {
#endif

#define APBUART_CTRL_RE 0x1
#define APBUART_CTRL_TE 0x2
#define APBUART_CTRL_RI 0x4
#define APBUART_CTRL_TI 0x8
#define APBUART_CTRL_PS 0x10
#define APBUART_CTRL_PE 0x20
#define APBUART_CTRL_FL 0x40
#define APBUART_CTRL_LB 0x80
#define APBUART_CTRL_EC 0x100
#define APBUART_CTRL_TF 0x200
#define APBUART_CTRL_RF 0x400
#define APBUART_CTRL_DB 0x800
#define APBUART_CTRL_BI 0x1000
#define APBUART_CTRL_DI 0x2000
#define APBUART_CTRL_FA 0x80000000

#define APBUART_STATUS_DR 0x1
#define APBUART_STATUS_TS 0x2
#define APBUART_STATUS_TE 0x4
#define APBUART_STATUS_BR 0x8
#define APBUART_STATUS_OV 0x10
#define APBUART_STATUS_PE 0x20
#define APBUART_STATUS_FE 0x40
#define APBUART_STATUS_ERR 0x78
#define APBUART_STATUS_TH 0x80
#define APBUART_STATUS_RH 0x100
#define APBUART_STATUS_TF 0x200
#define APBUART_STATUS_RF 0x400

void apbuart_outbyte_wait(const struct apbuart_regs *regs);

void apbuart_outbyte_polled(struct apbuart_regs *regs, unsigned char ch);

int apbuart_inbyte_nonblocking(struct apbuart_regs *regs);

#ifdef __cplusplus
}
#endif

/** @} */

#endif /* __APBUART_H__ */