1 |
32985a29
|
laforge
|
/* USB Device Firmware for OpenPCD
|
2 |
|
|
* (C) 2006 by Harald Welte <hwelte@hmw-consulting.de>
|
3 |
|
|
*
|
4 |
|
|
* This program is free software; you can redistribute it and/or modify
|
5 |
|
|
* it under the terms of the GNU General Public License as published by
|
6 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
7 |
|
|
* (at your option) any later version.
|
8 |
|
|
*
|
9 |
|
|
* This program is distributed in the hope that it will be useful,
|
10 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
* GNU General Public License for more details.
|
13 |
|
|
*
|
14 |
|
|
* You should have received a copy of the GNU General Public License
|
15 |
|
|
* along with this program; if not, write to the Free Software
|
16 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
17 |
|
|
*
|
18 |
|
|
*/
|
19 |
|
|
|
20 |
41333333
|
(no author)
|
#include <errno.h>
|
21 |
|
|
#include <string.h>
|
22 |
706ffa9f
|
laforge
|
#include <compile.h>
|
23 |
e71336c5
|
(no author)
|
#include <include/lib_AT91SAM7.h>
|
24 |
520784c7
|
(no author)
|
#include <os/dbgu.h>
|
25 |
|
|
#include <os/led.h>
|
26 |
f796b3e4
|
laforge
|
#include <os/blinkcode.h>
|
27 |
83c18361
|
(no author)
|
#include <os/main.h>
|
28 |
b4d004d9
|
(no author)
|
#include <os/power.h>
|
29 |
f796b3e4
|
laforge
|
#include <os/system_irq.h>
|
30 |
|
|
#include <os/pit.h>
|
31 |
|
|
#include <os/wdt.h>
|
32 |
514b0f72
|
laforge
|
#include <os/usbcmd_generic.h>
|
33 |
83c18361
|
(no author)
|
#include <os/pcd_enumerate.h>
|
34 |
520784c7
|
(no author)
|
#include "../openpcd.h"
|
35 |
f57b548d
|
(no author)
|
|
36 |
514b0f72
|
laforge
|
#include <compile.h>
|
37 |
|
|
|
38 |
|
|
const struct openpcd_compile_version opcd_version = {
|
39 |
|
|
.svnrev = COMPILE_SVNREV,
|
40 |
|
|
.date = COMPILE_DATE,
|
41 |
|
|
.by = COMPILE_BY,
|
42 |
|
|
};
|
43 |
|
|
|
44 |
f57b548d
|
(no author)
|
int main(void)
|
45 |
|
|
{
|
46 |
caf50003
|
(no author)
|
/* initialize LED and debug unit */
|
47 |
5f148f59
|
(no author)
|
led_init();
|
48 |
bfff30bf
|
laforge
|
sysirq_init();
|
49 |
f57b548d
|
(no author)
|
AT91F_DBGU_Init();
|
50 |
caf50003
|
(no author)
|
|
51 |
ad18651c
|
(no author)
|
AT91F_PIOA_CfgPMC();
|
52 |
48afc6a1
|
laforge
|
wdt_init();
|
53 |
bfff30bf
|
laforge
|
pit_init();
|
54 |
f796b3e4
|
laforge
|
blinkcode_init();
|
55 |
caf50003
|
(no author)
|
|
56 |
83c18361
|
(no author)
|
/* initialize USB */
|
57 |
514b0f72
|
laforge
|
req_ctx_init();
|
58 |
|
|
usbcmd_gen_init();
|
59 |
83c18361
|
(no author)
|
udp_open();
|
60 |
|
|
|
61 |
48afc6a1
|
laforge
|
/* call application specific init function */
|
62 |
|
|
_init_func();
|
63 |
|
|
|
64 |
f57b548d
|
(no author)
|
// Enable User Reset and set its minimal assertion to 960 us
|
65 |
|
|
AT91C_BASE_RSTC->RSTC_RMR =
|
66 |
|
|
AT91C_RSTC_URSTEN | (0x4 << 8) | (unsigned int)(0xA5 << 24);
|
67 |
|
|
|
68 |
5f148f59
|
(no author)
|
#ifdef DEBUG_CLOCK_PA6
|
69 |
|
|
AT91F_PMC_EnablePCK(AT91C_BASE_PMC, 0, AT91C_PMC_CSS_PLL_CLK);
|
70 |
|
|
AT91F_PIO_CfgPeriph(AT91C_BASE_PIOA, 0, AT91C_PA6_PCK0);
|
71 |
|
|
#endif
|
72 |
|
|
|
73 |
caf50003
|
(no author)
|
/* switch on first led */
|
74 |
b4d004d9
|
(no author)
|
led_switch(2, 1);
|
75 |
5f148f59
|
(no author)
|
|
76 |
caf50003
|
(no author)
|
DEBUGPCRF("entering main (idle) loop");
|
77 |
f57b548d
|
(no author)
|
while (1) {
|
78 |
caf50003
|
(no author)
|
/* Call application specific main idle function */
|
79 |
|
|
_main_func();
|
80 |
98f3bcf7
|
meri
|
|
81 |
|
|
/* restart watchdog timer */
|
82 |
|
|
wdt_restart();
|
83 |
b4d004d9
|
(no author)
|
#ifdef CONFIG_IDLE
|
84 |
|
|
//cpu_idle();
|
85 |
|
|
#endif
|
86 |
f57b548d
|
(no author)
|
}
|
87 |
|
|
}
|