summaryrefslogtreecommitdiff
path: root/firmware/drivers/ata_flash.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-11-01 16:14:28 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-11-01 16:14:28 +0000
commit2f8a0081c64534da23fc0fa9cc685eb7454fd9c9 (patch)
tree84dbdbd5326cb48f43d2ebd5a4c86e992c1d5288 /firmware/drivers/ata_flash.c
parent646cac0bde7b11fa7bcb670d1d76eec78e360485 (diff)
downloadrockbox-2f8a0081c64534da23fc0fa9cc685eb7454fd9c9.tar.gz
rockbox-2f8a0081c64534da23fc0fa9cc685eb7454fd9c9.zip
Apply FS#9500. This adds a storage_*() abstraction to replace ata_*(). To do that, it also introduces sd_*, nand_*, and mmc_*.
This should be a good first step to allow multi-driver targets, like the Elio (ATA/SD), or the D2 (NAND/SD). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18960 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/ata_flash.c')
-rw-r--r--firmware/drivers/ata_flash.c89
1 files changed, 30 insertions, 59 deletions
diff --git a/firmware/drivers/ata_flash.c b/firmware/drivers/ata_flash.c
index d77e05647b..9b1b64145d 100644
--- a/firmware/drivers/ata_flash.c
+++ b/firmware/drivers/ata_flash.c
@@ -19,7 +19,7 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#include "ata.h" 22#include "storage.h"
23#include <stdbool.h> 23#include <stdbool.h>
24#include <string.h> 24#include <string.h>
25 25
@@ -42,8 +42,6 @@
42 42
43#define SECTOR_SIZE (512) 43#define SECTOR_SIZE (512)
44 44
45static unsigned short identify_info[SECTOR_SIZE];
46int ata_spinup_time = 0;
47long last_disk_activity = -1; 45long last_disk_activity = -1;
48 46
49#if CONFIG_FLASH == FLASH_IFP7XX 47#if CONFIG_FLASH == FLASH_IFP7XX
@@ -386,7 +384,7 @@ int flash_disk_read_sectors(unsigned long start,
386 return done; 384 return done;
387} 385}
388 386
389int ata_read_sectors(IF_MV2(int drive,) 387int nand_read_sectors(IF_MV2(int drive,)
390 unsigned long start, 388 unsigned long start,
391 int incount, 389 int incount,
392 void* inbuf) 390 void* inbuf)
@@ -403,7 +401,7 @@ int ata_read_sectors(IF_MV2(int drive,)
403 return 0; 401 return 0;
404} 402}
405 403
406int ata_write_sectors(IF_MV2(int drive,) 404int nand_write_sectors(IF_MV2(int drive,)
407 unsigned long start, 405 unsigned long start,
408 int count, 406 int count,
409 const void* buf) 407 const void* buf)
@@ -414,60 +412,7 @@ int ata_write_sectors(IF_MV2(int drive,)
414 return -1; 412 return -1;
415} 413}
416 414
417/* schedule a single sector write, executed with the the next spinup 415int nand_init(void)
418 (volume 0 only, used for config sector) */
419extern void ata_delayed_write(unsigned long sector, const void* buf)
420{
421 (void)sector;
422 (void)buf;
423}
424
425/* write the delayed sector to volume 0 */
426extern void ata_flush(void)
427{
428
429}
430
431void ata_spindown(int seconds)
432{
433 (void)seconds;
434}
435
436bool ata_disk_is_active(void)
437{
438 return 0;
439}
440
441void ata_sleep(void)
442{
443}
444
445void ata_spin(void)
446{
447}
448
449/* Hardware reset protocol as specified in chapter 9.1, ATA spec draft v5 */
450int ata_hard_reset(void)
451{
452 return 0;
453}
454
455int ata_soft_reset(void)
456{
457 return 0;
458}
459
460void ata_enable(bool on)
461{
462 (void)on;
463}
464
465unsigned short* ata_get_identify(void)
466{
467 return identify_info;
468}
469
470int ata_init(void)
471{ 416{
472 int i, id, id2; 417 int i, id, id2;
473 418
@@ -499,3 +444,29 @@ int ata_init(void)
499 444
500 return 0; 445 return 0;
501} 446}
447
448long nand_last_disk_activity(void)
449{
450 return last_disk_activity;
451}
452
453void nand_get_info(struct storage_info *info)
454{
455 unsigned long blocks;
456 int i;
457
458 /* firmware version */
459 info->revision="0.00";
460
461 /* vendor field, need better name? */
462 info->vendor="Rockbox";
463 /* model field, need better name? */
464 info->product="TNFL";
465
466 /* blocks count */
467 info->num_sectors = 0;
468 info->sector_size=SECTOR_SIZE;
469
470 info->serial=0;
471}
472