/* Initializes a Media instance and the associated physical interface  */
unsigned char MEDSdcard_Initialize(Media *media, unsigned char mciID)
/* Initializes a Media instance and the associated physical interface  */
unsigned char MEDSdcard_Initialize(Media *media, unsigned char mciID)
{
    TRACE_INFO("MEDSdcard init\n\r");
    if ( !SD_CARD_PRESENT(  ) )
    {
        return 0;
    }
    media->write = MEDSdcard_Write;
    media->read = MEDSdcard_Read;
    media->lock = 0;
    media->unlock = 0;
    media->handler = 0;
    media->flush = 0;
    media->blockSize = BLOCK_SIZE;
    media->baseAddress = 0;
    media->size = SD_GET_BLOCKNR();
    media->mappedRD  = 0;
    media->mappedWR  = 0;
    media->protected = 0;
    media->removable = 1;
    media->state = MED_STATE_READY;
    media->transfer.data = 0;
    media->transfer.address = 0;
    media->transfer.length = 0;
    media->transfer.callback = 0;
    media->transfer.argument = 0;
    return 1;
}