view fluid-mnf/flash.h @ 313:9b5079989681

frbl/reconst/inc/command.h: tab fixes
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 04 Mar 2020 23:10:48 +0000
parents 9cecc930d78f
children
line wrap: on
line source

/******************************************************************************
 * FLUID (Flash Loader Utility Independent of Device)
 * Idea, design and coding by Mads Meisner-Jensen, mmj@ti.com
 *
 * Copyright Texas Instruments, 2001.
 * Mads Meisner-Jensen, mmj@ti.com.
 *
 * Flash device database and lookup
 *
 * $Id: flash.h 1.11 Wed, 30 Oct 2002 12:09:08 +0100 tsj $
 *
 ******************************************************************************/


/******************************************************************************
 * Prototypes
 ******************************************************************************/

struct sector_s {
    int addr;
    int size;
};

// We make room for a device of 2047 * 64kB + plus 8 * 8kB sectors (eg. 1Gb)
struct memmap_s {
    struct memmap_s *next;
    char *name;
    int size;
    struct sector_s sectors[2047+7];
};

struct device_s {
    struct device_s *next;
    int algorithm_id;
    int manufacturer_id;
    int device_id;
    char *name;
    int t_erase;   // typical time (milli-seconds) for erasing one sector
    int t_program; // typical time (micro-seconds) for programming one word
    struct memmap_s *memmap;
};

struct manufact_s {
    // struct manufact_s *next;
    int id;
    char *name;
};

struct algorithm_s {
    int id;
    char *name;
};

enum FlashAlgorithms {
    ALGORITHM_AMD      = 1,
    ALGORITHM_AMDFAST,
    ALGORITHM_INTEL,
    ALGORITHM_INTEL_BW,
    ALGORITHM_MITSUBISHI,
    ALGORITHM_SST
};

enum FlashManufacturers {
    MANUFACT_AMD        = 0x01,
    MANUFACT_ATMEL      = 0x1F,
    MANUFACT_FUJITSU    = 0x04,
    MANUFACT_INTEL      = 0x89,
    MANUFACT_MXIC       = 0xC2,
    MANUFACT_MITSUBISHI = 0x1C,
    MANUFACT_SAMSUNG    = 0xEC,
    MANUFACT_SHARP      = 0xB0,
    MANUFACT_STM        = 0x20,
    MANUFACT_SST        = 0xBF,
    MANUFACT_TOSHIBA    = 0x98,
    MANUFACT_TEST       = 0xFF
};


/******************************************************************************
 * Prototypes
 ******************************************************************************/

void device_print(struct device_s *device, char format);
void devices_list(void);
void file_read_devices(char *filename);

int get_next_line(void);
int get_token(void);
int get_keyword(void);
int get_string(void);
int get_number(void);

int time_compute(struct device_s *device,
                 int sectors, int bytes, int chunks,
                 int *time_erase, int *time_program, int *time_trransfer);
    
struct device_s *device_lookup_by_id(int manid, int devid);
struct memmap_s *memmap_lookup_by_name(char *name);
char *manufacturer_name_lookup_by_id(int id);
int   manufacturer_id_lookup_by_name(char *name);
char *algorithm_name_lookup_by_id(int id);
int   algorithm_id_lookup_by_name(char *name);