Project

General

Profile

Download (2.17 KB) Statistics
| Branch: | Tag: | Revision:
1
/* 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
#include <errno.h>
21
#include <string.h>
22
#include <compile.h>
23
#include <include/lib_AT91SAM7.h>
24
#include <os/dbgu.h>
25
#include <os/led.h>
26
#include <os/blinkcode.h>
27
#include <os/main.h>
28
#include <os/power.h>
29
#include <os/system_irq.h>
30
#include <os/pit.h>
31
#include <os/wdt.h>
32
#include <os/usbcmd_generic.h>
33
#include <os/pcd_enumerate.h>
34
#include "../openpcd.h"
35

    
36
#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
int main(void)
45
{
46
	/* initialize LED and debug unit */
47
	led_init();
48
	sysirq_init();
49
	AT91F_DBGU_Init();
50

    
51
	AT91F_PIOA_CfgPMC();
52
	wdt_init();
53
	pit_init();
54
	blinkcode_init();
55

    
56
	/* initialize USB */
57
	req_ctx_init();
58
	usbcmd_gen_init();
59
	udp_open();
60

    
61
	/* call application specific init function */
62
	_init_func();
63

    
64
	// 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
#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
	/* switch on first led */
74
	led_switch(2, 1);
75

    
76
	DEBUGPCRF("entering main (idle) loop");
77
	while (1) {
78
		/* Call application specific main idle function */
79
		_main_func();
80
		
81
		/* restart watchdog timer */
82
		wdt_restart();
83
#ifdef CONFIG_IDLE
84
		//cpu_idle();
85
#endif
86
	}
87
}
(11-11/40)
Add picture from clipboard (Maximum size: 48.8 MB)