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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
/*
* RTEMS for Nintendo DS flash driver.
*
* Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.rtems.com/license/LICENSE
*
* $Id$
*/
#include <rtems.h>
#include <bsp.h>
#include <libchip/ide_ctrl.h>
#include <libchip/ide_ctrl_cfg.h>
#include <libchip/ide_ctrl_io.h>
#include <disc.h>
bool
nds_flash_probe (int minor)
{
return true;
}
void
nds_flash_initialize (int minor)
{
const IO_INTERFACE *flash;
printk ("[+] flash started\n");
flash = _FAT_disc_dsSlotFindInterface ();
if (flash == NULL) {
printk ("[!] error getting device\n");
rtems_fatal_error_occurred (0);
}
if (_FAT_disc_isInserted (flash)) {
printk ("[#] flash inserted\n");
} else {
printk ("[!] flash not inserted\n");
}
}
void
nds_flash_read_reg (int minor, int reg, uint16_t * value)
{
printk ("nds_flash_read_reg\n");
}
void
nds_flash_write_reg (int minor, int reg, uint16_t value)
{
printk ("nds_flash_write_reg\n");
}
void
nds_flash_read_block (int minor, uint32_t block_size,
rtems_blkdev_sg_buffer * bufs,
uint32_t * cbuf, uint32_t * pos)
{
printk ("nds_flash_read_block\n");
}
void
nds_flash_write_block (int minor, uint32_t block_size,
rtems_blkdev_sg_buffer * bufs,
uint32_t * cbuf, uint32_t * pos)
{
printk ("nds_flash_write_block\n");
}
int
nds_flash_control (int minor, uint32_t cmd, void *arg)
{
printk ("nds_flash_control\n");
return 0;
}
rtems_status_code
nds_flash_io_speed (int minor, uint16_t mode)
{
return RTEMS_SUCCESSFUL;
}
ide_ctrl_fns_t nds_flash_ctrl_fns = {
nds_flash_probe,
nds_flash_initialize,
nds_flash_control,
nds_flash_read_reg,
nds_flash_write_reg,
nds_flash_read_block,
nds_flash_write_block,
nds_flash_io_speed
};
/* IDE controllers Table */
ide_controller_bsp_table_t IDE_Controller_Table[] = {
{
"/dev/flash",
IDE_CUSTOM, /* standard IDE controller */
&nds_flash_ctrl_fns,
NULL, /* probe for IDE standard registers */
FALSE, /* not (yet) initialized */
0x0, /* base I/O address for first IDE controller */
FALSE, 0, /* not (yet) interrupt driven */
NULL
}
};
/* Number of rows in IDE_Controller_Table */
unsigned long IDE_Controller_Count = 1;
|