drivers/flashpage: flashpage_page() takes a const argument
All addresses to flashpage_page() must be in flash. Flash memory is `const`, therefore this function must also take `const` pointers.
This commit is contained in:
parent
de768b5d23
commit
f903ec90d4
@ -329,7 +329,7 @@ size_t flashpage_size(unsigned page)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned flashpage_page(void *addr)
|
unsigned flashpage_page(const void *addr)
|
||||||
{
|
{
|
||||||
/* Calculates the flashpage number based on the address for the
|
/* Calculates the flashpage number based on the address for the
|
||||||
* non-homogeneous flashpage stm32 series.
|
* non-homogeneous flashpage stm32 series.
|
||||||
|
|||||||
@ -190,7 +190,7 @@ static inline void *flashpage_addr(unsigned page)
|
|||||||
*
|
*
|
||||||
* @return page containing the given address
|
* @return page containing the given address
|
||||||
*/
|
*/
|
||||||
static inline unsigned flashpage_page(void *addr)
|
static inline unsigned flashpage_page(const void *addr)
|
||||||
{
|
{
|
||||||
return (((intptr_t)addr - CPU_FLASH_BASE) / FLASHPAGE_SIZE);
|
return (((intptr_t)addr - CPU_FLASH_BASE) / FLASHPAGE_SIZE);
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ static inline unsigned flashpage_page(void *addr)
|
|||||||
/* Bare prototypes for the above functions. See above for the documentation */
|
/* Bare prototypes for the above functions. See above for the documentation */
|
||||||
size_t flashpage_size(unsigned page);
|
size_t flashpage_size(unsigned page);
|
||||||
void *flashpage_addr(unsigned page);
|
void *flashpage_addr(unsigned page);
|
||||||
unsigned flashpage_page(void *addr);
|
unsigned flashpage_page(const void *addr);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ static inline void *flashpage_rwwee_addr(unsigned page)
|
|||||||
*
|
*
|
||||||
* @return RWWEE page containing the given address
|
* @return RWWEE page containing the given address
|
||||||
*/
|
*/
|
||||||
static inline int flashpage_rwwee_page(void *addr)
|
static inline int flashpage_rwwee_page(const void *addr)
|
||||||
{
|
{
|
||||||
return (int)(((int)addr - CPU_FLASH_RWWEE_BASE) / FLASHPAGE_SIZE);
|
return (int)(((int)addr - CPU_FLASH_RWWEE_BASE) / FLASHPAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,7 +118,7 @@ void *flashpage_addr(unsigned page)
|
|||||||
#endif /* PERIPH_FLASHPAGE_NEEDS_FLASHPAGE_ADDR */
|
#endif /* PERIPH_FLASHPAGE_NEEDS_FLASHPAGE_ADDR */
|
||||||
|
|
||||||
#ifdef PERIPH_FLASHPAGE_NEEDS_FLASHPAGE_PAGE
|
#ifdef PERIPH_FLASHPAGE_NEEDS_FLASHPAGE_PAGE
|
||||||
unsigned flashpage_page(void *addr)
|
unsigned flashpage_page(const void *addr)
|
||||||
{
|
{
|
||||||
unsigned page = 0;
|
unsigned page = 0;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user