#include <cfg/debug.h>
#include <cpu/irq.h>
- // Define logging setting (for cfg/log.h module).
-#define LOG_LEVEL CONFIG_FLASH_AVR_LOG_LEVEL
-#define LOG_VERBOSITY CONFIG_FLASH_AVR_LOG_VERBOSITY
+// Define log settings for cfg/log.h
+#define LOG_LEVEL CONFIG_FLASH_AVR_LOG_LEVEL
+#define LOG_FORMAT CONFIG_FLASH_AVR_LOG_FORMAT
#include <cfg/log.h>
#include <drv/wdt.h>
#include <string.h>
-
/**
* Definition of type for avr flash module.
*/
*/
static int flash_avr_kfileFlush(struct KFile *_fd)
{
- FlashAvr *fd = FLASHAVRKFILE(_fd);
+ FlashAvr *fd = FLASHAVR_CAST(_fd);
flash_avr_flush(fd);
return 0;
}
*/
static size_t flash_avr_write(struct KFile *_fd, const void *_buf, size_t size)
{
- FlashAvr *fd = FLASHAVRKFILE(_fd);
+ FlashAvr *fd = FLASHAVR_CAST(_fd);
const uint8_t *buf =(const uint8_t *)_buf;
avr_page_t page;
ASSERT(fd->fd.seek_pos + (kfile_off_t)size <= (kfile_off_t)fd->fd.size);
- size = MIN((uint32_t)size, fd->fd.size - fd->fd.seek_pos);
+ size = MIN((kfile_off_t)size, fd->fd.size - fd->fd.seek_pos);
LOG_INFO("Writing at pos[%u]\n", fd->fd.seek_pos);
while (size)
*/
static int flash_avr_close(struct KFile *_fd)
{
- FlashAvr *fd = FLASHAVRKFILE(_fd);
+ FlashAvr *fd = FLASHAVR_CAST(_fd);
flash_avr_flush(fd);
LOG_INFO("Flash file closed\n");
return 0;
*/
static struct KFile *flash_avr_reopen(struct KFile *fd)
{
- FlashAvr *_fd = FLASHAVRKFILE(fd);
+ FlashAvr *_fd = FLASHAVR_CAST(fd);
flash_avr_close(fd);
flash_avr_open(_fd);
return fd;
*/
static size_t flash_avr_read(struct KFile *_fd, void *buf, size_t size)
{
- FlashAvr *fd = FLASHAVRKFILE(_fd);
+ FlashAvr *fd = FLASHAVR_CAST(_fd);
ASSERT(fd->fd.seek_pos + (kfile_off_t)size <= (kfile_off_t)fd->fd.size);
- size = MIN((uint32_t)size, fd->fd.size - fd->fd.seek_pos);
+ size = MIN((kfile_off_t)size, fd->fd.size - fd->fd.seek_pos);
LOG_INFO("Reading at pos[%u]\n", fd->fd.seek_pos);
// Flush current buffered page (if modified).