probe_smartmedia.c revision fc863deadaf07da24f3593fca6c6e09b62cd772c
/*
* Copyright (C) 2010 - Maxim Levitsky
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* mtd_probe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with mtd_probe; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <mtd/mtd-user.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <stdlib.h>
#include "mtd_probe.h"
static const uint8_t cis_signature[] = {
0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, 0xDF, 0x01, 0x20
};
{
int sector_size;
int block_size;
int size_in_megs;
int spare_count;
int offset;
int cis_found = 0;
if (!cis_buffer)
return;
goto exit;
goto exit;
switch(size_in_megs) {
case 1:
case 2:
spare_count = 6;
break;
case 4:
spare_count = 12;
break;
default:
spare_count = 24;
break;
}
offset += sector_size) {
cis_found = 1;
break;
}
}
if (!cis_found)
goto exit;
sizeof(cis_signature)) != 0))
goto exit;
printf("MTD_FTL=smartmedia\n");
exit(0);
exit:
return;
}