*
* This function is only use internally in this module.
*/
-static void flash_avr_flush(FlashAvrKFile *fd)
+static void flash_avr_flush(FlashAvr *fd)
{
if (fd->page_dirty)
{
*/
static int flash_avr_kfileFlush(struct KFile *_fd)
{
- FlashAvrKFile *fd = FLASHAVRKFILE(_fd);
+ FlashAvr *fd = FLASHAVRKFILE(_fd);
flash_avr_flush(fd);
return 0;
}
* Check current page and if \a page is different, load it in
* temporary buffer.
*/
-static void flash_avr_loadPage(FlashAvrKFile *fd, avr_page_t page)
+static void flash_avr_loadPage(FlashAvr *fd, avr_page_t page)
{
if (page != fd->curr_page)
{
*/
static size_t flash_avr_write(struct KFile *_fd, const void *_buf, size_t size)
{
- FlashAvrKFile *fd = FLASHAVRKFILE(_fd);
+ FlashAvr *fd = FLASHAVRKFILE(_fd);
const uint8_t *buf =(const uint8_t *)_buf;
avr_page_t page;
* \a name and \a mode are unused, cause flash memory is
* threated like one file.
*/
-static void flash_avr_open(struct FlashAvrKFile *fd)
+static void flash_avr_open(struct FlashAvr *fd)
{
fd->curr_page = 0;
memcpy_P(fd->page_buf, (const char *)(fd->curr_page * SPM_PAGESIZE), SPM_PAGESIZE);
*/
static int flash_avr_close(struct KFile *_fd)
{
- FlashAvrKFile *fd = FLASHAVRKFILE(_fd);
+ FlashAvr *fd = FLASHAVRKFILE(_fd);
flash_avr_flush(fd);
LOG_INFO("Flash file closed\n");
return 0;
*/
static struct KFile *flash_avr_reopen(struct KFile *fd)
{
- FlashAvrKFile *_fd = FLASHAVRKFILE(fd);
+ FlashAvr *_fd = FLASHAVRKFILE(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)
{
- FlashAvrKFile *fd = FLASHAVRKFILE(_fd);
+ FlashAvr *fd = FLASHAVRKFILE(_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);
/**
* Init AVR flash read/write file.
*/
-void flash_avr_init(struct FlashAvrKFile *fd)
+void flash_avr_init(struct FlashAvr *fd)
{
memset(fd, 0, sizeof(*fd));
DB(fd->fd._type = KFT_FLASHAVR);
/**
* FlashAvr KFile context structure.
*/
-typedef struct FlashAvrKFile
+typedef struct FlashAvr
{
/**
* File descriptor.
uint8_t page_buf[SPM_PAGESIZE];
-} FlashAvrKFile;
+} FlashAvr;
#define KFT_FLASHAVR MAKE_ID('F', 'L', 'A', 'V')
/**
- * Convert + ASSERT from generic KFile to FlashAvrKFile.
+ * Convert + ASSERT from generic KFile to FlashAvr.
*/
-INLINE FlashAvrKFile * FLASHAVRKFILE(KFile *fd)
+INLINE FlashAvr * FLASHAVRKFILE(KFile *fd)
{
ASSERT(fd->_type == KFT_FLASHAVR);
- return (FlashAvrKFile *)fd;
+ return (FlashAvr *)fd;
}
-void flash_avr_init(struct FlashAvrKFile *fd);
+void flash_avr_init(struct FlashAvr *fd);