mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-27 23:41:18 +01:00
drivers/flashpage: added addr-to-page function
This commit is contained in:
parent
15d99f0c5d
commit
af1e492552
@ -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
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user