view loadtools/flash.h @ 407:19e5a3e2f9c0

fcup-settime: moved time() retrieval a little closer to the output A fundamental problem with all simple time transfer tools is that there is always some delay between the time retrieval on the source system and that transmitted time being set on the destination, and the resulting time on the destination system is off by that delay amount. This delay cannot be fully eliminated when working in a simple environment like ours, but we should make our best effort to minimize it. In the present case, moving the atinterf_init() call before the time() retrieval should make a teensy-tiny improvement.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 11 Aug 2018 21:52:17 +0000
parents e7502631a0f9
children 0dd2c87c1b63
line wrap: on
line source

/* this header file contains definitions for fc-loadtool flash support */

/*
 * The following structures represent an "abstract"
 * description of flash devices.
 *
 * A "region" is a consecutive group of erase units of the same size.
 */

struct flash_region_desc {
	uint32_t	sector_size;
	unsigned	nsectors;
};

#define	CFI_MAX_REGIONS		4

/*
 * The info in struct flash_geom can be either
 * gathered from CFI or hard-coded.
 */
struct flash_geom {
	uint32_t			total_size;
	unsigned			nregions;
	struct flash_region_desc	regions[CFI_MAX_REGIONS];
	unsigned			total_sectors;
};

struct flash_idcheck {
	uint16_t	offset;
	uint16_t	expect_val;
};

struct flash_bank_desc {
	uint32_t		align_size;
	struct flash_geom	*geom;
	struct flash_idcheck	*idcheck_table;
	unsigned		idcheck_num;
};

struct flash_device_desc {
	char			*name;
	struct flash_bank_desc	*bank_desc;
	unsigned		nbanks;
	struct flash_cmdset	*cmdset;
};

/* the following structures describe flash banks as accessible to us */

struct sector_info {
	uint32_t	start;
	uint32_t	size;
};

struct flash_cmdset {
	char	*cmdset_name;
	int	(*reset_cmd)();
	int	(*status_cmd)();
	int	(*unlock_sector)();
	int	(*erase_sector)();
	int	(*prep_for_program)();
	char	*loadagent_setbase_cmd;
	char	*loadagent_program_cmd;
	int	needs_unlock;
};

struct flash_bank_info {
	uint32_t		base_addr;
	struct flash_bank_desc	*bank_desc;
	struct flash_geom	*geom;
	struct flash_cmdset	*ops;
	struct sector_info	*sectors;
	int			idcheck_done;
};