/* flaneth - flash and ethernet
   Copyright (C) 2007-2012 Stefan Schuermans <stefan@schuermans.info>
   Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html
   a BlinkenArea project - http://www.blinkenarea.org/ */

#include "cf.h"
#include "dosfs.h"

/**
 * @brief read sector(s) from disk
 * @param[in] unit identifies the disk
 * @param[in] buffer to put data into
 * @param[in] sector number of sector
 * @param[in] count number of sectors to read
 * @return 0 on success, -1 on error
 */
uint32_t DFS_ReadSector(uint8_t unit, uint8_t *buffer, uint32_t sector,
                        uint32_t count)
{
  // read sectros from CF card
  for ( ; count > 0; count--, buffer += SECTOR_SIZE)
    if (CfRead(sector, buffer) != 0)
      return -1;
  return 0;
  (void)unit;
}

/**
 * @brief write sector(s) to disk
 * @param[in] unit identifies the disk
 * @param[in] buffer to get data from
 * @param[in] sector number of sector
 * @param[in] count number of sectors to write
 * @return 0 on success, -1 on error
 */
uint32_t DFS_WriteSector(uint8_t unit, uint8_t *buffer, uint32_t sector,
                         uint32_t count)
{
  // writing not supported
  return -1;
  (void)unit;
  (void)buffer;
  (void)sector;
  (void)count;
}

