Hello,
My customer needs to read / write data from flash beyond the 4KB that osal_snv_read / write functions support. So, he created the below functions using driverlib and wrapping them in HAL critical enter/exit functions. Do you see any issue with this ? Also, I know the osal functions need to be called from within a task context – would there be similar limitations for these functions ?
Thanks,
Padmaja
void custom_osal_erase(uint32 address);
void custom_osal_erase(uint32 address)
{
halIntState_t cs;
uint32_t err;
HAL_ENTER_CRITICAL_SECTION(cs);
err = FlashSectorErase(address);
HAL_EXIT_CRITICAL_SECTION(cs);
}
void custom_osal_write(uint32 addr, uint8 *buf, uint16 cnt);
void custom_osal_write(uint32 addr, uint8 *buf, uint16 cnt)
{
// Enter Critical Section
halIntState_t cs;
HAL_ENTER_CRITICAL_SECTION(cs);
FlashProgram( buf, addr, cnt );
HAL_EXIT_CRITICAL_SECTION(cs);
}
void custom_osal_read(uint32 page, uint16 offset, uint8 *buf, uint16 cnt);
void custom_osal_read(uint32 page, uint16 offset, uint8 *buf, uint16 cnt)
{
// Enter Critical Section
halIntState_t cs;
HAL_ENTER_CRITICAL_SECTION(cs);
HalFlashRead(page, offset, (uint8 *)buf, cnt);
HAL_EXIT_CRITICAL_SECTION(cs);
}