mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/at25xxx: s/PAGE_SIZE/AT25_PAGE_SIZE/
On musl, PAGE_SIZE has a different meaning. So add an AT25_ prefix to avoid a name clash.
This commit is contained in:
parent
be387a25bd
commit
1582fdd571
@ -37,7 +37,7 @@
|
|||||||
#define min(a, b) ((a) > (b) ? (b) : (a))
|
#define min(a, b) ((a) > (b) ? (b) : (a))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PAGE_SIZE (dev->params.page_size)
|
#define AT25_PAGE_SIZE (dev->params.page_size)
|
||||||
#define ADDR_LEN (AT25XXX_PARAM_ADDR_LEN)
|
#define ADDR_LEN (AT25XXX_PARAM_ADDR_LEN)
|
||||||
#define ADDR_MSK ((1UL << ADDR_LEN) - 1)
|
#define ADDR_MSK ((1UL << ADDR_LEN) - 1)
|
||||||
|
|
||||||
@ -85,12 +85,12 @@ static inline int _wait_until_eeprom_ready(const at25xxx_t *dev)
|
|||||||
|
|
||||||
static int _at25xxx_write_page(const at25xxx_t *dev, uint32_t page, uint32_t offset, const void *data, size_t len)
|
static int _at25xxx_write_page(const at25xxx_t *dev, uint32_t page, uint32_t offset, const void *data, size_t len)
|
||||||
{
|
{
|
||||||
assert(offset < PAGE_SIZE);
|
assert(offset < AT25_PAGE_SIZE);
|
||||||
|
|
||||||
/* write no more than to the end of the current page to prevent wrap-around */
|
/* write no more than to the end of the current page to prevent wrap-around */
|
||||||
size_t remaining = PAGE_SIZE - offset;
|
size_t remaining = AT25_PAGE_SIZE - offset;
|
||||||
len = min(len, remaining);
|
len = min(len, remaining);
|
||||||
uint32_t pos = _pos(CMD_WRITE, page * PAGE_SIZE + offset);
|
uint32_t pos = _pos(CMD_WRITE, page * AT25_PAGE_SIZE + offset);
|
||||||
|
|
||||||
/* wait for previous write to finish - may take up to 5 ms */
|
/* wait for previous write to finish - may take up to 5 ms */
|
||||||
int res = _wait_until_eeprom_ready(dev);
|
int res = _wait_until_eeprom_ready(dev);
|
||||||
@ -136,8 +136,8 @@ int at25xxx_write(const at25xxx_t *dev, uint32_t pos, const void *data, size_t l
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* page size is always a power of two */
|
/* page size is always a power of two */
|
||||||
const uint32_t page_shift = bitarithm_msb(PAGE_SIZE);
|
const uint32_t page_shift = bitarithm_msb(AT25_PAGE_SIZE);
|
||||||
const uint32_t page_mask = PAGE_SIZE - 1;
|
const uint32_t page_mask = AT25_PAGE_SIZE - 1;
|
||||||
|
|
||||||
uint32_t page = pos >> page_shift;
|
uint32_t page = pos >> page_shift;
|
||||||
uint32_t offset = pos & page_mask;
|
uint32_t offset = pos & page_mask;
|
||||||
@ -214,8 +214,8 @@ int at25xxx_set(const at25xxx_t *dev, uint32_t pos, uint8_t val, size_t len)
|
|||||||
memset(data, val, sizeof(data));
|
memset(data, val, sizeof(data));
|
||||||
|
|
||||||
/* page size is always a power of two */
|
/* page size is always a power of two */
|
||||||
const uint32_t page_shift = bitarithm_msb(PAGE_SIZE);
|
const uint32_t page_shift = bitarithm_msb(AT25_PAGE_SIZE);
|
||||||
const uint32_t page_mask = PAGE_SIZE - 1;
|
const uint32_t page_mask = AT25_PAGE_SIZE - 1;
|
||||||
|
|
||||||
uint32_t page = pos >> page_shift;
|
uint32_t page = pos >> page_shift;
|
||||||
uint32_t offset = pos & page_mask;
|
uint32_t offset = pos & page_mask;
|
||||||
|
Loading…
Reference in New Issue
Block a user