1
|
/***************************************************************
|
2
|
*
|
3
|
* OpenBeacon.org - board specific configuration
|
4
|
*
|
5
|
* Copyright 2007 Milosch Meriac <meriac@openbeacon.de>
|
6
|
*
|
7
|
* change this file to reflect hardware design changes
|
8
|
*
|
9
|
***************************************************************
|
10
|
|
11
|
This program is free software; you can redistribute it and/or modify
|
12
|
it under the terms of the GNU General Public License as published by
|
13
|
the Free Software Foundation; version 2.
|
14
|
|
15
|
This program is distributed in the hope that it will be useful,
|
16
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
GNU General Public License for more details.
|
19
|
|
20
|
You should have received a copy of the GNU General Public License along
|
21
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
22
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
23
|
|
24
|
*/
|
25
|
#ifndef Board_h
|
26
|
#define Board_h
|
27
|
|
28
|
#include "lib_AT91SAM7.h"
|
29
|
|
30
|
#define RAMFUNC __attribute__ ((long_call, section (".ramfunc")))
|
31
|
#define IRQFUNC __attribute__ ((interrupt("IRQ")))
|
32
|
#define FIQFUNC __attribute__ ((interrupt("FIQ")))
|
33
|
|
34
|
#define true -1
|
35
|
#define false 0
|
36
|
|
37
|
/*-------------------------------*/
|
38
|
/* SAM7Board Memories Definition */
|
39
|
/*-------------------------------*/
|
40
|
|
41
|
#define ENVIRONMENT_SIZE 1024
|
42
|
#define FLASH_PAGE_NB AT91C_IFLASH_NB_OF_PAGES-(ENVIRONMENT_SIZE/AT91C_IFLASH_PAGE_SIZE)
|
43
|
|
44
|
/*-----------------*/
|
45
|
/* Master Clock */
|
46
|
/*-----------------*/
|
47
|
|
48
|
#define EXT_OC 18432000 // Exetrnal ocilator MAINCK
|
49
|
#define MCK 47923200 // MCK (PLLRC div by 2)
|
50
|
#define MCKKHz (MCK/1000) //
|
51
|
|
52
|
/*-----------------*/
|
53
|
/* Board version */
|
54
|
/*-----------------*/
|
55
|
enum openpicc_release {
|
56
|
OPENPICC_v0_4, /* Schematics v0.4, as sold in the shop */
|
57
|
|
58
|
OPENPICC_v0_4_p1, /* based on schematics v0.4; Modifications:
|
59
|
* + PLL_LOCK relocated from PA4 to PA5
|
60
|
* + Copy of FRAME routed to PA4
|
61
|
* + Connection between R18 and 3V3 removed, instead R18 is now connected to PA31*/
|
62
|
OPENPICC_v0_4_p2, /* Enhancement of v0.4p1, Add:
|
63
|
* + CARRIER can be switched from PLL output to original carrier
|
64
|
* using PA30
|
65
|
*/
|
66
|
OPENPICC_v0_4_karsten, /* Combination of p1 and p2:
|
67
|
* + Has everything v0.4p1 has
|
68
|
* + CARRIER is fixed to original carrier, PLL ist completely out of the loop*/
|
69
|
};
|
70
|
enum clock_source {
|
71
|
CLOCK_SELECT_PLL,
|
72
|
CLOCK_SELECT_CARRIER,
|
73
|
};
|
74
|
|
75
|
struct openpicc_hardware {
|
76
|
enum openpicc_release release;
|
77
|
char *release_name;
|
78
|
struct {
|
79
|
int data_gating:1;
|
80
|
int clock_gating:1;
|
81
|
int clock_switching:1;
|
82
|
} features;
|
83
|
enum clock_source default_clock;
|
84
|
|
85
|
int PLL_LOCK;
|
86
|
|
87
|
int CLOCK_GATE;
|
88
|
int DATA_GATE;
|
89
|
int CLOCK_SWITCH;
|
90
|
};
|
91
|
|
92
|
extern const struct openpicc_hardware OPENPICC_HARDWARE[];
|
93
|
extern const struct openpicc_hardware *OPENPICC;
|
94
|
|
95
|
/*-----------------*/
|
96
|
/* Pins */
|
97
|
/*-----------------*/
|
98
|
|
99
|
#define LED_GREEN AT91C_PIO_PA25
|
100
|
#define LED_RED AT91C_PIO_PA12
|
101
|
#define LED_MASK (LED_GREEN|LED_RED)
|
102
|
|
103
|
#define OPENPICC_PIO_SS2_DT_THRESH AT91C_PIO_PA8
|
104
|
#define OPENPICC_PIO_PLL_INHIBIT AT91C_PIO_PA24
|
105
|
|
106
|
#define OPENPICC_MOD_PWM AT91C_PA23_PWM0
|
107
|
#define OPENPICC_MOD_SSC AT91C_PA17_TD
|
108
|
#define OPENPICC_SSC_DATA AT91C_PA18_RD
|
109
|
#define OPENPICC_SSC_CLOCK AT91C_PA19_RK
|
110
|
#define OPENPICC_SSC_TF AT91C_PIO_PA15
|
111
|
|
112
|
#define OPENPICC_PIO_FRAME AT91C_PIO_PA20
|
113
|
|
114
|
#define OPENPICC_PIO_SSC_DATA_CONTROL AT91C_PIO_PA21
|
115
|
#define OPENPICC_PIO_AB_DETECT AT91C_PIO_PA22
|
116
|
#define OPENPICC_PIO_PLL_INHIBIT AT91C_PIO_PA24
|
117
|
|
118
|
#define OPENPICC_ADC_FIELD_STRENGTH AT91C_ADC_CH4
|
119
|
|
120
|
#define OPENPICC_PIO_LOAD1 AT91C_PIO_PA2
|
121
|
#define OPENPICC_PIO_LOAD2 AT91C_PIO_PA3
|
122
|
|
123
|
#define OPENPICC_PIO_CARRIER_IN AT91C_PA28_TCLK1
|
124
|
#define OPENPICC_PIO_CARRIER_DIV_OUT AT91C_PA1_TIOB0
|
125
|
#define OPENPICC_PIO_CDIV_HELP_OUT AT91C_PA0_TIOA0
|
126
|
#define OPENPICC_PIO_CDIV_HELP_IN AT91C_PA29_TCLK2
|
127
|
|
128
|
#define OPENPICC_IRQ_PRIO_PIO (AT91C_AIC_PRIOR_LOWEST+4)
|
129
|
#define OPENPICC_IRQ_PRIO_SSC (AT91C_AIC_PRIOR_HIGHEST-1)
|
130
|
#define OPENPCD_IRQ_PRIO_TC_FDT (AT91C_AIC_PRIOR_LOWEST+3)
|
131
|
|
132
|
/*-----------------*/
|
133
|
/* task priorities */
|
134
|
/*-----------------*/
|
135
|
|
136
|
#define TASK_BEACON_PRIORITY ( tskIDLE_PRIORITY )
|
137
|
#define TASK_BEACON_STACK ( 512 )
|
138
|
|
139
|
#define TASK_CMD_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
140
|
#define TASK_CMD_STACK ( 512 )
|
141
|
|
142
|
#define TASK_USB_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
143
|
#define TASK_USB_STACK ( 512 )
|
144
|
|
145
|
#define TASK_ISO_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
146
|
#define TASK_ISO_STACK ( 512 )
|
147
|
|
148
|
#define TASK_NRF_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
149
|
#define TASK_NRF_STACK ( 512 )
|
150
|
|
151
|
#endif /* Board_h */
|