Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
5687ac73
Commit
5687ac73
authored
Feb 02, 2010
by
Dean Camera
Browse files
Fix TPI mode chip erase code not properly erasing the target memory space.
parent
8d494808
Changes
4
Hide whitespace changes
Inline
Side-by-side
Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
View file @
5687ac73
...
...
@@ -188,18 +188,25 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress, uint8_t* WriteBuffer, uint
}
/** Erases the target's memory space.
*
* \param[in] Address Address inside the memory space to erase
*
* \return Boolean true if the command sequence complete successfully
*/
bool
TINYNVM_EraseMemory
(
void
)
bool
TINYNVM_EraseMemory
(
const
uint8_t
EraseCommand
,
const
uint16_t
Address
)
{
/* Wait until the NVM controller is no longer busy */
if
(
!
(
TINYNVM_WaitWhileNVMControllerBusy
()))
return
false
;
/* Set the NVM control register to the
CHIP ERASE command to erase the target
*/
/* Set the NVM control register to the
target memory erase command
*/
TINYNVM_SendWriteNVMRegister
(
XPROG_Param_NVMCMDRegAddr
);
XPROGTarget_SendByte
(
TINY_NVM_CMD_CHIPERASE
);
XPROGTarget_SendByte
(
EraseCommand
);
/* Write to a location within the target address space to start the erase process */
TINYNVM_SendPointerAddress
(
Address
);
XPROGTarget_SendByte
(
TPI_CMD_SST
|
TPI_POINTER_INDIRECT
);
XPROGTarget_SendByte
(
0x00
);
/* Wait until the NVM bus is ready again */
if
(
!
(
TINYNVM_WaitWhileNVMBusBusy
()))
...
...
Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h
View file @
5687ac73
...
...
@@ -65,7 +65,7 @@
bool
TINYNVM_WaitWhileNVMBusBusy
(
void
);
bool
TINYNVM_ReadMemory
(
const
uint16_t
ReadAddress
,
uint8_t
*
ReadBuffer
,
uint16_t
ReadLength
);
bool
TINYNVM_WriteMemory
(
const
uint16_t
WriteAddress
,
uint8_t
*
WriteBuffer
,
uint16_t
WriteLength
);
bool
TINYNVM_EraseMemory
(
void
);
bool
TINYNVM_EraseMemory
(
const
uint8_t
EraseCommand
,
const
uint16_t
Address
);
#if defined(INCLUDE_FROM_TINYNVM_C)
static
void
TINYNVM_SendReadNVMRegister
(
const
uint8_t
Address
);
...
...
Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c
View file @
5687ac73
...
...
@@ -322,7 +322,7 @@ bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address)
{
/* Other erase modes just need us to address a byte within the target memory space */
XPROGTarget_SendByte
(
PDI_CMD_STS
|
(
PDI_DATSIZE_4BYTES
<<
2
));
XMEGANVM_SendAddress
(
Address
);
XMEGANVM_SendAddress
(
Address
);
XPROGTarget_SendByte
(
0x00
);
}
...
...
Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
View file @
5687ac73
...
...
@@ -237,7 +237,7 @@ static void XPROGProtocol_Erase(void)
else
{
/* Erase the target memory, indicate timeout if ocurred */
if
(
!
(
TINYNVM_EraseMemory
()))
if
(
!
(
TINYNVM_EraseMemory
(
TINY_NVM_CMD_CHIPERASE
,
Erase_XPROG_Params
.
Address
)))
ReturnStatus
=
XPRG_ERR_TIMEOUT
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment