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/] [ssc/] [ssc.h] - Blame information for rev 590

Go to most recent revision | 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
/// Set of functions and definition for using a SSC peripheral.
35
///
36
/// !Usage
37
///
38
/// -# Enable the SSC interface pins (see pio & board.h).
39
/// -# Configure the SSC to operate at a specific frequency by calling
40
///    SSC_Configure(). This function enables the peripheral clock of the SSC,
41
///    but not its PIOs.
42
/// -# Configure the transmitter and/or the receiver using the
43
///    SSC_ConfigureTransmitter() and SSC_ConfigureEmitter() functions.
44
/// -# Enable the PIOs or the transmitter and/or the received.
45
/// -# Enable the transmitter and/or the receiver using SSC_EnableTransmitter()
46
///    and SSC_EnableReceiver()
47
/// -# Send data through the transmitter using SSC_Write() and SSC_WriteBuffer()
48
/// -# Receive data from the receiver using SSC_Read() and SSC_ReadBuffer()
49
/// -# Disable the transmitter and/or the receiver using SSC_DisableTransmitter()
50
///    and SSC_DisableReceiver()
51
//------------------------------------------------------------------------------
52
 
53
#ifndef SSC_H
54
#define SSC_H
55
 
56
//------------------------------------------------------------------------------
57
//         Headers
58
//------------------------------------------------------------------------------
59
 
60
#include <board.h>
61
 
62
//------------------------------------------------------------------------------
63
//         Definitions
64
//------------------------------------------------------------------------------
65
 
66
//------------------------------------------------------------------------------
67
/// \page "SSC configuration macros"
68
/// This page lists several macros which are used when configuring a SSC
69
/// peripheral.
70
/// 
71
/// !Macros
72
/// - SSC_STTDLY
73
/// - SSC_PERIOD
74
/// - SSC_DATLEN
75
/// - SSC_DATNB
76
/// - SSC_FSLEN
77
 
78
/// Calculates the value of the STTDLY field given the number of clock cycles
79
/// before the first bit of a new frame is transmitted.
80
#define SSC_STTDLY(bits)        (bits << 16)
81
 
82
/// Calculates the value of the PERIOD field of the Transmit Clock Mode Register
83
/// of an SSC interface, given the desired clock divider.
84
#define SSC_PERIOD(divider)     (((divider / 2) - 1) << 24)
85
 
86
/// Calculates the value of the DATLEN field of the Transmit Frame Mode Register
87
/// of an SSC interface, given the number of bits in one sample.
88
#define SSC_DATLEN(bits)        (bits - 1)
89
 
90
/// Calculates the value of the DATNB field of the Transmit Frame Mode Register
91
/// of an SSC interface, given the number of samples in one frame.
92
#define SSC_DATNB(samples)      ((samples -1) << 8)
93
 
94
/// Calculates the value of the FSLEN field of the Transmit Frame Mode Register
95
/// of an SSC interface, given the number of transmit clock periods that the 
96
/// frame sync signal should take.
97
#define SSC_FSLEN(periods)      ((periods - 1) << 16)
98
//------------------------------------------------------------------------------
99
 
100
//------------------------------------------------------------------------------
101
//         Exported functions
102
//------------------------------------------------------------------------------
103
extern void SSC_Configure(AT91S_SSC *ssc,
104
                                 unsigned int id,
105
                                 unsigned int bitRate,
106
                                 unsigned int masterClock);
107
extern void SSC_ConfigureTransmitter(AT91S_SSC *ssc,
108
                                            unsigned int tcmr,
109
                                            unsigned int tfmr);
110
extern void SSC_ConfigureReceiver(AT91S_SSC *ssc,
111
                                         unsigned int rcmr,
112
                                         unsigned int rfmr);
113
 
114
extern void SSC_EnableTransmitter(AT91S_SSC *ssc);
115
extern void SSC_DisableTransmitter(AT91S_SSC *ssc);
116
extern void SSC_EnableReceiver(AT91S_SSC *ssc);
117
extern void SSC_DisableReceiver(AT91S_SSC *ssc);
118
 
119
extern void SSC_EnableInterrupts(AT91S_SSC *ssc, unsigned int sources);
120
extern void SSC_DisableInterrupts(AT91S_SSC *ssc, unsigned int sources);
121
 
122
extern void SSC_Write(AT91S_SSC *ssc, unsigned int frame);
123
extern unsigned char SSC_WriteBuffer(AT91S_SSC *ssc,
124
                                            void *buffer,
125
                                            unsigned int length);
126
extern unsigned int SSC_Read(AT91S_SSC *ssc);
127
extern unsigned char SSC_ReadBuffer(AT91S_SSC *ssc,
128
                                           void *buffer,
129
                                           unsigned int length);
130
 
131
#endif //#ifndef SSC_H
132
 

powered by: WebSVN 2.1.0

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