Chameleon-Mini
 All Classes Files Functions Variables Macros Pages
Configuration.h
1 /* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
2  * AUTHORS"). All rights reserved.
3  *
4  * DEFINITIONS:
5  *
6  * "WORK": The material covered by this license includes the schematic
7  * diagrams, designs, circuit or circuit board layouts, mechanical
8  * drawings, documentation (in electronic or printed form), source code,
9  * binary software, data files, assembled devices, and any additional
10  * material provided by the ORIGINAL AUTHORS in the ChameleonMini project
11  * (https://github.com/skuep/ChameleonMini).
12  *
13  * LICENSE TERMS:
14  *
15  * Redistributions and use of this WORK, with or without modification, or
16  * of substantial portions of this WORK are permitted provided that the
17  * following conditions are met:
18  *
19  * Redistributions and use of this WORK, with or without modification, or
20  * of substantial portions of this WORK must include the above copyright
21  * notice, this list of conditions, the below disclaimer, and the following
22  * attribution:
23  *
24  * "Based on ChameleonMini an open-source RFID emulator:
25  * https://github.com/skuep/ChameleonMini"
26  *
27  * The attribution must be clearly visible to a user, for example, by being
28  * printed on the circuit board and an enclosure, and by being displayed by
29  * software (both in binary and source code form).
30  *
31  * At any time, the majority of the ORIGINAL AUTHORS may decide to give
32  * written permission to an entity to use or redistribute the WORK (with or
33  * without modification) WITHOUT having to include the above copyright
34  * notice, this list of conditions, the below disclaimer, and the above
35  * attribution.
36  *
37  * DISCLAIMER:
38  *
39  * THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
40  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
41  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42  * DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
43  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
44  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
45  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
46  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48  * ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
49  * THE POSSIBILITY OF SUCH DAMAGE.
50  *
51  * The views and conclusions contained in the hardware, software, and
52  * documentation should not be interpreted as representing official
53  * policies, either expressed or implied, of the ORIGINAL AUTHORS.
54  */
55 
56 #ifndef STANDARDS_H_
57 #define STANDARDS_H_
58 
59 #include <stdint.h>
60 #include <stdbool.h>
61 
62 #define CONFIGURATION_NAME_LENGTH_MAX 16
63 #define CONFIGURATION_UID_SIZE_MAX 16
64 
65 typedef uint8_t ConfigurationUidType[CONFIGURATION_UID_SIZE_MAX];
66 
67 typedef enum {
68  /* This HAS to be the first element */
69  CONFIG_NONE = 0,
70 
71 #ifdef CONFIG_MF_ULTRALIGHT_SUPPORT
72  CONFIG_MF_ULTRALIGHT,
73 #endif
74 #ifdef CONFIG_MF_CLASSIC_1K_SUPPORT
75  CONFIG_MF_CLASSIC_1K,
76 #endif
77 #ifdef CONFIG_MF_CLASSIC_4K_SUPPORT
78  CONFIG_MF_CLASSIC_4K,
79 #endif
80 #ifdef CONFIG_ISO15693_GEN_SUPPORT
81  CONFIG_ISO15693_GEN,
82 #endif
83 #ifdef CONFIG_ISO14443A_SNIFF_SUPPORT
84  CONFIG_ISO14443A_SNIFF,
85 #endif
86 #ifdef CONFIG_ISO15693_SNIFF_SUPPORT
87  CONFIG_ISO15693_SNIFF,
88 #endif
89  //CONFIG_MF_DESFIRE,
90  //CONFIG_ISO14443A_RELAY
91 
92 
93 
94  /* This HAS to be the last element */
95  CONFIG_COUNT
96 } ConfigurationEnum;
97 
98 typedef struct {
99  ConfigurationEnum ConfigurationID;
100  char ConfigurationName[CONFIGURATION_NAME_LENGTH_MAX];
101 
102  /* Codec used for this configuration */
103  void (*CodecInitFunc) (void);
104  void (*CodecTaskFunc) (void);
105 
106  /* Application used for this configuration */
107  void (*ApplicationInitFunc) (void);
108  void (*ApplicationResetFunc) (void);
109  void (*ApplicationTaskFunc) (void);
110  uint16_t (*ApplicationProcessFunc) (uint8_t* ByteBuffer, uint16_t ByteCount);
111  void (*ApplicationGetUidFunc) (ConfigurationUidType Uid);
112  void (*ApplicationSetUidFunc) (ConfigurationUidType Uid);
113 
114  uint16_t MemorySize;
115  uint8_t UidSize;
116  bool ReadOnly;
117 
118 } ConfigurationType;
119 
120 extern ConfigurationType ActiveConfiguration;
121 
122 void ConfigurationInit(void);
123 void ConfigurationSetById(ConfigurationEnum Configuration);
124 bool ConfigurationSetByName(const char* ConfigurationName);
125 void ConfigurationGetList(char* ConfigListOut, uint16_t ByteCount);
126 
127 #endif /* STANDARDS_H_ */