#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <sys/time.h>
#include <unistd.h>
#include "dbg_msg.h"
#include "jt_arm.h"
#include "jt_instr.h"
#include "jt_flash.h"
#include "convert.h"
Flash support functions
void jt_str91xflash_GetConfig | ( | void | ) |
Support function to get the STR91x Configuration Register
MSB first bit 63 Lock OTP bit 62:52 Reserved bit 51 LVD_WARNING_SELECT Defining the LVD warning signal input source. bit 50 LVD_RESET_SELECT Defining the LVD reset input source. bit 49 LVD_th Defining of the threshold of the LVD bits 48 CSx Mapping of CS0 and CS1 bits 47:36 Reserved bits 35:32 Protection Flash Bank 1 sectors bits 31:8 Reserved bits 7:0 Protection of Flash Bank 0 sectors
Save result in global variables: # str91xOTPlock # str91xCSxMapping # str91xFlashProtectionBank[1] # str91xFlashProtectionBank[0]
- |
References active_jtag_device, instr_str91xFlash_isc_configuration, jtag_exchange_data(), jtag_send_instr(), jtag_supp_bitstr2int_MSB_First(), NON, and scan_chain.
Referenced by jtag_identify_devices(), and jtag_test().
int jt_str91xflash_ReadSector | ( | uint32_t | base_address | ) |
Support function to read a STR91x-flash sector, described by base_address (and str91xCSxMapping).
The collected data is temporary saved in a 64KByte Buffer named str91xSectorBuffer.
(not yet usable since bit 2 and 3 is always '1')
base_address |
References active_jtag_device, DBG_LEVEL_GDB_ARM_INFO, dbgPrintf(), instr_str91xFlash_isc_address_shift, instr_str91xFlash_isc_clr_status, instr_str91xFlash_isc_disable, instr_str91xFlash_isc_enable, instr_str91xFlash_isc_noop, instr_str91xFlash_isc_read, jtag_eos(), jtag_exchange_data(), jtag_send_instr(), jtag_supp_bitstr2int_MSB_First(), jtag_supp_int2bitstr_MSB_First(), NON, scan_chain, and str91xSectorBuffer.
int jt_str91xflash_EraseSector | ( | uint32_t | base_address | ) |
Support function to erase a STR91x-flash sector, described by base_address (and str91xCSxMapping). The base address sets an erase mask, needed by the erase command.
MSB first bits 63:52 Reserved bit 51 OTP Sector bit 50 User-Code bit 49 Configuration Sector bit 48:36 Reserved bits 35:32 Flash Bank 1 sectors bits 31:8 Reserved bits 7:0 Flash Bank 0 sectors
(Function currently not working after doing ITCM memory read in Debug Mode)
base_address |
References active_jtag_device, DBG_LEVEL_GDB_ARM_INFO, dbgPrintf(), instr_str91xFlash_isc_blank_check, instr_str91xFlash_isc_clr_status, instr_str91xFlash_isc_disable, instr_str91xFlash_isc_enable, instr_str91xFlash_isc_erase, instr_str91xFlash_isc_noop, jtag_eos(), jtag_exchange_data(), jtag_send_instr(), NON, and scan_chain.
Referenced by jtag_test().
int jt_str91xflash_WriteSector | ( | uint32_t | base_address | ) |
Support function to write one STR91x-flash sector, described by base_address (and str91xCSxMapping).
The source data comes from a temporary 64KByte Buffer named str91xSectorBuffer. (Function currently not working after doing ITCM memory read in Debug Mode)
base_address |
References active_jtag_device, DBG_LEVEL_GDB_ARM_INFO, dbgPrintf(), instr_str91xFlash_isc_address_shift, instr_str91xFlash_isc_clr_status, instr_str91xFlash_isc_disable, instr_str91xFlash_isc_enable, instr_str91xFlash_isc_noop, instr_str91xFlash_isc_program, jtag_eos(), jtag_exchange_data(), jtag_send_instr(), jtag_supp_int2bitstr_MSB_First(), NON, scan_chain, and str91xSectorBuffer.
Referenced by jtag_test().
int jt_str91xflash_SectorBlankCheck | ( | uint32_t | base_address | ) |
Support function to do a blank check (all bits set to '1') at a given STR91x-flash sector (described by base_address and str91xCSxMapping). The base address sets a check mask, needed by the command.
MSB first bits 63:52 Reserved bit 51 OTP Sector bit 50 User-Code bit 49 Configuration Sector bit 48:36 Reserved bits 35:32 Flash Bank 1 sectors bits 31:8 Reserved bits 7:0 Flash Bank 0 sectors
(Function currently not working after doing ITCM memory read in Debug Mode)
base_address |
References active_jtag_device, DBG_LEVEL_GDB_ARM_INFO, dbgPrintf(), instr_str91xFlash_isc_blank_check, instr_str91xFlash_isc_clr_status, instr_str91xFlash_isc_disable, instr_str91xFlash_isc_enable, instr_str91xFlash_isc_noop, jtag_eos(), jtag_exchange_data(), jtag_send_instr(), NON, and scan_chain.
Referenced by jtag_test().
uint8_t str91xSectorBuffer[64 *1024] |
Referenced by jt_str91xflash_ReadSector(), jt_str91xflash_WriteSector(), and jtag_test().