1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 * $Id: ramdisk.c 18965 2008-11-01 17:33:21Z gevaerts $
10 * Copyright (C) 2008 Frank Gevaerts
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
27 #define SECTOR_SIZE 512
28 #define NUM_SECTORS 16384
30 unsigned char ramdisk
[SECTOR_SIZE
* NUM_SECTORS
];
32 long last_disk_activity
= -1;
34 int ramdisk_read_sectors(IF_MV2(int drive
,)
39 if(start
+count
>=NUM_SECTORS
)
43 memcpy(buf
,&ramdisk
[start
*SECTOR_SIZE
],count
*SECTOR_SIZE
);
47 int ramdisk_write_sectors(IF_MV2(int drive
,)
52 if(start
+count
>=NUM_SECTORS
)
56 memcpy(&ramdisk
[start
*SECTOR_SIZE
],buf
,count
*SECTOR_SIZE
);
60 int ramdisk_init(void)
65 long ramdisk_last_disk_activity(void)
67 return last_disk_activity
;
70 void ramdisk_sleep(void)
74 void ramdisk_spin(void)
78 void ramdisk_sleepnow(void)
82 void ramdisk_spindown(int seconds
)
86 #ifdef STORAGE_GET_INFO
87 void ramdisk_get_info(struct storage_info
*info
)
89 /* firmware version */
90 info
->revision
="0.00";
92 /* vendor field, need better name? */
93 info
->vendor
="Rockbox";
94 /* model field, need better name? */
95 info
->product
="Ramdisk";
98 info
->num_sectors
=NUM_SECTORS
;
99 info
->sector_size
=SECTOR_SIZE
;