From c13bce9eb60b232b77fee6096202a4090b47e5fc Mon Sep 17 00:00:00 2001 From: qwert Date: Thu, 7 Aug 2008 13:34:24 +0000 Subject: [PATCH] Refactor FLASHAVR macro in FLASHAVR_CAST. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1569 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/avr/drv/flash_avr.c | 10 +++++----- bertos/cpu/avr/drv/flash_avr.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bertos/cpu/avr/drv/flash_avr.c b/bertos/cpu/avr/drv/flash_avr.c index 8bdd2f91..413cac80 100644 --- a/bertos/cpu/avr/drv/flash_avr.c +++ b/bertos/cpu/avr/drv/flash_avr.c @@ -141,7 +141,7 @@ static void flash_avr_flush(FlashAvr *fd) */ static int flash_avr_kfileFlush(struct KFile *_fd) { - FlashAvr *fd = FLASHAVRKFILE(_fd); + FlashAvr *fd = FLASHAVR_CAST(_fd); flash_avr_flush(fd); return 0; } @@ -170,7 +170,7 @@ static void flash_avr_loadPage(FlashAvr *fd, avr_page_t page) */ 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; @@ -224,7 +224,7 @@ static void flash_avr_open(struct FlashAvr *fd) */ 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; @@ -235,7 +235,7 @@ static int flash_avr_close(struct KFile *_fd) */ 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; @@ -248,7 +248,7 @@ static struct KFile *flash_avr_reopen(struct KFile *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); diff --git a/bertos/cpu/avr/drv/flash_avr.h b/bertos/cpu/avr/drv/flash_avr.h index 5b8dd6b1..0897132c 100644 --- a/bertos/cpu/avr/drv/flash_avr.h +++ b/bertos/cpu/avr/drv/flash_avr.h @@ -90,7 +90,7 @@ typedef struct FlashAvr /** * Convert + ASSERT from generic KFile to FlashAvr. */ -INLINE FlashAvr * FLASHAVRKFILE(KFile *fd) +INLINE FlashAvr * FLASHAVR_CAST(KFile *fd) { ASSERT(fd->_type == KFT_FLASHAVR); return (FlashAvr *)fd; -- 2.25.1