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

Last change on this file since 1051 was 992, checked in by alain, 10 years ago

Introduce a new driver for SD Card using the 4bits wide SD bus.
THere is now 5 supported block device peripherals, and the driver names
have been re-organised: reset_ioc_xxx with xxx in (bdv, hba, rdk, spi, sdc)

File size: 2.0 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 on
9 *          USE_IOC_BDV / USE_IOC_SDC / USE_IOC_RDK / USE_IOC_SDC / USE_IOC_SPI
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 + USE_IOC_SPI) != 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_ioc_sdc.h> 
21#endif
22
23#if USE_IOC_BDV
24#include <reset_ioc_bdv.h>
25#endif
26
27#if USE_IOC_RDK
28#include <reset_ioc_rdk.h>
29#endif
30
31#if USE_IOC_HBA
32#include <reset_ioc_hba.h>
33#endif
34
35#if USE_IOC_SPI
36#include <reset_ioc_spi.h>
37#endif
38
39
40/**
41 * \brief Initialize the disk controller
42 */
43int reset_ioc_init()
44{
45#if USE_IOC_BDV
46    return reset_bdv_init();
47#elif USE_IOC_SDC
48    return reset_sdc_init();
49#elif USE_IOC_RDK
50    return reset_rdk_init();
51#elif USE_IOC_HBA
52    return reset_hba_init();
53#elif USE_IOC_SPI
54    return reset_spi_init();
55#else
56#   error "in reset_ioc_init.c : undefined disk controller in hard_config.h"
57#endif
58}
59
60/**
61 * \param lba   : first block index on the disk
62 * \param buffer: base address of the memory buffer
63 * \param count : number of blocks to be transfered
64 *
65 * \brief Transfer data from disk to a memory buffer
66 *
67 * \note  This is a blocking function. The function returns once the transfer
68 *        is completed.
69 */
70int reset_ioc_read( unsigned int lba, void* buffer, unsigned int count )
71{
72#if USE_IOC_BDV
73    return reset_bdv_read(lba, buffer, count);
74#elif USE_IOC_SDC
75    return reset_sdc_read(lba, buffer, count);
76#elif USE_IOC_RDK
77    return reset_rdk_read(lba, buffer, count);
78#elif USE_IOC_HBA
79    return reset_hba_read(lba, buffer, count);
80#elif USE_IOC_SPI
81    return reset_spi_read(lba, buffer, count);
82#else
83#   error "in reset_ioc_read.c : undefined disk controller in hard_config.h"
84#endif
85}
86
87/*
88 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
89 */
Note: See TracBrowser for help on using the repository browser.