Project

General

Profile

Download (2.06 KB) Statistics
| Branch: | Tag: | Revision:
1 32985a29 laforge
/* AT91SAM7 "dumb reader" 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 caf50003 (no author)
#include <errno.h>
21
#include <include/lib_AT91SAM7.h>
22
#include <include/openpcd.h>
23 520784c7 (no author)
#include <os/dbgu.h>
24 caf50003 (no author)
#include "rc632.h"
25 1092475d meri
#include "rc632_highlevel.h"
26 520784c7 (no author)
#include <os/led.h>
27
#include <os/pcd_enumerate.h>
28
#include <os/usb_handler.h>
29
#include "../openpcd.h"
30
#include <os/main.h>
31 caf50003 (no author)
32 28eb4a57 laforge
#define RAH NULL
33
34 caf50003 (no author)
void _init_func(void)
35
{
36
	rc632_init();
37
}
38
39 9d0d7022 (no author)
int _main_dbgu(char key)
40
{
41 3a98ae12 (no author)
	unsigned char value;
42
43
	switch (key) {
44
	case '4':
45
		AT91F_DBGU_Printk("Testing RC632 : ");
46
		if (rc632_test(RAH) == 0)
47
			AT91F_DBGU_Printk("SUCCESS!\n\r");
48
		else
49
			AT91F_DBGU_Printk("ERROR!\n\r");
50
			
51
		break;
52
	case '5':
53 28eb4a57 laforge
		opcd_rc632_reg_read(RAH, RC632_REG_RX_WAIT, &value);
54 3a98ae12 (no author)
		DEBUGPCR("Reading RC632 Reg RxWait: 0x%02xr", value);
55
56
		break;
57
	case '6':
58
		DEBUGPCR("Writing RC632 Reg RxWait: 0x55");
59 28eb4a57 laforge
		opcd_rc632_reg_write(RAH, RC632_REG_RX_WAIT, 0x55);
60 3a98ae12 (no author)
		break;
61
	case '7':
62
		rc632_dump();
63
		break;
64
	case 'P':
65
		rc632_power(1);
66 1092475d meri
		rc632_init();
67 3a98ae12 (no author)
		break;
68
	case 'p':
69
		rc632_power(0);
70
		break;
71
	}
72
73 9d0d7022 (no author)
	return -EINVAL;
74
}
75
76 caf50003 (no author)
void _main_func(void)
77
{
78 1092475d meri
	static int i;
79
	
80
	if(i<4096)
81
	    i++;
82
	else
83
	{
84
	    led_toggle(1);
85
	    i=0;
86
	}
87
	
88 e0649fea (no author)
	/* first we try to get rid of pending to-be-sent stuff */
89 a5c8f60f (no author)
	usb_out_process();
90 e0649fea (no author)
91 8ac31009 Holger Hans Peter Freyther
	/* next we deal with incoming requests from USB EP1 (OUT) */
92 14055f6e (no author)
	usb_in_process();
93 e0649fea (no author)
94
	rc632_unthrottle();
95 caf50003 (no author)
}
Add picture from clipboard (Maximum size: 48.8 MB)