1 | /* |
---|
2 | * RTEMS for Nintendo DS flash driver. |
---|
3 | * |
---|
4 | * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com> |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in the file LICENSE in this distribution or at |
---|
8 | * |
---|
9 | * http://www.rtems.com/license/LICENSE |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #include <rtems.h> |
---|
15 | #include <bsp.h> |
---|
16 | #include <libchip/ide_ctrl.h> |
---|
17 | #include <libchip/ide_ctrl_cfg.h> |
---|
18 | #include <libchip/ide_ctrl_io.h> |
---|
19 | |
---|
20 | #include <disc.h> |
---|
21 | |
---|
22 | bool |
---|
23 | nds_flash_probe (int minor) |
---|
24 | { |
---|
25 | return true; |
---|
26 | } |
---|
27 | |
---|
28 | void |
---|
29 | nds_flash_initialize (int minor) |
---|
30 | { |
---|
31 | const IO_INTERFACE *flash; |
---|
32 | |
---|
33 | printk ("[+] flash started\n"); |
---|
34 | |
---|
35 | flash = _FAT_disc_dsSlotFindInterface (); |
---|
36 | if (flash == NULL) { |
---|
37 | printk ("[!] error getting device\n"); |
---|
38 | rtems_fatal_error_occurred (0); |
---|
39 | } |
---|
40 | |
---|
41 | if (_FAT_disc_isInserted (flash)) { |
---|
42 | printk ("[#] flash inserted\n"); |
---|
43 | } else { |
---|
44 | printk ("[!] flash not inserted\n"); |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
48 | void |
---|
49 | nds_flash_read_reg (int minor, int reg, uint16_t * value) |
---|
50 | { |
---|
51 | printk ("nds_flash_read_reg\n"); |
---|
52 | } |
---|
53 | |
---|
54 | void |
---|
55 | nds_flash_write_reg (int minor, int reg, uint16_t value) |
---|
56 | { |
---|
57 | printk ("nds_flash_write_reg\n"); |
---|
58 | } |
---|
59 | |
---|
60 | void |
---|
61 | nds_flash_read_block (int minor, uint16_t block_size, |
---|
62 | rtems_blkdev_sg_buffer * bufs, |
---|
63 | uint32_t * cbuf, uint32_t * pos) |
---|
64 | { |
---|
65 | printk ("nds_flash_read_block\n"); |
---|
66 | } |
---|
67 | |
---|
68 | void |
---|
69 | nds_flash_write_block (int minor, uint16_t block_size, |
---|
70 | rtems_blkdev_sg_buffer * bufs, |
---|
71 | uint32_t * cbuf, uint32_t * pos) |
---|
72 | { |
---|
73 | printk ("nds_flash_write_block\n"); |
---|
74 | } |
---|
75 | |
---|
76 | int |
---|
77 | nds_flash_control (int minor, uint32_t cmd, void *arg) |
---|
78 | { |
---|
79 | printk ("nds_flash_control\n"); |
---|
80 | return 0; |
---|
81 | } |
---|
82 | |
---|
83 | rtems_status_code |
---|
84 | nds_flash_io_speed (int minor, uint16_t mode) |
---|
85 | { |
---|
86 | return RTEMS_SUCCESSFUL; |
---|
87 | } |
---|
88 | |
---|
89 | ide_ctrl_fns_t nds_flash_ctrl_fns = { |
---|
90 | nds_flash_probe, |
---|
91 | nds_flash_initialize, |
---|
92 | nds_flash_control, |
---|
93 | nds_flash_read_reg, |
---|
94 | nds_flash_write_reg, |
---|
95 | nds_flash_read_block, |
---|
96 | nds_flash_write_block, |
---|
97 | nds_flash_io_speed |
---|
98 | }; |
---|
99 | |
---|
100 | /* IDE controllers Table */ |
---|
101 | ide_controller_bsp_table_t IDE_Controller_Table[] = { |
---|
102 | { |
---|
103 | "/dev/flash", |
---|
104 | IDE_CUSTOM, /* standard IDE controller */ |
---|
105 | &nds_flash_ctrl_fns, |
---|
106 | NULL, /* probe for IDE standard registers */ |
---|
107 | FALSE, /* not (yet) initialized */ |
---|
108 | 0x0, /* base I/O address for first IDE controller */ |
---|
109 | FALSE, 0, /* not (yet) interrupt driven */ |
---|
110 | NULL |
---|
111 | } |
---|
112 | }; |
---|
113 | |
---|
114 | /* Number of rows in IDE_Controller_Table */ |
---|
115 | unsigned long IDE_Controller_Count = 1; |
---|