From e25def702d296525e367cad3f0fafc743627e3a2 Mon Sep 17 00:00:00 2001 From: batt Date: Wed, 29 Sep 2010 16:08:50 +0000 Subject: [PATCH] Use new progmem API. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4357 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/algo/crc_ccitt.h | 6 +----- bertos/algo/md2.c | 4 ++-- bertos/net/afsk.c | 6 +----- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/bertos/algo/crc_ccitt.h b/bertos/algo/crc_ccitt.h index fd87c6a8..240e6e1a 100644 --- a/bertos/algo/crc_ccitt.h +++ b/bertos/algo/crc_ccitt.h @@ -55,11 +55,7 @@ extern const uint16_t crc_ccitt_tab[256]; */ INLINE uint16_t updcrc_ccitt(uint8_t c, uint16_t oldcrc) { -#if CPU_HARVARD - return (oldcrc >> 8) ^ pgm_read_uint16_t(&crc_ccitt_tab[(oldcrc ^ c) & 0xff]); -#else - return (oldcrc >> 8) ^ crc_ccitt_tab[(oldcrc ^ c) & 0xff]; -#endif + return (oldcrc >> 8) ^ pgm_read16(&crc_ccitt_tab[(oldcrc ^ c) & 0xff]); } /** CRC-CCITT init value */ diff --git a/bertos/algo/md2.c b/bertos/algo/md2.c index d9f2065b..589d9899 100644 --- a/bertos/algo/md2.c +++ b/bertos/algo/md2.c @@ -59,7 +59,7 @@ * Official array of 256 byte pemutation contructed from digits of pi, defined * in the RFC 1319. */ - static const uint8_t PGM_ATTR md2_perm[256] = + static const uint8_t PROGMEM md2_perm[256] = { 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, @@ -81,7 +81,7 @@ 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 }; - #define MD2_PERM(x) PGM_READ_CHAR(&md2_perm[x]) + #define MD2_PERM(x) pgm_read8(&md2_perm[x]) #else /** * Md2_perm() function generate an array of 256 "casual" permutation. diff --git a/bertos/net/afsk.c b/bertos/net/afsk.c index d7ac8bf0..d58758cd 100644 --- a/bertos/net/afsk.c +++ b/bertos/net/afsk.c @@ -105,11 +105,7 @@ INLINE uint8_t sin_sample(uint16_t idx) uint16_t new_idx = idx % (SIN_LEN / 2); new_idx = (new_idx >= (SIN_LEN / 4)) ? (SIN_LEN / 2 - new_idx - 1) : new_idx; - #if CPU_HARVARD - uint8_t data = pgm_read_char(&sin_table[new_idx]); - #else - uint8_t data = sin_table[new_idx]; - #endif + uint8_t data = pgm_read8(&sin_table[new_idx]); return (idx >= (SIN_LEN / 2)) ? (255 - data) : data; } -- 2.25.1