4 * This file is part of BeRTOS.
6 * Bertos is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * As a special exception, you may use this file as part of a free software
21 * library without restriction. Specifically, if other files instantiate
22 * templates or use macros or inline functions from this file, or you compile
23 * this file and link it with other files to produce an executable, this
24 * file does not by itself cause the resulting executable to be covered by
25 * the GNU General Public License. This exception does not however
26 * invalidate any other reasons why the executable file might be covered by
27 * the GNU General Public License.
29 * Copyright 2009 Develer S.r.l. (http://www.develer.com/)
34 * \author Luca Ottaviano <lottaviano@develer.com>
36 * AT91SAM7 SSC register definitions.
37 * This file is based on NUT/OS implementation. See license below.
41 * Copyright (C) 2006-2007 by egnite Software GmbH. All rights reserved.
43 * Redistribution and use in source and binary forms, with or without
44 * modification, are permitted provided that the following conditions
47 * 1. Redistributions of source code must retain the above copyright
48 * notice, this list of conditions and the following disclaimer.
49 * 2. Redistributions in binary form must reproduce the above copyright
50 * notice, this list of conditions and the following disclaimer in the
51 * documentation and/or other materials provided with the distribution.
52 * 3. Neither the name of the copyright holders nor the names of
53 * contributors may be used to endorse or promote products derived
54 * from this software without specific prior written permission.
56 * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
57 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
58 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
59 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
60 * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
61 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
62 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
63 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
64 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
65 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
66 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69 * For additional information see http://www.ethernut.de/
75 #include <io/at91sam7.h>
78 * SSC Control Register
81 #define SSC_CR_OFF 0x00000000 ///< Control register offset.
83 #define SSC_RXEN 0 ///< Receive enable.
84 #define SSC_RXDIS 1 ///< Receive disable.
85 #define SSC_TXEN 8 ///< Transmit enable.
86 #define SSC_TXDIS 9 ///< Transmit disable.
87 #define SSC_SWRST 15 ///< Software reset.
91 * SSC Clock Mode Register
94 #define SSC_CMR_OFF 0x00000004 ///< Clock mode register offset.
96 #define SSC_DIV_MASK 0x00000FFF ///< Clock divider.
100 * SSC Receive/Transmit Clock Mode Register
103 #define SSC_RCMR_OFF 0x00000010 ///< Receive clock mode register offset.
104 #define SSC_TCMR_OFF 0x00000018 ///< Transmit clock mode register offset.
106 #define SSC_CKS_MASK 0x00000003 ///< Receive clock selection.
107 #define SSC_CKS_DIV 0x00000000 ///< Divided clock.
108 #define SSC_CKS_CLK 0x00000001 ///< RK/TK clock signal.
109 #define SSC_CKS_PIN 0x00000002 ///< TK/RK pin.
110 #define SSC_CKO_MASK 0x0000001C ///< Receive clock output mode selection.
111 #define SSC_CKO_NONE 0x00000000 ///< None.
112 #define SSC_CKO_CONT 0x00000004 ///< Continous receive clock.
113 #define SSC_CKO_TRAN 0x00000008 ///< Receive clock only during data transfers.
114 #define SSC_CKI 5 ///< Receive clock inversion.
115 #define SSC_CKG_MASK 0x000000C0 ///< Receive clock gating selection.
116 #define SSC_CKG_NONE 0x00000000 ///< None, continous clock.
117 #define SSC_CKG_FL 0x00000040 ///< Continous receive clock.
118 #define SSC_CKG_FH 0x00000080 ///< Receive clock only during data transfers.
119 #define SSC_START_MASK 0x00000F00 ///< Receive start selection.
120 #define SSC_START_CONT 0x00000000 ///< Receive start as soon as enabled.
121 #define SSC_START_TX 0x00000100 ///< Receive start on transmit start.
122 #define SSC_START_RX 0x00000100 ///< Receive start on receive start.
123 #define SSC_START_LOW_F 0x00000200 ///< Receive start on low level RF.
124 #define SSC_START_HIGH_F 0x00000300 ///< Receive start on high level RF.
125 #define SSC_START_FALL_F 0x00000400 ///< Receive start on falling edge RF.
126 #define SSC_START_RISE_F 0x00000500 ///< Receive start on rising edge RF.
127 #define SSC_START_LEVEL_F 0x00000600 ///< Receive start on any RF level change.
128 #define SSC_START_EDGE_F 0x00000700 ///< Receive start on any RF edge.
129 #define SSC_START_COMP0 0x00000800 ///< Receive on compare 0.
130 #define SSC_STOP 12 ///< Receive stop selection.
131 #define SSC_STTDLY_MASK 0x00FF0000 ///< Receive start delay.
132 #define SSC_STTDLY_SHIFT 16 ///< Least significant bit of receive start delay.
133 #define SSC_PERIOD_MASK 0xFF000000 ///< Receive period divider selection.
134 #define SSC_PERIOD_SHIFT 24 ///< Least significant bit of receive period divider selection.
138 * SSC Receive/Transmit Frame Mode Registers
141 #define SSC_RFMR_OFF 0x00000014 ///< Receive frame mode register offset.
142 #define SSC_TFMR_OFF 0x0000001C ///< Transmit frame mode register offset.
144 #define SSC_DATLEN_MASK 0x0000001F ///< Data length.
145 #define SSC_LOOP 5 ///< Receiver loop mode.
146 #define SSC_DATDEF 5 ///< Transmit default value.
148 #define SSC_MSBF 7 ///< Most significant bit first.
149 #define SSC_DATNB_MASK 0x00000F00 ///< Data number per frame.
150 #define SSC_DATNB_SHIFT 8 ///< Least significant bit of data number per frame.
151 #define SSC_FSLEN_MASK 0x000F0000 ///< Receive frame sync. length.
152 #define SSC_FSLEN_SHIFT 16 ///< Least significant bit of receive frame sync. length.
153 #define SSC_FSOS 0x00700000 ///< Receive frame sync. output selection.
154 #define SSC_FSOS_NONE 0x00000000 ///< No frame sync. Line set to input.
155 #define SSC_FSOS_NEGATIVE 0x00100000 ///< Negative pulse.
156 #define SSC_FSOS_POSITIVE 0x00200000 ///< Positive pulse.
157 #define SSC_FSOS_LOW 0x00300000 ///< Low during transfer.
158 #define SSC_FSOS_HIGH 0x00400000 ///< High during transfer.
159 #define SSC_FSOS_TOGGLE 0x00500000 ///< Toggling at each start.
160 #define SSC_FSDEN 23 ///< Frame sync. data enable.
161 #define SSC_FSEDGE 24 ///< Frame sync. edge detection.
165 * SSC Receive Holding Register
168 #define SSC_RHR_OFF 0x00000020 ///< Receive holding register offset.
172 * SSC Transmit Holding Register
175 #define SSC_THR_OFF 0x00000024 ///< Transmit holding register offset.
179 * SSC Receive Sync. Holding Register
182 #define SSC_RSHR_OFF 0x00000030 ///< Receive sync. holding register offset.
186 * SSC Transmit Sync. Holding Register
189 #define SSC_TSHR_OFF 0x00000034 ///< Transmit sync. holding register offset.
193 * SSC Receive Compare 0 Register
196 #define SSC_RC0R_OFF 0x00000038 ///< Receive compare 0 register offset.
200 * SSC Receive Compare 1 Register
203 #define SSC_RC1R_OFF 0x0000003C ///< Receive compare 1 register offset.
207 * SSC Status and Interrupt Register
210 #define SSC_SR_OFF 0x00000040 ///< Status register offset.
211 #define SSC_IER_OFF 0x00000044 ///< Interrupt enable register offset.
212 #define SSC_IDR_OFF 0x00000048 ///< Interrupt disable register offset.
213 #define SSC_IMR_OFF 0x0000004C ///< Interrupt mask register offset.
215 #define SSC_TXRDY 0 ///< Transmit ready.
216 #define SSC_TXEMPTY 1 ///< Transmit empty.
217 #define SSC_ENDTX 2 ///< End of transmission.
218 #define SSC_TXBUFE 3 ///< Transmit buffer empty.
219 #define SSC_RXRDY 4 ///< Receive ready.
220 #define SSC_OVRUN 5 ///< Receive overrun.
221 #define SSC_ENDRX 6 ///< End of receiption.
222 #define SSC_RXBUFF 7 ///< Receive buffer full.
223 #define SSC_CP0 8 ///< Compare 0.
224 #define SSC_CP1 9 ///< Compare 1.
225 #define SSC_TXSYN 10 ///< Transmit sync.
226 #define SSC_RXSYN 11 ///< Receive sync.
227 #define SSC_TXENA 16 ///< Transmit enable.
228 #define SSC_RXENA 17 ///< Receive enable.
231 #if defined(SSC_BASE)
232 #define SSC_CR (*((reg32_t *)(SSC_BASE + SSC_CR_OFF))) ///< Control register address.
233 #define SSC_CMR (*((reg32_t *)(SSC_BASE + SSC_CMR_OFF))) ///< Clock mode register address.
234 #define SSC_RCMR (*((reg32_t *)(SSC_BASE + SSC_RCMR_OFF))) ///< Receive clock mode register address.
235 #define SSC_TCMR (*((reg32_t *)(SSC_BASE + SSC_TCMR_OFF))) ///< Transmit clock mode register address.
236 #define SSC_RFMR (*((reg32_t *)(SSC_BASE + SSC_RFMR_OFF))) ///< Receive frame mode register address.
237 #define SSC_TFMR (*((reg32_t *)(SSC_BASE + SSC_TFMR_OFF))) ///< Transmit frame mode register address.
238 #define SSC_RHR (*((reg32_t *)(SSC_BASE + SSC_RHR_OFF))) ///< Receive holding register address.
239 #define SSC_THR (*((reg32_t *)(SSC_BASE + SSC_THR_OFF))) ///< Transmit holding register address.
240 #define SSC_RSHR (*((reg32_t *)(SSC_BASE + SSC_RSHR_OFF))) ///< Receive sync. holding register address.
241 #define SSC_TSHR (*((reg32_t *)(SSC_BASE + SSC_TSHR_OFF))) ///< Transmit sync. holding register address.
242 #define SSC_RC0R (*((reg32_t *)(SSC_BASE + SSC_RC0R_OFF))) ///< Receive compare 0 register address.
243 #define SSC_RC1R (*((reg32_t *)(SSC_BASE + SSC_RC1R_OFF))) ///< Receive compare 1 register address.
244 #define SSC_SR (*((reg32_t *)(SSC_BASE + SSC_SR_OFF))) ///< Status register address.
245 #define SSC_IER (*((reg32_t *)(SSC_BASE + SSC_IER_OFF))) ///< Interrupt enable register address.
246 #define SSC_IDR (*((reg32_t *)(SSC_BASE + SSC_IDR_OFF))) ///< Interrupt disable register address.
247 #define SSC_IMR (*((reg32_t *)(SSC_BASE + SSC_IMR_OFF))) ///< Interrupt mask register address.
248 #if defined(SSC_HAS_PDC)
249 #define SSC_RPR (*((reg32_t *)(SSC_BASE + PERIPH_RPR_OFF))) ///< PDC receive pointer register address.
250 #define SSC_RCR (*((reg32_t *)(SSC_BASE + PERIPH_RCR_OFF))) ///< PDC receive counter register address.
251 #define SSC_TPR (*((reg32_t *)(SSC_BASE + PERIPH_TPR_OFF))) ///< PDC transmit pointer register address.
252 #define SSC_TCR (*((reg32_t *)(SSC_BASE + PERIPH_TCR_OFF))) ///< PDC transmit counter register address.
253 #define SSC_RNPR (*((reg32_t *)(SSC_BASE + PERIPH_RNPR_OFF))) ///< PDC receive next pointer register address.
254 #define SSC_RNCR (*((reg32_t *)(SSC_BASE + PERIPH_RNCR_OFF))) ///< PDC receive next counter register address.
255 #define SSC_TNPR (*((reg32_t *)(SSC_BASE + PERIPH_TNPR_OFF))) ///< PDC transmit next pointer register address.
256 #define SSC_TNCR (*((reg32_t *)(SSC_BASE + PERIPH_TNCR_OFF))) ///< PDC transmit next counter register address.
257 #define SSC_PTCR (*((reg32_t *)(SSC_BASE + PERIPH_PTCR_OFF))) ///< PDC transfer control register address.
258 #define SSC_PTSR (*((reg32_t *)(SSC_BASE + PERIPH_PTSR_OFF))) ///< PDC transfer status register address.
259 #endif /* SSC_HAS_PDC */
261 #endif /* SSC_BASE */
264 #endif /* AT91_SSC_H */