summaryrefslogtreecommitdiff
path: root/openpicc/application/env.h
blob: 50d27b60906569a266ff438c1ea3e8beecc86859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/***************************************************************
 *
 * OpenBeacon.org - flash routines for persistent environment storage
 *
 * Copyright 2007 Milosch Meriac <meriac@openbeacon.de>
 *
 ***************************************************************

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; version 2.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef __ENV_H__
#define __ENV_H__

#define TENVIRONMENT_MAGIC 0x0CCC2007

typedef struct
{
    unsigned int magic,size,crc16;
    unsigned int mode,speed;
    unsigned int reader_id;
} TEnvironment;

typedef union {
    TEnvironment e;
    unsigned int data[AT91C_IFLASH_PAGE_SIZE/sizeof(unsigned int)];
} TEnvironmentBlock;

extern void env_store(void) RAMFUNC;
extern int env_load(void);
extern void env_init(void);
extern TEnvironmentBlock env;
extern unsigned short env_crc16 (const unsigned char *buffer, int size) RAMFUNC;

#endif/*__ENV_H__*/
personal git repositories of Harald Welte. Your mileage may vary