Project

General

Profile

Download (2.06 KB) Statistics
| Branch: | Tag: | Revision:
1
/* 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
#include <errno.h>
21
#include <include/lib_AT91SAM7.h>
22
#include <include/openpcd.h>
23
#include <os/dbgu.h>
24
#include "rc632.h"
25
#include "rc632_highlevel.h"
26
#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

    
32
#define RAH NULL
33

    
34
void _init_func(void)
35
{
36
	rc632_init();
37
}
38

    
39
int _main_dbgu(char key)
40
{
41
	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
		opcd_rc632_reg_read(RAH, RC632_REG_RX_WAIT, &value);
54
		DEBUGPCR("Reading RC632 Reg RxWait: 0x%02xr", value);
55

    
56
		break;
57
	case '6':
58
		DEBUGPCR("Writing RC632 Reg RxWait: 0x55");
59
		opcd_rc632_reg_write(RAH, RC632_REG_RX_WAIT, 0x55);
60
		break;
61
	case '7':
62
		rc632_dump();
63
		break;
64
	case 'P':
65
		rc632_power(1);
66
		rc632_init();
67
		break;
68
	case 'p':
69
		rc632_power(0);
70
		break;
71
	}
72

    
73
	return -EINVAL;
74
}
75

    
76
void _main_func(void)
77
{
78
	static int i;
79
	
80
	if(i<4096)
81
	    i++;
82
	else
83
	{
84
	    led_toggle(1);
85
	    i=0;
86
	}
87
	
88
	/* first we try to get rid of pending to-be-sent stuff */
89
	usb_out_process();
90

    
91
	/* next we deal with incoming requests from USB EP1 (OUT) */
92
	usb_in_process();
93

    
94
	rc632_unthrottle();
95
}
(2-2/15)
Add picture from clipboard (Maximum size: 48.8 MB)