diff loadtools/flashops.c @ 408:431023033c86

Intel flash: flash status command implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 17 Jun 2014 01:52:46 +0000
parents f2cc551e597f
children 23ab8fe81764
line wrap: on
line diff
--- a/loadtools/flashops.c	Tue Jun 17 01:39:59 2014 +0000
+++ b/loadtools/flashops.c	Tue Jun 17 01:52:46 2014 +0000
@@ -107,6 +107,27 @@
 	return(0);
 }
 
+intel_status_cmd(bi)
+	struct flash_bank_info *bi;
+{
+	int stat;
+	uint16_t sr;
+
+	/* issue Read SR command */
+	stat = do_w16(bi->base_addr, 0x70);
+	if (stat) {
+		fprintf(stderr,
+			"unexpected response to w16 for Read SR command\n");
+		return(-1);
+	}
+	stat = do_r16(bi->base_addr, &sr);
+	if (stat)
+		return(stat);	/* error msg already printed */
+	sr &= 0xFF;
+	printf("Status Register: %02X\n", sr);
+	return(0);
+}
+
 intel_sector_unlock(bi, sp)
 	struct flash_bank_info *bi;
 	struct sector_info *sp;
@@ -174,7 +195,7 @@
 struct flash_cmdset flash_cmdset_intel = {
 	.cmdset_name		= "Intel",
 	.reset_cmd		= intel_reset_cmd,
-	.status_cmd		= invalid,
+	.status_cmd		= intel_status_cmd,
 	.unlock_sector		= intel_sector_unlock,
 	.erase_sector		= intel_sector_erase,
 	.loadagent_setbase_cmd	= "INFB",