From: qwert Date: Thu, 7 Aug 2008 13:36:03 +0000 (+0000) Subject: Refactor FLASH25 macro in FLASH25_CAST. X-Git-Tag: 2.0.0~364 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=083409cb680e0f8ac6b431af87008fe8be66f011;p=bertos.git Refactor FLASH25 macro in FLASH25_CAST. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1570 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/drv/flash25.c b/bertos/drv/flash25.c index 70d9229a..949ec401 100644 --- a/bertos/drv/flash25.c +++ b/bertos/drv/flash25.c @@ -140,7 +140,7 @@ static bool flash25_pin_init(Flash25 *fd) */ static KFile * flash25_reopen(struct KFile *_fd) { - Flash25 *fd = FLASH25KFILE(_fd); + Flash25 *fd = FLASH25_CAST(_fd); fd->fd.seek_pos = 0; fd->fd.size = FLASH25_MEM_SIZE; @@ -176,7 +176,7 @@ static size_t flash25_read(struct KFile *_fd, void *buf, size_t size) { uint8_t *data = (uint8_t *)buf; - Flash25 *fd = FLASH25KFILE(_fd); + Flash25 *fd = FLASH25_CAST(_fd); ASSERT(fd->fd.seek_pos + (kfile_size_t)size <= fd->fd.size); size = MIN((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos); @@ -229,7 +229,7 @@ static size_t flash25_write(struct KFile *_fd, const void *_buf, size_t size) flash25Size_t wr_len; const uint8_t *data = (const uint8_t *) _buf; - Flash25 *fd = FLASH25KFILE(_fd); + Flash25 *fd = FLASH25_CAST(_fd); ASSERT(fd->fd.seek_pos + (kfile_size_t)size <= fd->fd.size); diff --git a/bertos/drv/flash25.h b/bertos/drv/flash25.h index 86dee860..27c6411f 100644 --- a/bertos/drv/flash25.h +++ b/bertos/drv/flash25.h @@ -71,7 +71,7 @@ typedef struct Flash25 /** * Convert + ASSERT from generic KFile to Flash25. */ -INLINE Flash25 * FLASH25KFILE(KFile *fd) +INLINE Flash25 * FLASH25_CAST(KFile *fd) { ASSERT(fd->_type == KFT_FLASH25); return (Flash25 *)fd;