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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [CORTEX_AT91SAM3U256_IAR/] [AT91Lib/] [peripherals/] [usart/] [usart.h] - Blame information for rev 580

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 580 jeremybenn
/* ----------------------------------------------------------------------------
2
 *         ATMEL Microcontroller Software Support
3
 * ----------------------------------------------------------------------------
4
 * Copyright (c) 2008, Atmel Corporation
5
 *
6
 * All rights reserved.
7
 *
8
 * Redistribution and use in source and binary forms, with or without
9
 * modification, are permitted provided that the following conditions are met:
10
 *
11
 * - Redistributions of source code must retain the above copyright notice,
12
 * this list of conditions and the disclaimer below.
13
 *
14
 * Atmel's name may not be used to endorse or promote products derived from
15
 * this software without specific prior written permission.
16
 *
17
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 * ----------------------------------------------------------------------------
28
 */
29
 
30
//------------------------------------------------------------------------------
31
/// \dir
32
/// !Purpose
33
/// 
34
/// This module provides several definitions and methods for using an USART
35
/// peripheral.
36
///
37
/// !Usage
38
/// -# Enable the USART peripheral clock in the PMC.
39
/// -# Enable the required USART PIOs (see pio.h).
40
/// -# Configure the UART by calling USART_Configure.
41
/// -# Enable the transmitter and/or the receiver of the USART using
42
///    USART_SetTransmitterEnabled and USART_SetReceiverEnabled.
43
/// -# Send data through the USART using the USART_Write and
44
///    USART_WriteBuffer methods.
45
/// -# Receive data from the USART using the USART_Read and
46
///    USART_ReadBuffer functions; the availability of data can be polled
47
///    with USART_IsDataAvailable.
48
/// -# Disable the transmitter and/or the receiver of the USART with
49
///    USART_SetTransmitterEnabled and USART_SetReceiverEnabled.
50
//------------------------------------------------------------------------------
51
 
52
#ifndef USART_H
53
#define USART_H
54
 
55
//------------------------------------------------------------------------------
56
//         Headers
57
//------------------------------------------------------------------------------
58
 
59
#include <board.h>
60
 
61
//------------------------------------------------------------------------------
62
//         Definitions
63
//------------------------------------------------------------------------------
64
 
65
//------------------------------------------------------------------------------
66
/// \page "USART modes"
67
/// This page lists several common operating modes for an USART peripheral.
68
/// 
69
/// !Modes
70
/// - USART_MODE_ASYNCHRONOUS
71
/// - USART_MODE_IRDA
72
 
73
/// Basic asynchronous mode, i.e. 8 bits no parity.
74
#define USART_MODE_ASYNCHRONOUS (AT91C_US_CHRL_8_BITS | AT91C_US_PAR_NONE)
75
 
76
/// IRDA mode
77
#define USART_MODE_IRDA         (AT91C_US_USMODE_IRDA | AT91C_US_CHRL_8_BITS | AT91C_US_PAR_NONE | AT91C_US_FILTER)
78
//------------------------------------------------------------------------------
79
 
80
//------------------------------------------------------------------------------
81
//         Exported functions
82
//------------------------------------------------------------------------------
83
 
84
extern void USART_Configure(
85
    AT91S_USART *usart,
86
    unsigned int mode,
87
    unsigned int baudrate,
88
    unsigned int masterClock);
89
 
90
extern void USART_SetTransmitterEnabled(AT91S_USART *usart, unsigned char enabled);
91
 
92
extern void USART_SetReceiverEnabled(AT91S_USART *usart, unsigned char enabled);
93
 
94
extern void USART_Write(
95
    AT91S_USART *usart,
96
    unsigned short data,
97
    volatile unsigned int timeOut);
98
 
99
extern unsigned char USART_WriteBuffer(
100
    AT91S_USART *usart,
101
    void *buffer,
102
    unsigned int size);
103
 
104
extern unsigned short USART_Read(
105
    AT91S_USART *usart,
106
    volatile unsigned int timeOut);
107
 
108
extern unsigned char USART_ReadBuffer(
109
    AT91S_USART *usart,
110
    void *buffer,
111
    unsigned int size);
112
 
113
extern unsigned char USART_IsDataAvailable(AT91S_USART *usart);
114
 
115
extern void USART_SetIrdaFilter(AT91S_USART *pUsart, unsigned char filter);
116
 
117
#endif //#ifndef USART_H
118
 

powered by: WebSVN 2.1.0

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