Last change
on this file since 760 was
758,
checked in by cfuguet, 10 years ago
|
tsar_boot: improving configuration infrastructure
- Using hard_config.h which respects the same sintax that
the hard_config.h file of all TSAR platforms.
This file can be then generated by the GIET-VM genmap
tool or written manually.
- All peripheral drivers have been moved to a drivers
directory and they are compiled as a static library.
This allows GCC to only include in the final .ELF the
object files of used peripherals and not all of them.
- Example hard_config.h and ldscripts have been introduced
in the conf directory.
- Improving comments in all files
|
File size:
1.7 KB
|
Rev | Line | |
---|
[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 |
---|
| 9 | * on the USE_IOC_BDV, USE_IOC_SPI or USE_RAMDISK constants |
---|
| 10 | */ |
---|
| 11 | |
---|
[586] | 12 | #include <reset_ioc.h> |
---|
[758] | 13 | #include <defs.h> |
---|
[292] | 14 | |
---|
[758] | 15 | #if !defined(USE_IOC_BDV) && !defined(USE_IOC_SPI) && !defined(USE_RAMDISK) |
---|
| 16 | # error "One of the USE_IOC_* constants must be defined in the hard_config.h" |
---|
[586] | 17 | #endif |
---|
[302] | 18 | |
---|
[758] | 19 | #if (USE_IOC_BDV + USE_IOC_SPI + USE_RAMDISK) != 1 |
---|
| 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 | |
---|
[758] | 31 | #if USE_RAMDISK |
---|
| 32 | #include <reset_rdk.h> |
---|
[347] | 33 | #endif |
---|
[568] | 34 | |
---|
[758] | 35 | /** |
---|
| 36 | * \brief Initialize the disk controller |
---|
| 37 | */ |
---|
| 38 | int 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(); |
---|
| 44 | #elif USE_RAMDISK |
---|
| 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 | */ |
---|
| 61 | int 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); |
---|
| 67 | #elif USE_RAMDISK |
---|
[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.