mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-11-22 02:17:31 +02:00
fw/hash.[ch]: new function hash_merge_progmem to read from Flash instead of RAM
This commit is contained in:
parent
420370ee9c
commit
a59bb00a27
15
fw/hash.c
15
fw/hash.c
@ -15,6 +15,8 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
|
||||
@ -39,6 +41,19 @@ void hash_merge(const uint8_t *buf, uint8_t len)
|
||||
}
|
||||
|
||||
|
||||
#ifdef __AVR__
|
||||
|
||||
void hash_merge_progmem(const uint8_t *buf, uint8_t len)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i != len; i++)
|
||||
hash[i & (HASH_SIZE-1)] ^= pgm_read_byte(buf+i);
|
||||
}
|
||||
|
||||
#endif /* __AVR__ */
|
||||
|
||||
|
||||
void hash_end(void)
|
||||
{
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
void hash_init(void);
|
||||
void hash_merge(const uint8_t *buf, uint8_t len);
|
||||
void hash_merge_progmem(const uint8_t *buf, uint8_t len);
|
||||
void hash_end(void);
|
||||
bool hash_eq(const uint8_t *buf, uint8_t len, uint8_t off);
|
||||
void hash_cp(uint8_t *buf, uint8_t len, uint8_t off);
|
||||
|
Loading…
Reference in New Issue
Block a user