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

Last change on this file since 994 was 992, checked in by alain, 9 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
RevLine 
[758]1/**
2 * \file   reset_ioc.c
3 * \date   December 2013
4 * \author Cesar Fuguet
5 *
6 * \brief  API for accessing the disk controller
7 *
[992]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
[758]10 */
11
[586]12#include <reset_ioc.h>
[758]13#include <defs.h>
[292]14
[992]15#if (USE_IOC_BDV + USE_IOC_SDC + USE_IOC_RDK + USE_IOC_HBA + USE_IOC_SPI) != 1
[962]16#   error "in reset_ioc.c : undefined disk controller in hard_config.h"
[586]17#endif
[302]18
[962]19#if USE_IOC_SDC
[992]20#include <reset_ioc_sdc.h> 
[758]21#endif
[388]22
[758]23#if USE_IOC_BDV
[992]24#include <reset_ioc_bdv.h>
[758]25#endif
[292]26
[796]27#if USE_IOC_RDK
[992]28#include <reset_ioc_rdk.h>
[347]29#endif
[568]30
[962]31#if USE_IOC_HBA
[992]32#include <reset_ioc_hba.h>
[962]33#endif
34
[992]35#if USE_IOC_SPI
36#include <reset_ioc_spi.h>
37#endif
[962]38
[992]39
[758]40/**
41 * \brief Initialize the disk controller
42 */
43int reset_ioc_init()
[347]44{
[758]45#if USE_IOC_BDV
46    return reset_bdv_init();
[962]47#elif USE_IOC_SDC
[758]48    return reset_sdc_init();
[796]49#elif USE_IOC_RDK
[758]50    return reset_rdk_init();
[962]51#elif USE_IOC_HBA
52    return reset_hba_init();
[992]53#elif USE_IOC_SPI
54    return reset_spi_init();
[758]55#else
[962]56#   error "in reset_ioc_init.c : undefined disk controller in hard_config.h"
[347]57#endif
58}
59
[758]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 )
[568]71{
[758]72#if USE_IOC_BDV
[654]73    return reset_bdv_read(lba, buffer, count);
[962]74#elif USE_IOC_SDC
[758]75    return reset_sdc_read(lba, buffer, count);
[796]76#elif USE_IOC_RDK
[654]77    return reset_rdk_read(lba, buffer, count);
[962]78#elif USE_IOC_HBA
79    return reset_hba_read(lba, buffer, count);
[992]80#elif USE_IOC_SPI
81    return reset_spi_read(lba, buffer, count);
[654]82#else
[962]83#   error "in reset_ioc_read.c : undefined disk controller in hard_config.h"
[653]84#endif
[568]85}
86
[292]87/*
[758]88 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
[292]89 */
Note: See TracBrowser for help on using the repository browser.