a3994421 |
1 | //----------------------------------------------------------------------------- |
bd20f8f4 |
2 | // (c) 2009 Henryk Plötz <henryk@ploetzli.ch> |
3 | // |
4 | // This code is licensed to you under the terms of the GNU GPL, version 2 or, |
5 | // at your option, any later version. See the LICENSE.txt file for the text of |
6 | // the license. |
7 | //----------------------------------------------------------------------------- |
8 | // LEGIC RF emulation public interface |
9 | //----------------------------------------------------------------------------- |
a7247d85 |
10 | |
e30c654b |
11 | #ifndef __LEGICRF_H |
12 | #define __LEGICRF_H |
a7247d85 |
13 | |
c71c5ee1 |
14 | #include "proxmark3.h" // |
15 | #include "apps.h" |
16 | #include "util.h" // |
17 | #include "string.h" |
18 | #include "legic_prng.h" // legic PRNG impl |
19 | #include "crc.h" // legic crc-4 |
22f4dca8 |
20 | #include "ticks.h" // timers |
a3994421 |
21 | #include "legic.h" // legic_card_select_t struct |
c71c5ee1 |
22 | |
3612a8a8 |
23 | extern void LegicRfSimulate(int phase, int frame, int reqresp); |
fabef615 |
24 | extern int LegicRfReader(uint16_t offset, uint16_t len, uint8_t iv); |
0e8cabed |
25 | extern void LegicRfWriter(uint16_t offset, uint16_t byte, uint8_t iv, uint8_t *data); |
3e750be3 |
26 | extern void LegicRfInfo(void); |
3e134b4c |
27 | |
22f4dca8 |
28 | uint32_t get_key_stream(int skip, int count); |
633d0686 |
29 | void frame_send_tag(uint16_t response, uint8_t bits); |
22f4dca8 |
30 | void frame_sendAsReader(uint32_t data, uint8_t bits); |
31 | |
fabef615 |
32 | int legic_read_byte( uint16_t index, uint8_t cmd_sz); |
b8168868 |
33 | bool legic_write_byte(uint16_t index, uint8_t byte, uint8_t addr_sz); |
fabef615 |
34 | |
a3994421 |
35 | int legic_select_card(legic_card_select_t *p_card); |
fabef615 |
36 | int legic_select_card_iv(legic_card_select_t *p_card, uint8_t iv); |
0e8cabed |
37 | |
c2723575 |
38 | void LegicCommonInit(bool clear_mem); |
39 | |
0e8cabed |
40 | // emulator mem |
41 | void LegicEMemSet(uint32_t arg0, uint32_t arg1, uint8_t *data); |
42 | void LegicEMemGet(uint32_t arg0, uint32_t arg1); |
43 | void legic_emlset_mem(uint8_t *data, int offset, int numofbytes); |
44 | void legic_emlget_mem(uint8_t *data, int offset, int numofbytes); |
45 | |
3e134b4c |
46 | void ice_legic_setup(); |
e30c654b |
47 | |
48 | #endif /* __LEGICRF_H */ |