AN2504 Freescale Semiconductor / Motorola, AN2504 Datasheet - Page 29

no-image

AN2504

Manufacturer Part Number
AN2504
Description
On-Chip FLASH Programming API for CodeWarrior Software
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
MOTOROLA
On-Chip FLASH Programming API for CodeWarrior Software
/********************************************************************
void ErasePage(Word *_page) {
}
/********************************************************************
void ErasePageX (Word *_page) {
}
* ErasePage: It erases a PAGE of FLASH
*
* Parameters:
*
*
* Entry Conditions: None.
*
* Exit Conditions:
*
* Return:
*
* Remarks:
*
*/
* ErasePageX: It erases a PAGE of FLASH but leaves the state
*
*
* Parameters:
*
*
* Entry Conditions: None.
*
* Exit Conditions:
*
* Return:
*
* Remarks:
*
*
*
*
*/
Freescale Semiconductor, Inc.
Word _address;
_address = *_page;
FLBPR = 0xFF;
CPUSPD = OSC;
CTRLBYT &= 0xBF;
__asm ldhx _address;
ERARNGE();
return;
Byte _backup1;
Word _address;
__asm
__asm
_address = *_page;
FLBPR = 0xFF;
CPUSPD = OSC;
CTRLBYT &= 0xBF;
__asm ldhx _address;
ERARNGE();
if ((_backup1 & 0x80) != 0x80) { // Restore interrupts state.
}
return;
For More Information On This Product,
__asm CLI;
tpa;
sta _backup1;
Go to: www.freescale.com
of the interrupts as it was before calling it.
*_page: pointer to any address within
Interrupts are disabled.
None.
All bytes within that PAGE will be driven
to 0xFF
*_page: pointer to any address within
None.
None.
All bytes within that PAGE will be driven
to 0xFF.
Interrupts are disabled during the erasing
of the flash, but are restored to its
original state before exiting the function.
the PAGE to be erased.
the PAGE to be erased.
// Enables erase/write protection.
// Set Clock Bus Operation speed.
// Clear bit 6 to page erase mode.
// Set the page to be erased.
// Call ROM-resident routine.
// Backup Condition Code Register
// Enables erase/write protection.
// Set Clock Bus Operation speed.
// Clear bit 6 to page erase mode.
// Set the page to be erased.
// Call ROM-resident routine.
API Source Code
AN2504/D
29

Related parts for AN2504