OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM9_STR91X_IAR/] [Library/] [include/] [91x_uart.h] - Blame information for rev 577

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 577 jeremybenn
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
2
* File Name          : 91x_uart.h
3
* Author             : MCD Application Team
4
* Date First Issued  : 05/18/2006 : Version 1.0
5
* Description        : This file contains all the functions prototypes for the
6
*                      UART software library.
7
********************************************************************************
8
* History:
9
* 05/24/2006 : Version 1.1
10
* 05/18/2006 : Version 1.0
11
********************************************************************************
12
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
14
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
15
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
16
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
17
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18
*******************************************************************************/
19
 
20
/* Define to prevent recursive inclusion -------------------------------------*/
21
#ifndef __91x_UART_H
22
#define __91x_UART_H
23
 
24
/* Includes ------------------------------------------------------------------*/
25
#include <91x_map.h>
26
 
27
/* Exported types ------------------------------------------------------------*/
28
/* UART FIFO Level enumeration */
29
typedef enum
30
{
31
  UART_FIFOLevel_1_8 = 0x0000,  /* FIFO size 16 bytes, FIFO level 2 bytes */
32
  UART_FIFOLevel_1_4 = 0x0001,  /* FIFO size 16 bytes, FIFO level 4 bytes */
33
  UART_FIFOLevel_1_2 = 0x0002,  /* FIFO size 16 bytes, FIFO level 8 bytes */
34
  UART_FIFOLevel_3_4 = 0x0003,  /* FIFO size 16 bytes, FIFO level 12 bytes */
35
  UART_FIFOLevel_7_8 = 0x0004   /* FIFO size 16 bytes, FIFO level 14 bytes */
36
}UART_FIFOLevel;
37
 
38
/* UART Init Structure definition */
39
typedef struct
40
{
41
  u16 UART_WordLength;
42
  u16 UART_StopBits;
43
  u16 UART_Parity;
44
  u32 UART_BaudRate;
45
  u16 UART_HardwareFlowControl;
46
  u16 UART_Mode;
47
  u16 UART_FIFO;
48
  UART_FIFOLevel UART_TxFIFOLevel;
49
  UART_FIFOLevel UART_RxFIFOLevel;
50
}UART_InitTypeDef;
51
 
52
 
53
/* UART RTS enumeration */
54
typedef enum
55
{
56
  LowLevel = 0,
57
  HighLevel
58
}UART_LevelTypeDef;
59
 
60
/* Exported constants --------------------------------------------------------*/
61
/* UART Data Length */
62
#define UART_WordLength_5D            0x0000  /* 5 bits Data */
63
#define UART_WordLength_6D            0x0020  /* 6 bits Data */
64
#define UART_WordLength_7D            0x0040  /* 7 bits Data */
65
#define UART_WordLength_8D            0x0060  /* 8 bits Data */
66
 
67
/* UART Stop Bits */
68
#define UART_StopBits_1         0xFFF7  /* Disable two stop bit is transmitted
69
                                                 at the end of frame */
70
#define UART_StopBits_2         0x0008  /* Enable Two stop bits are transmitted
71
                                                 at the end of frame */
72
/* UART Parity */
73
#define UART_Parity_No                0x0000  /* Parity Disable */
74
#define UART_Parity_Even              0x0006  /* Even Parity */
75
#define UART_Parity_Odd               0x0002  /* Odd Parity */
76
#define UART_Parity_OddStick          0x0082  /* 1 is transmitted as bit parity */
77
#define UART_Parity_EvenStick         0x0086  /* 0 is transmitted as bit parity */
78
 
79
/* UART Hardware Flow Control */
80
#define UART_HardwareFlowControl_None      0x0000  /* HFC Disable */
81
#define UART_HardwareFlowControl_RTS       0x4000  /* RTS Enable */
82
#define UART_HardwareFlowControl_CTS       0x8000  /* CTS Enable */
83
#define UART_HardwareFlowControl_RTS_CTS   0xC000  /* CTS and RTS Enable */
84
 
85
/* UART Mode */
86
#define UART_Mode_Rx                  0x0200  /* UART Rx Enabled */
87
#define UART_Mode_Tx                  0x0100  /* UART Tx Enbled */
88
#define UART_Mode_Tx_Rx               0x0300  /* UART Tx and Rx Enabled */
89
 
90
/* UART FIFO */
91
#define UART_FIFO_Disable           0xFFEF  /* FIFOs Disable */
92
#define UART_FIFO_Enable            0x0010  /* FIFOs Enable */
93
 
94
/* UART Interrupt definition */
95
#define UART_IT_OverrunError          0x0400  /* Overrun Error interrupt mask */
96
#define UART_IT_BreakError            0x0200  /* Break Error interrupt mask */
97
#define UART_IT_ParityError           0x0100  /* Parity Error interrupt mask */
98
#define UART_IT_FrameError            0x0080  /* Frame Error interrupt mask */
99
#define UART_IT_ReceiveTimeOut        0x0040  /* Receive Time Out interrupt mask */
100
#define UART_IT_Transmit              0x0020  /* Transmit interrupt mask */
101
#define UART_IT_Receive               0x0010  /* Receive interrupt mask */
102
#define UART_IT_DSR                   0x0008  /* DSR interrupt mask */
103
#define UART_IT_DCD                   0x0004  /* DCD interrupt mask */
104
#define UART_IT_CTS                   0x0002  /* CTS interrupt mask */
105
#define UART_IT_RI                    0x0001  /* RI interrupt mask */
106
 
107
/* UART DMA On Error */
108
#define UART_DMAOnError_Enable        0xFFFB  /* DMA receive request enabled
109
                                                 when the UART error interrupt
110
                                                 is asserted. */
111
#define UART_DMAOnError_Disable       0x0004  /* DMA receive request disabled
112
                                                 when the UART error interrupt
113
                                                 is asserted. */
114
/* UART DMA Request */
115
#define UART_DMAReq_Tx                0x02      /* Transmit DMA Enable */
116
#define UART_DMAReq_Rx                0x01      /* Receive DMA Enable */
117
 
118
/* UART FLAG */
119
#define UART_FLAG_OverrunError        0x23    /* Overrun error flag */
120
#define UART_FLAG_Break               0x22    /* break error flag */
121
#define UART_FLAG_ParityError         0x21    /* parity error flag */
122
#define UART_FLAG_FrameError          0x20    /* frame error flag */
123
#define UART_FLAG_RI                  0x48    /* RI flag */
124
#define UART_FLAG_TxFIFOEmpty         0x47    /* Transmit FIFO Empty flag */
125
#define UART_FLAG_RxFIFOFull          0x46    /* Receive FIFO Full flag */
126
#define UART_FLAG_TxFIFOFull          0x45    /* Transmit FIFO Full flag */
127
#define UART_FLAG_RxFIFOEmpty         0x44    /* Receive FIFO Empty flag */
128
#define UART_FLAG_Busy                0x43    /* UART Busy flag */
129
#define UART_FLAG_DCD                 0x42    /* DCD flag */
130
#define UART_FLAG_DSR                 0x41    /* DSR flag */
131
#define UART_FLAG_CTS                 0x40    /* CTS flag */
132
#define UART_RawIT_OverrunError       0x6A    /* Overrun Error Raw IT flag */
133
#define UART_RawIT_BreakError         0x69    /* Break Error Raw IT flag */
134
#define UART_RawIT_ParityError        0x68    /* Parity Error Raw IT flag */
135
#define UART_RawIT_FrameError         0x67    /* Frame Error Raw IT flag */
136
#define UART_RawIT_ReceiveTimeOut     0x66    /* ReceiveTimeOut Raw IT flag */
137
#define UART_RawIT_Transmit           0x65    /* Transmit Raw IT flag */
138
#define UART_RawIT_Receive            0x64    /* Receive Raw IT flag */
139
#define UART_RawIT_DSR                0x63    /* DSR Raw IT flag */
140
#define UART_RawIT_DCD                0x62    /* DCD Raw IT flag */
141
#define UART_RawIT_CTS                0x61    /* CTS Raw IT flag */
142
#define UART_RawIT_RI                 0x60    /* RI Raw IT flag */
143
 
144
/*IrDAx select*/
145
#define IrDA0 0x01                             /*IrDA0 select*/
146
#define IrDA1 0x02                             /*IrDA0 select*/
147
#define IrDA2 0x03                             /*IrDA0 select*/
148
 
149
/* Exported macro ------------------------------------------------------------*/
150
/* Exported functions ------------------------------------------------------- */
151
void UART_DeInit(UART_TypeDef* UARTx);
152
void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct);
153
void UART_StructInit(UART_InitTypeDef* UART_InitStruct);
154
void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState);
155
void UART_ITConfig(UART_TypeDef* UARTx, u16 UART_IT, FunctionalState NewState);
156
void UART_DMAConfig(UART_TypeDef* UARTx, u16 UART_DMAOnError);
157
void UART_DMACmd(UART_TypeDef* UARTx, u8 UART_DMAReq, FunctionalState NewState);
158
void UART_LoopBackConfig(UART_TypeDef* UARTx, FunctionalState NewState);
159
FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, u16 UART_FLAG);
160
void UART_ClearFlag(UART_TypeDef* UARTx);
161
void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT);
162
void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState);
163
void UART_IrDACmd(u8 IrDAx, FunctionalState NewState);
164
void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter);
165
void UART_SendData(UART_TypeDef* UARTx, u8 Data);
166
u8 UART_ReceiveData(UART_TypeDef* UARTx);
167
void UART_SendBreak(UART_TypeDef* UARTx);
168
void UART_DTRConfig(UART_LevelTypeDef LevelState);
169
void UART_RTSConfig(UART_LevelTypeDef LevelState);
170
ITStatus UART_GetITStatus(UART_TypeDef* UARTx, u16 UART_IT);
171
 
172
#endif /* __91x_UART_H */
173
 
174
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.