OSCR
Open Source Cartridge Reader
Loading...
Searching...
No Matches
crc32.h
1#pragma once
2#ifndef OSCR_CRC32_H_
3# define OSCR_CRC32_H_
4
5# include "config.h"
6# include "syslibinc.h"
7# include "common/Types.h"
8# include "api/Storage.h"
9
10#define UPDATE_CRC(crc, ch) \
11 do { \
12 uint8_t idx = ((crc) ^ (ch)) & 0xFF; \
13 uint32_t tab_value = pgm_read_dword(OSCR::CRC32::crc_32_tab + idx); \
14 (crc) = tab_value ^ ((crc) >> 8); \
15 } while (0)
16
17namespace OSCR
18{
19 namespace CRC32
20 {
21#if OPTION_CRC32_LUT
22 extern uint32_t const crc_32_tab[];
23#else
24 extern uint32_t const PROGMEM crc_32_tab[];
25#endif
26
27 extern crc32_t current;
28
29 extern void reset();
30 extern void next(uint8_t const * data);
31 extern void next(uint8_t data);
32 extern void done();
33
34 extern uint32_t calculateCRC(uint8_t const * buffer, size_t length);
35 extern uint32_t calculateCRC(OSCR::Storage::File & infile);
36 extern uint32_t calculateCRC(char const * fileName, char const * folder, uint32_t offset);
37 }
38
39 namespace Cores
40 {
42 }
43
44 namespace Databases
45 {
47 }
48
49 namespace CRDB
50 {
52 }
53}
54
55#endif /* OSCR_CRC32_H_ */
Cores for supported systems
Definition crc32.h:40
Main program.
Definition Storage.h:13
Interface for handling CRC32 values.
Definition crc32_t.h:14