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

Last change on this file since 796 was 796, checked in by cfuguet, 10 years ago

tsar_generic_leti, tsar_boot: used USE_IOC_RDK instead of USE_RAMDISK

  • This is the name of the constant generated by the genmap tool into the hard_config.h file.
  • Instantiating the block device in the arch.py file only when the ramdisk is not used (GIET-VM supports only one IO controller)
File size: 1.7 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 *
8 * \note   These functions call the specific disk controller driver depending
[796]9 *         on the USE_IOC_BDV, USE_IOC_SPI or USE_IOC_RDK constants
[758]10 */
11
[586]12#include <reset_ioc.h>
[758]13#include <defs.h>
[292]14
[796]15#if !defined(USE_IOC_BDV) && !defined(USE_IOC_SPI) && !defined(USE_IOC_RDK)
[758]16#   error "One of the USE_IOC_* constants must be defined in the hard_config.h"
[586]17#endif
[302]18
[796]19#if (USE_IOC_BDV + USE_IOC_SPI + USE_IOC_RDK) != 1
[758]20#   error "Only one disk controller must be used"
21#endif
[302]22
[758]23#if USE_IOC_SPI
24#include <reset_sdc.h>
25#endif
[388]26
[758]27#if USE_IOC_BDV
28#include <reset_bdv.h>
29#endif
[292]30
[796]31#if USE_IOC_RDK
[758]32#include <reset_rdk.h>
[347]33#endif
[568]34
[758]35/**
36 * \brief Initialize the disk controller
37 */
38int reset_ioc_init()
[347]39{
[758]40#if USE_IOC_BDV
41    return reset_bdv_init();
42#elif USE_IOC_SPI
43    return reset_sdc_init();
[796]44#elif USE_IOC_RDK
[758]45    return reset_rdk_init();
46#else
47#   error "reset_ioc_init() : Not supported disk controller chosen"
[347]48#endif
49}
50
[758]51/**
52 * \param lba   : first block index on the disk
53 * \param buffer: base address of the memory buffer
54 * \param count : number of blocks to be transfered
55 *
56 * \brief Transfer data from disk to a memory buffer
57 *
58 * \note  This is a blocking function. The function returns once the transfer
59 *        is completed.
60 */
61int reset_ioc_read( unsigned int lba, void* buffer, unsigned int count )
[568]62{
[758]63#if USE_IOC_BDV
[654]64    return reset_bdv_read(lba, buffer, count);
[758]65#elif USE_IOC_SPI
66    return reset_sdc_read(lba, buffer, count);
[796]67#elif USE_IOC_RDK
[654]68    return reset_rdk_read(lba, buffer, count);
69#else
[758]70#   error "reset_ioc_read() : Not supported disk controller chosen"
[653]71#endif
[568]72}
73
[292]74/*
[758]75 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
[292]76 */
Note: See TracBrowser for help on using the repository browser.