#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <sys/time.h>
#include "dbg_msg.h"
#include "jt_arm.h"
#include "jt_instr.h"
#include "jt_flash.h"
#include "convert.h"
Flash support functions
uint8_t jt_amdflashReadResetByte | ( | uint32_t | base_address, | |
uint32_t | address | |||
) |
Support Function to reset Flash back into Read Mode
base_address | flash base address | |
address | byte address to read |
References jtag_arm_ReadByte(), and jtag_arm_WriteByte().
void jt_amdflashResetByte | ( | uint32_t | base_address | ) |
Support Function to reset Flash back into Read Mode
base_address | flash base address |
References jtag_arm_WriteByte().
Referenced by programFlashCB_write_sector().
int jt_amdflashProgByte | ( | uint32_t | base_address, | |
uint32_t | address, | |||
uint8_t | data, | |||
unsigned | wait | |||
) |
Support Function to write one Byte to the Flash.
This is OK after an erase of a Sector.
base_address | flash base address | |
address | byte address to write | |
data | 8-bit data value | |
wait | if true wait for completion |
0 | success | |
1 | error |
References convertDiffTimeToMsec, jtag_arm_ReadByte(), and jtag_arm_WriteByte().
Referenced by prog_flash_amd8().
int jt_amdflashProgByte_faster | ( | uint32_t | base_address, | |
uint32_t | address, | |||
uint8_t * | data, | |||
int | numberOfData, | |||
unsigned | verify | |||
) |
Support Function to write a number of bytes to the Flash.
This is OK after an erase of a Sector.
base_address | flash base address | |
address | byte address to write | |
data | pointer to source data buffer | |
numberOfData | number of byte data to write | |
verify | if true wait for completion |
0 | success | |
1 | error |
References ARM_LDMIA, ARM_LDRB, ARM_NOP, ARM_STMIA, ARM_STRB, convertDiffTimeToMsec, DBG_LEVEL_GDB_ARM_WARN, dbgPrintf(), DEBUG_REPEAT_SPEED, DEBUG_SPEED, instr_intest, INTEST, jtag_arm7_mov_chain1_data(), jtag_arm_chain1_sysspeed_restart(), jtag_arm_set_chain(), jtag_arm_WriteByte(), jtag_send_instr(), READ_WRITE, scan_chain, SYSTEM_SPEED, and WRITE_ONLY.
Referenced by prog_flash_amd8().
int jt_amdflashEraseSectorByte | ( | uint32_t | base_address, | |
uint32_t | address | |||
) |
Support Function to Erase a Sector within the Flash
base_address | First address of the Flash that has to be erased | |
address | Addres within the sector which has to to be erased |
0 | success | |
1 | error |
References convertDiffTimeToMsec, jtag_arm_ReadByte(), and jtag_arm_WriteByte().
Referenced by eraseFlashCB_sector(), and programFlashCB_write_sector().
uint16_t jt_amdflashReadResetHalfword | ( | uint32_t | base_address, | |
uint32_t | address | |||
) |
Support Function to reset Flash back into Read Mode
Note: Address Bit A0 is always ignored due to Halfword access
At a 16 Bit Flash Data Bits D15-D8 are ignored
At two 8 Bit Flashes the command is always xmit'ed to both parts
base_address | flash base address | |
address | byte address to read |
References jtag_arm_ReadHalfword(), and jtag_arm_WriteHalfword().
void jt_amdflashResetHalfword | ( | uint32_t | base_address | ) |
Support Function to reset Flash back into Read Mode
Note: Address Bit A0 is always ignored due to Halfword access
At a 16 Bit Flash Data Bits D15-D8 are ignored
At two 8 Bit Flashes the command is always xmit'ed to both parts
base_address | flash base address |
References jtag_arm_WriteHalfword().
Referenced by programFlashCB_write_sector().
int jt_amdflashProgHalfword | ( | uint32_t | base_address, | |
uint32_t | address, | |||
uint16_t | data, | |||
unsigned | wait | |||
) |
Support Function to write one Halfword to the Flash.
Note: Address Bit A0 must be 0 always ,due to Halfword access
base_address | flash base address | |
address | byte address to write | |
data | 16-bit data value | |
wait | if true wait for completion |
0 | success | |
1 | error |
References convertDiffTimeToMsec, jtag_arm_ReadHalfword(), and jtag_arm_WriteHalfword().
Referenced by prog_flash_amd16().
int jt_amdflashProgHalfword_faster | ( | uint32_t | base_address, | |
uint32_t | address, | |||
uint16_t * | data, | |||
int | numberOfData, | |||
unsigned | verify | |||
) |
Support Function to write a number of half words to the Flash.
This is OK after an erase of a Sector.
base_address | flash base address | |
address | Halfword address to write | |
data | pointer to source data buffer | |
numberOfData | number of byte data to write | |
verify | if true wait for completion |
0 | success | |
1 | error |
References ARM_LDMIA, ARM_LDRH, ARM_NOP, ARM_STMIA, ARM_STRH, convertDiffTimeToMsec, DBG_LEVEL_GDB_ARM_WARN, dbgPrintf(), DEBUG_REPEAT_SPEED, DEBUG_SPEED, instr_intest, INTEST, jtag_arm7_mov_chain1_data(), jtag_arm_chain1_sysspeed_restart(), jtag_arm_set_chain(), jtag_arm_WriteHalfword(), jtag_send_instr(), READ_WRITE, scan_chain, SYSTEM_SPEED, and WRITE_ONLY.
Referenced by prog_flash_amd16().
int jt_amdflashEraseSectorHalfword | ( | uint32_t | base_address, | |
uint32_t | address | |||
) |
Support Function to Erase a Sector within the Flash
base_address | First address of the Flash that has to be erased | |
address | Addres within the sector which has to to be erased |
0 | success | |
1 | error |
References convertDiffTimeToMsec, DBG_LEVEL_JTAG_ARM_LOW, dbgPrintf(), jtag_arm_ReadHalfword(), and jtag_arm_WriteHalfword().
Referenced by eraseFlashCB_sector(), and programFlashCB_write_sector().
uint32_t jt_amdflashReadResetWord | ( | uint32_t | base_address, | |
uint32_t | address | |||
) |
Support Function to reset Flash back into Read Mode
Note: Address Bit A0 and A1 is always ignored due to Word access
At a 16 Bit Flash Data Bits D15-D8 are ignored (we might have two of them)
At four 8 Bit Flashes the command is always xmit'ed to all parts
base_address | flash base address | |
address | byte address to read |
References jtag_arm_ReadWord(), and jtag_arm_WriteWord().
void jt_amdflashResetWord | ( | uint32_t | base_address | ) |
Support Function to reset Flash back into Read Mode
Note: Address Bit A0 and A1 is always ignored due to Word access
At a 16 Bit Flash Data Bits D15-D8 are ignored (we might have two of them)
At four 8 Bit Flashes the command is always xmit'ed to all parts
base_address | flash base address |
References jtag_arm_WriteWord().
Referenced by programFlashCB_write_sector().
int jt_amdflashProgWord | ( | uint32_t | base_address, | |
uint32_t | address, | |||
uint32_t | data, | |||
unsigned | wait | |||
) |
Support Function to write one Word to the Flash.
This is OK after an erase of a Sector.
Note: Address Bit A0 and A1 must always be 0 ,due to Word access
base_address | flash base address | |
address | byte address to write | |
data | 32-bit data value | |
wait | if true wait for completion |
0 | success | |
1 | error |
References convertDiffTimeToMsec, jtag_arm_ReadWord(), and jtag_arm_WriteWord().
Referenced by prog_flash_amd32().
int jt_amdflashProgWord_faster | ( | uint32_t | base_address, | |
uint32_t | address, | |||
uint32_t * | data, | |||
int | numberOfData, | |||
unsigned | verify | |||
) |
Support Function to write an number of words to the Flash.
This is OK after an erase of a Sector.
base_address | flash base address | |
address | Word address to write | |
data | pointer to source data buffer | |
numberOfData | number of 32-bit word data to write | |
verify | if true wait for completion |
0 | success | |
1 | error |
References ARM_LDMIA, ARM_LDRH, ARM_NOP, ARM_STMIA, ARM_STR, convertDiffTimeToMsec, DBG_LEVEL_GDB_ARM_WARN, dbgPrintf(), DEBUG_REPEAT_SPEED, DEBUG_SPEED, instr_intest, INTEST, jtag_arm7_mov_chain1_data(), jtag_arm_chain1_sysspeed_restart(), jtag_arm_set_chain(), jtag_arm_WriteWord(), jtag_send_instr(), READ_WRITE, scan_chain, SYSTEM_SPEED, and WRITE_ONLY.
Referenced by prog_flash_amd32().
int jt_amdflashEraseSectorWord | ( | uint32_t | base_address, | |
uint32_t | address | |||
) |
Support Function to Erase a Sector within the Flash
base_address | First address of the Flash that has to be erased | |
address | Addres within the sector which has to to be erased |
0 | success | |
1 | error |
References convertDiffTimeToMsec, jtag_arm_ReadWord(), and jtag_arm_WriteWord().
Referenced by eraseFlashCB_sector(), and programFlashCB_write_sector().