view loadtools/flash.h @ 1014:961efadd530a default tip

fc-shell TCH DL handler: add support for CSD modes TCH DL capture mechanism in FC Tourmaline firmware has been extended to support CSD modes in addition to speech - add the necessary support on the host tools side. It needs to be noted that this mechanism in its present state does NOT provide the debug utility value that was sought: as we learned only after the code was implemented, TI's DSP has a misfeature in that the buffer we are reading (a_dd_0[]) is zeroed out when the IDS block is enabled, i.e., we are reading all zeros and not the real DL bits we were after. But since the code has already been written, we are keeping it - perhaps we can do some tests with IDS disabled.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 26 Nov 2024 06:27:43 +0000
parents c5133c3c11b1
children
line wrap: on
line source

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

/* global configuration */
#define	FLASH_GLOBAL_CFG_NONE		0
#define	FLASH_GLOBAL_CFG_SINGLE_4M	1
#define	FLASH_GLOBAL_CFG_SINGLE_8M	2
#define	FLASH_GLOBAL_CFG_DUAL_8M	3

/*
 * 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 cfi_check {
	int	offset;
	uint8_t	expect_val;
};

/*
 * In order to examine non-volatile sector lock state of AMD-style flash
 * chips, we need to know how their sectors are grouped for the purpose
 * of locking: aggregation of sectors into groups that can only be locked
 * or unlocked as a unit, and also grouping into independent-read partitions
 * where each partition needs its own Autoselect sequence.
 */

struct lock_group_desc {
	uint32_t	block_size;
	unsigned	nblocks;
	int		is_group;
	int		part_begin;
	int		part_end;
};

#define	MAX_AMD_LOCK_GROUPS	8

struct amd_lock_info {
	unsigned		ngroups;
	struct lock_group_desc	groups[MAX_AMD_LOCK_GROUPS];
	int			have_status_word_3;
	int			have_status_word_7;
	int			have_mode_lock_bits;
	int			have_pln_lock_reg;
	int			(*ppb_program_one)();
	int			(*ppb_program_all)();
	int			(*ppb_erase_all)();
};

struct flash_device {
	char			*name;
	struct cfi_check	*cfi_table;
	int			required_global_config;
	struct flash_geom	*bank_geom[2];
	struct flash_cmdset	*cmdset;
	struct amd_lock_info	*lock_info[2];
};

/* 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)();
	int	(*read_prot_reg)();
	char	*loadagent_setbase_cmd;
	char	*loadagent_program_cmd;
	char	*loadagent_binmode_cmd;
	int	needs_unlock;
};

struct flash_bank_info {
	uint32_t		base_addr;
	struct flash_device	*device;
	struct flash_geom	*geom;
	struct flash_cmdset	*ops;
	struct amd_lock_info	*amd_lock;
	struct sector_info	*sectors;
	int			detect_done;
};