summaryrefslogtreecommitdiff
path: root/boards/mistralRevB/board.h
blob: 7b0379dc7feeb3e31ff84440cfe198dafd1b6bd2 (plain)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/* ----------------------------------------------------------------------------
 *         ATMEL Microcontroller Software Support 
 * ----------------------------------------------------------------------------
 * Copyright (c) 2008, Atmel Corporation
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the disclaimer below.
 *
 * Atmel's name may not be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ----------------------------------------------------------------------------
 */

/*
    Title: Board definitions

    About: Purpose
        Definitions for the AT91SAM9265-mistralRevB.
 */

#ifndef BOARD_H 
#define BOARD_H

#if defined(at91sam9265)
    #include "at91sam9265/chip.h"
    #include "at91sam9265/AT91SAM9265.h"
#else
    #error Board does not support the specified chip.
#endif

//------------------------------------------------------------------------------
//         Definitions
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
/// \page "AT91SAM9265-EK - Board Description"
/// This page lists several definition related to the board description
///
/// !Definitions
/// - BOARD_NAME

/// Name of the board.
#define BOARD_NAME "AT91SAM9265-EK"
//------------------------------------------------------------------------------



// for compile only
#define AT91C_ID_TC0    (0)  // not used



//------------------------------------------------------------------------------
//         Clocks
//------------------------------------------------------------------------------
/*
    Constants: Operating frequencies
        BOARD_MAINOSC - Frequency of the board main oscillator.
        BOARD_MCK - Master clock frequency (when using board_lowlevel.c).
 */

//#define BOARD_MAINOSC           16367660
//#define BOARD_MCK               ((16367660*73/7)/2)// Output PLLA Clock (198,656 MHz)
#define BOARD_MCK      25000000  // SW22=ON  SW23=ON  ratio=4 RC1=2


//------------------------------------------------------------------------------
//         SDRAM Settings
//------------------------------------------------------------------------------
/*
    Constants: Operating frequencies
        BOARD_SDRAMC_CR - Configuration of the SDRAM Controller.
        BOARD_SDRAMC_TR - Refresh Timer Register.
 */
#define BOARD_SDRAMC_CR (\
				AT91C_SDRAMC_NC_9  | \
				AT91C_SDRAMC_NR_13 | \
				AT91C_SDRAMC_CAS_2 | \
				AT91C_SDRAMC_NB_4_BANKS | \
				AT91C_SDRAMC_DBW_32_BITS | \
				AT91C_SDRAMC_TWR_2 | \
				AT91C_SDRAMC_TRC_7 | \
				AT91C_SDRAMC_TRP_2 | \
				AT91C_SDRAMC_TRCD_2 | \
				AT91C_SDRAMC_TRAS_5 | \
				AT91C_SDRAMC_TXSR_8 )
#define BOARD_SDRAMC_TR (\
				(BOARD_MCK * 7)/1000000)

#define AT91C_EBI_SDRAM 0x20000000

//------------------------------------------------------------------------------
//         USB
//------------------------------------------------------------------------------
/// \page "MISTRALREVB - USB device"

#define BOARD_USB_BMATTRIBUTES USBConfigurationDescriptor_SELFPOWERED_NORWAKEUP

/// PMC is automatic
#define PMC_BY_HARD

//------------------------------------------------------------------------------
//         Pins
//------------------------------------------------------------------------------

/*
    Constants: SPI pins
        PIN_SPI - SPI pins (minus chip selects).
        PIN_SPI_NPCS1 - Chip select 1 pin.
*/
#define PIN_SPI0 {\
	AT91C_PA1_SPI0_MOSI | \
	AT91C_PA0_SPI0_MISO | \
	AT91C_PA2_SPI0_SPCK, \
	AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}	
#define PIN_SPI0_NPCS0 {AT91C_PA3_SPI0_NPCS0,  AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_SPI0_NPCS1 {AT91C_PC11_SPI0_NPCS1, AT91C_BASE_PIOC, AT91C_ID_PIOCDE, PIO_PERIPH_B, PIO_DEFAULT}
	
/*
    Constants: SSC pins
        PIN_SSC_TRANSMITTER - SSC pins for the transmitter.
*/
#define PIN_SSC_TRANSMITTER  {0x00038000, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}

/*
    Constants: DBGU pins
        PINS_DBGU - List of all DBGU pin definitions (RXD PC30, TXD PC31).
*/
#define PINS_DBGU  {(AT91C_PC30_DRXD | AT91C_PC31_DTXD), AT91C_BASE_PIOC, AT91C_ID_PIOCDE, PIO_PERIPH_A, PIO_DEFAULT}

/*
    Constants: Pushbuttons pins
        PIN_PUSHBUTTON_L - Left click.
        PIN_PUSHBUTTON_R - Right click.
        PINS_PUSHBUTTONS - List of all pushbutton pin definitions.
*/
#define PIN_PUSHBUTTON_1  {1 << 4, AT91C_BASE_PIOC, AT91C_ID_PIOCDE, PIO_INPUT, PIO_PULLUP}
#define PIN_PUSHBUTTON_2  {1 << 5, AT91C_BASE_PIOC, AT91C_ID_PIOCDE, PIO_INPUT, PIO_PULLUP}
#define PINS_PUSHBUTTONS  PIN_PUSHBUTTON_1, PIN_PUSHBUTTON_2

/// Push button #1 index.
#define PUSHBUTTON_BP1   0
/// Push button #2 index.
#define PUSHBUTTON_BP2   1

/*
    Constants: LED pins
        PIN_LED_0    - LED #0 pin definition (PA9).
        PIN_POWERLED - LED #1 pin definition (PA6).
*/
#define PIN_LED_0    {1 << 29, AT91C_BASE_PIOC, AT91C_ID_PIOCDE, PIO_OUTPUT_0, PIO_DEFAULT}
#define PIN_LED_1    {1 << 8, AT91C_BASE_PIOB, AT91C_ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT}
#define PINS_LEDS  PIN_LED_0, PIN_LED_1

/// LED DS1 index.
#define LED_DS1      0
/// LED DS2 index.
#define LED_DS2      1

//------------------------------------------------------------------------------
//  Constants: USB pins
//      PIN_USB_VBUS - USB VBus monitoring pin definition.
//------------------------------------------------------------------------------
#define PIN_USB_VBUS {AT91C_PIO_PC13, AT91C_BASE_PIOC, AT91C_ID_PIOCDE, PIO_INPUT, PIO_DEFAULT}

/*
    Constants: SDRAM pins
        PINS_SDRAM - List of all SDRAM pins definitions.
*/
#define PINS_SDRAM  {0xFFFF0000, AT91C_BASE_PIOD, AT91C_ID_PIOCDE, PIO_PERIPH_A, PIO_DEFAULT}

/// Board SDRAM size
#define BOARD_SDRAM_SIZE   (128*1024*1024)  // 128 MB
/// SDRAM bus width.
#define BOARD_SDRAM_BUSWIDTH    32

/// Source type definition
#define AIC_SRCTYPE   0

#endif //#ifndef BOARD_H

personal git repositories of Harald Welte. Your mileage may vary