openpcd/openpicc/application/env.h @ master
1 | 633c646a | henryk | /***************************************************************
|
---|---|---|---|
2 | *
|
||
3 | * OpenBeacon.org - flash routines for persistent environment storage
|
||
4 | *
|
||
5 | * Copyright 2007 Milosch Meriac <meriac@openbeacon.de>
|
||
6 | *
|
||
7 | ***************************************************************
|
||
8 | |||
9 | This program is free software; you can redistribute it and/or modify
|
||
10 | it under the terms of the GNU General Public License as published by
|
||
11 | the Free Software Foundation; version 2.
|
||
12 | |||
13 | This program is distributed in the hope that it will be useful,
|
||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
16 | GNU General Public License for more details.
|
||
17 | |||
18 | You should have received a copy of the GNU General Public License along
|
||
19 | with this program; if not, write to the Free Software Foundation, Inc.,
|
||
20 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||
21 | */
|
||
22 | |||
23 | #ifndef __ENV_H__
|
||
24 | #define __ENV_H__
|
||
25 | |||
26 | #define TENVIRONMENT_MAGIC 0x0CCC2007
|
||
27 | |||
28 | typedef struct |
||
29 | {
|
||
30 | unsigned int magic,size,crc16; |
||
31 | unsigned int mode,speed; |
||
32 | unsigned int reader_id; |
||
33 | } TEnvironment; |
||
34 | |||
35 | typedef union { |
||
36 | TEnvironment e; |
||
37 | unsigned int data[AT91C_IFLASH_PAGE_SIZE/sizeof(unsigned int)]; |
||
38 | } TEnvironmentBlock; |
||
39 | |||
40 | extern void env_store(void) RAMFUNC; |
||
41 | extern int env_load(void); |
||
42 | extern void env_init(void); |
||
43 | extern TEnvironmentBlock env; |
||
44 | extern unsigned short env_crc16 (const unsigned char *buffer, int size) RAMFUNC; |
||
45 | |||
46 | #endif/*__ENV_H__*/ |