/*

   Dummy file for linux testing port of libbiwak

*/

#include <biwak/flash_i2c.hpp>

CFlashI2c::CFlashI2c( CI2c &_i2c, int address /*=0x50*/ )
    :CFlash(0, 0x1000)
    ,CI2cSlave(_i2c, address)
{

}


CFlashI2c::~CFlashI2c()
{

}

int CFlashI2c::erasePage(address_t address, int count /*=1*/ ) /* virtual override final */
{
    return(0);
}


int CFlashI2c::writeData(address_t address, const void *data, int size) /* virtual override final */
{
    return(0);
}


int CFlashI2c::readData(address_t address, void *data, int size) /*virtual override final*/
{
    return(0);
}


void CFlashI2c::dump()
{
   int status;
   char cdata;

   printf("Dump @0x%X width=%d:\n", getSlaveAddress(), getAddressWidth() == EAddressSize::_16Bits ? 16 : 8 );
   printf("    | -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -A -B -C -D -E -F\n");
   printf("----|------------------------------------------------\n");
   for(int i1=0; i1< 8; i1++)
   {
      printf(" %X- | ", i1);
      for(int i2=0; i2<0x10; i2++)
      {
         status=i2cReadData( (i1*0x10)+i2, &cdata, 1);
         if(status)
         {
            printf("-- ");
         }
         else
         {
            printf("%02X ", cdata);
         }
      }
      printf("\n");
   }
   return;
}


//---fin.---------------------------------------------------------------------
