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
|
/* USB Device Firmware for OpenPCD
* (C) 2006 by Harald Welte <hwelte@hmw-consulting.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <errno.h>
#include <string.h>
#include <compile.h>
#include <include/lib_AT91SAM7.h>
#include <os/dbgu.h>
#include <os/led.h>
#include <os/blinkcode.h>
#include <os/main.h>
#include <os/power.h>
#include <os/system_irq.h>
#include <os/pit.h>
#include <os/wdt.h>
#include <os/usbcmd_generic.h>
#include <os/pcd_enumerate.h>
#include "../openpcd.h"
#include <compile.h>
const struct openpcd_compile_version opcd_version = {
.svnrev = COMPILE_SVNREV,
.date = COMPILE_DATE,
.by = COMPILE_BY,
};
int main(void)
{
/* initialize LED and debug unit */
led_init();
sysirq_init();
AT91F_DBGU_Init();
AT91F_PIOA_CfgPMC();
wdt_init();
pit_init();
blinkcode_init();
/* initialize USB */
req_ctx_init();
usbcmd_gen_init();
udp_open();
/* call application specific init function */
_init_func();
// Enable User Reset and set its minimal assertion to 960 us
AT91C_BASE_RSTC->RSTC_RMR =
AT91C_RSTC_URSTEN | (0x4 << 8) | (unsigned int)(0xA5 << 24);
#ifdef DEBUG_CLOCK_PA6
AT91F_PMC_EnablePCK(AT91C_BASE_PMC, 0, AT91C_PMC_CSS_PLL_CLK);
AT91F_PIO_CfgPeriph(AT91C_BASE_PIOA, 0, AT91C_PA6_PCK0);
#endif
/* switch on first led */
led_switch(2, 1);
DEBUGPCRF("entering main (idle) loop");
while (1) {
/* Call application specific main idle function */
_main_func();
dbgu_rb_flush();
/* restart watchdog timer */
wdt_restart();
#ifdef CONFIG_IDLE
//cpu_idle();
#endif
}
}
|