source: trunk/softs/tsar_boot/src/reset_ioc.c @ 964

Last change on this file since 964 was 962, checked in by alain, 10 years ago

Introducing a new IOC driver supporting the VciMultiAhci? disk controller (in polling mode only).
Extending the MMC driver to support the SYNC command requested by the AHCI protocol on the tsar_generic_iob platform.

File size: 1.8 KB
Line 
1/**
2 * \file   reset_ioc.c
3 * \date   December 2013
4 * \author Cesar Fuguet
5 *
6 * \brief  API for accessing the disk controller
7 *
8 * \note   These functions call the specific disk controller driver depending
9 *         on the USE_IOC_BDV, USE_IOC_SDC or USE_IOC_RDK constants
10 */
11
12#include <reset_ioc.h>
13#include <defs.h>
14
15#if (USE_IOC_BDV + USE_IOC_SDC + USE_IOC_RDK + USE_IOC_HBA) != 1
16#   error "in reset_ioc.c : undefined disk controller in hard_config.h"
17#endif
18
19#if USE_IOC_SDC
20#include <reset_sdc.h>
21#endif
22
23#if USE_IOC_BDV
24#include <reset_bdv.h>
25#endif
26
27#if USE_IOC_RDK
28#include <reset_rdk.h>
29#endif
30
31#if USE_IOC_HBA
32#include <reset_hba.h>
33#endif
34
35
36/**
37 * \brief Initialize the disk controller
38 */
39int reset_ioc_init()
40{
41#if USE_IOC_BDV
42    return reset_bdv_init();
43#elif USE_IOC_SDC
44    return reset_sdc_init();
45#elif USE_IOC_RDK
46    return reset_rdk_init();
47#elif USE_IOC_HBA
48    return reset_hba_init();
49#else
50#   error "in reset_ioc_init.c : undefined disk controller in hard_config.h"
51#endif
52}
53
54/**
55 * \param lba   : first block index on the disk
56 * \param buffer: base address of the memory buffer
57 * \param count : number of blocks to be transfered
58 *
59 * \brief Transfer data from disk to a memory buffer
60 *
61 * \note  This is a blocking function. The function returns once the transfer
62 *        is completed.
63 */
64int reset_ioc_read( unsigned int lba, void* buffer, unsigned int count )
65{
66#if USE_IOC_BDV
67    return reset_bdv_read(lba, buffer, count);
68#elif USE_IOC_SDC
69    return reset_sdc_read(lba, buffer, count);
70#elif USE_IOC_RDK
71    return reset_rdk_read(lba, buffer, count);
72#elif USE_IOC_HBA
73    return reset_hba_read(lba, buffer, count);
74#else
75#   error "in reset_ioc_read.c : undefined disk controller in hard_config.h"
76#endif
77}
78
79/*
80 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
81 */
Note: See TracBrowser for help on using the repository browser.