Subversion Repositories freemyipod

Rev

Rev 621 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
54 theseven 1
/***************************************************************************
2
 *             __________               __   ___.
3
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
4
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
5
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
6
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
7
 *                     \/            \/     \/    \/            \/
8
 * $Id$
9
 *
10
 * Copyright (C) 2002 by Alan Korr
11
 * Copyright (C) 2008 by Frank Gevaerts
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
 * KIND, either express or implied.
20
 *
21
 ****************************************************************************/
22
#ifndef __STORAGE_H__
23
#define __STORAGE_H__
24
 
25
#include "global.h"
26
#include "mv.h"
27
 
153 theseven 28
#define STORAGE_GET_INFO
29
 
54 theseven 30
#if (CONFIG_STORAGE & STORAGE_SD)
31
#include "storage_sd.h"
32
#endif
33
#if (CONFIG_STORAGE & STORAGE_MMC)
34
#include "storage_mmc.h"
35
#endif
36
#if (CONFIG_STORAGE & STORAGE_ATA)
37
#include "storage_ata.h"
38
#endif
39
#if (CONFIG_STORAGE & STORAGE_NAND)
40
#include "storage_nand.h"
41
#endif
42
#if (CONFIG_STORAGE & STORAGE_RAMDISK)
43
#include "storage_ramdisk.h"
44
#endif
45
 
46
struct storage_info
47
{
48
    unsigned int sector_size;
49
    unsigned int num_sectors;
50
    char *vendor;
51
    char *product;
52
    char *revision;
612 theseven 53
    void *driverinfo;
54 theseven 54
};
55
 
56
#if !defined(CONFIG_STORAGE_MULTI)
57
/* storage_spindown, storage_sleep and storage_spin are passed as
58
 * pointers, which doesn't work with argument-macros.
59
 */
60
    #if (CONFIG_STORAGE & STORAGE_ATA)
61
        #define STORAGE_FUNCTION(NAME) (ata_## NAME)
62
    #elif (CONFIG_STORAGE & STORAGE_SD)
63
        #define STORAGE_FUNCTION(NAME) (sd_## NAME)
64
     #elif (CONFIG_STORAGE & STORAGE_MMC)
65
        #define STORAGE_FUNCTION(NAME) (mmc_## NAME)
66
    #elif (CONFIG_STORAGE & STORAGE_NAND)
67
        #define STORAGE_FUNCTION(NAME) (nand_## NAME)
68
    #elif (CONFIG_STORAGE & STORAGE_RAMDISK)
69
        #define STORAGE_FUNCTION(NAME) (ramdisk_## NAME)
70
    #else
71
        //#error No storage driver!
72
    #endif
621 theseven 73
#endif
54 theseven 74
 
75
void storage_enable(bool on);
76
void storage_sleep(void);
77
void storage_sleepnow(void);
78
bool storage_disk_is_active(void);
79
int storage_soft_reset(void);
80
int storage_init(void);
81
int storage_flush(void);
82
void storage_spin(void);
83
void storage_spindown(int seconds);
84
long storage_last_disk_activity(void);
85
int storage_num_drives(void);
86
#ifdef HAVE_HOTSWAP
87
bool storage_removable(int drive);
88
bool storage_present(int drive);
89
#endif
90
 
91
int storage_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf);
116 theseven 92
int storage_read_sectors_md(int drive, unsigned long start, int count, void* buf);
54 theseven 93
int storage_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf);
116 theseven 94
int storage_write_sectors_md(int drive, unsigned long start, int count, const void* buf);
153 theseven 95
#ifdef STORAGE_GET_INFO
96
void storage_get_info(int drive, struct storage_info *info);
54 theseven 97
#endif
153 theseven 98
#endif