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
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_SPI or USE_IOC_RDK constants
10 */
11
12#include <reset_ioc.h>
13#include <defs.h>
14
15#if !defined(USE_IOC_BDV) && !defined(USE_IOC_SPI) && !defined(USE_IOC_RDK)
16#   error "One of the USE_IOC_* constants must be defined in the hard_config.h"
17#endif
18
19#if (USE_IOC_BDV + USE_IOC_SPI + USE_IOC_RDK) != 1
20#   error "Only one disk controller must be used"
21#endif
22
23#if USE_IOC_SPI
24#include <reset_sdc.h>
25#endif
26
27#if USE_IOC_BDV
28#include <reset_bdv.h>
29#endif
30
31#if USE_IOC_RDK
32#include <reset_rdk.h>
33#endif
34
35/**
36 * \brief Initialize the disk controller
37 */
38int reset_ioc_init()
39{
40#if USE_IOC_BDV
41    return reset_bdv_init();
42#elif USE_IOC_SPI
43    return reset_sdc_init();
44#elif USE_IOC_RDK
45    return reset_rdk_init();
46#else
47#   error "reset_ioc_init() : Not supported disk controller chosen"
48#endif
49}
50
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 )
62{
63#if USE_IOC_BDV
64    return reset_bdv_read(lba, buffer, count);
65#elif USE_IOC_SPI
66    return reset_sdc_read(lba, buffer, count);
67#elif USE_IOC_RDK
68    return reset_rdk_read(lba, buffer, count);
69#else
70#   error "reset_ioc_read() : Not supported disk controller chosen"
71#endif
72}
73
74/*
75 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
76 */
Note: See TracBrowser for help on using the repository browser.