Skip to content
Snippets Groups Projects
Commit af1e4925 authored by Hauke Petersen's avatar Hauke Petersen
Browse files

drivers/flashpage: added addr-to-page function

parent 15d99f0c
No related branches found
No related tags found
No related merge requests found
......@@ -81,6 +81,22 @@ static inline void *flashpage_addr(int page)
return (void *)(CPU_FLASH_BASE + (page * FLASHPAGE_SIZE));
}
/**
* @brief Translate the given address into the corresponding page number
*
* The given address can be any address inside a page.
*
* @note The given address MUST be a valid flash address!
*
* @param[in] addr address inside the targeted page
*
* @return page containing the given address
*/
static inline int flashpage_page(void *addr)
{
return (int)(((int)addr - CPU_FLASH_BASE) / FLASHPAGE_SIZE);
}
/**
* @brief Write the given page with the given data
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment