LibDriver FM11RFXX
Loading...
Searching...
No Matches
driver_fm11rfxx.h
Go to the documentation of this file.
1
36
37#ifndef DRIVER_FM11RFXX_H
38#define DRIVER_FM11RFXX_H
39
40#include <stdio.h>
41#include <stdint.h>
42#include <string.h>
43
44#ifdef __cplusplus
45extern "C"{
46#endif
47
53
58
68
77
92
101
105typedef struct fm11rfxx_handle_s
106{
107 uint8_t (*contactless_init)(void);
108 uint8_t (*contactless_deinit)(void);
109 uint8_t (*contactless_transceiver)(uint8_t *in_buf, uint8_t in_len,
110 uint8_t *out_buf, uint8_t *out_len);
111 void (*delay_ms)(uint32_t ms);
112 void (*debug_print)(const char *const fmt, ...);
113 uint8_t type;
114 uint8_t inited;
116
132
136
143
150#define DRIVER_FM11RFXX_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
151
158#define DRIVER_FM11RFXX_LINK_CONTACTLESS_INIT(HANDLE, FUC) (HANDLE)->contactless_init = FUC
159
166#define DRIVER_FM11RFXX_LINK_CONTACTLESS_DEINIT(HANDLE, FUC) (HANDLE)->contactless_deinit = FUC
167
174#define DRIVER_FM11RFXX_LINK_CONTACTLESS_TRANSCEIVER(HANDLE, FUC) (HANDLE)->contactless_transceiver = FUC
175
182#define DRIVER_FM11RFXX_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
183
190#define DRIVER_FM11RFXX_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
191
195
202
211uint8_t fm11rfxx_info(fm11rfxx_info_t *info);
212
223uint8_t fm11rfxx_init(fm11rfxx_handle_t *handle);
224
235uint8_t fm11rfxx_deinit(fm11rfxx_handle_t *handle);
236
251
266
277uint8_t fm11rfxx_halt(fm11rfxx_handle_t *handle);
278
293
308
322uint8_t fm11rfxx_anticollision_cl1(fm11rfxx_handle_t *handle, uint8_t id[4]);
323
337uint8_t fm11rfxx_anticollision_cl2(fm11rfxx_handle_t *handle, uint8_t id[4]);
338
352uint8_t fm11rfxx_select_cl1(fm11rfxx_handle_t *handle, uint8_t id[4]);
353
367uint8_t fm11rfxx_select_cl2(fm11rfxx_handle_t *handle, uint8_t id[4]);
368
383uint8_t fm11rfxx_authentication(fm11rfxx_handle_t *handle, uint8_t id[4], uint8_t block,
384 fm11rfxx_authentication_key_t key_type, uint8_t key[6]);
385
400uint8_t fm11rfxx_read(fm11rfxx_handle_t *handle, uint8_t block, uint8_t data[16]);
401
416uint8_t fm11rfxx_write(fm11rfxx_handle_t *handle, uint8_t block, uint8_t data[16]);
417
433uint8_t fm11rfxx_value_init(fm11rfxx_handle_t *handle, uint8_t block, int32_t value, uint8_t addr);
434
450uint8_t fm11rfxx_value_write(fm11rfxx_handle_t *handle, uint8_t block, int32_t value, uint8_t addr);
451
469uint8_t fm11rfxx_value_read(fm11rfxx_handle_t *handle, uint8_t block, int32_t *value, uint8_t *addr);
470
486uint8_t fm11rfxx_increment(fm11rfxx_handle_t *handle, uint8_t block, uint32_t value);
487
503uint8_t fm11rfxx_decrement(fm11rfxx_handle_t *handle, uint8_t block, uint32_t value);
504
519uint8_t fm11rfxx_transfer(fm11rfxx_handle_t *handle, uint8_t block);
520
535uint8_t fm11rfxx_restore(fm11rfxx_handle_t *handle, uint8_t block);
536
548uint8_t fm11rfxx_block_to_sector(fm11rfxx_handle_t *handle, uint8_t block, uint8_t *sector);
549
561uint8_t fm11rfxx_sector_block_count(fm11rfxx_handle_t *handle, uint8_t sector, uint8_t *count);
562
574uint8_t fm11rfxx_sector_first_block(fm11rfxx_handle_t *handle, uint8_t sector, uint8_t *block);
575
587uint8_t fm11rfxx_sector_last_block(fm11rfxx_handle_t *handle, uint8_t sector, uint8_t *block);
588
630 uint8_t sector, uint8_t key_a[6],
631 uint8_t block_0_0_4, uint8_t block_1_5_9,
632 uint8_t block_2_10_14, uint8_t block_3_15,
633 uint8_t user_data, uint8_t key_b[6]);
634
656 uint8_t sector, uint8_t *block_0_0_4, uint8_t *block_1_5_9,
657 uint8_t *block_2_10_14, uint8_t *block_3_15,
658 uint8_t *user_data, uint8_t key_b[6]);
659
663
670
683uint8_t fm11rfxx_transceiver(fm11rfxx_handle_t *handle, uint8_t *in_buf, uint8_t in_len, uint8_t *out_buf, uint8_t *out_len);
684
688
692
693#ifdef __cplusplus
694}
695#endif
696
697#endif
uint8_t fm11rfxx_select_cl1(fm11rfxx_handle_t *handle, uint8_t id[4])
fm11rfxx select cl1
uint8_t fm11rfxx_sector_first_block(fm11rfxx_handle_t *handle, uint8_t sector, uint8_t *block)
fm11rfxx get the sector's first block
uint8_t fm11rfxx_set_personalized_uid(fm11rfxx_handle_t *handle, fm11rfxx_personalized_uid_t type)
fm11rfxx set the personalized uid
fm11rfxx_personalized_uid_t
fm11rfxx personalized uid enumeration definition
uint8_t fm11rfxx_get_sector_permission(fm11rfxx_handle_t *handle, uint8_t sector, uint8_t *block_0_0_4, uint8_t *block_1_5_9, uint8_t *block_2_10_14, uint8_t *block_3_15, uint8_t *user_data, uint8_t key_b[6])
fm11rfxx get the sector permission
uint8_t fm11rfxx_deinit(fm11rfxx_handle_t *handle)
close the chip
uint8_t fm11rfxx_sector_last_block(fm11rfxx_handle_t *handle, uint8_t sector, uint8_t *block)
fm11rfxx get the sector's last block
uint8_t fm11rfxx_anticollision_cl1(fm11rfxx_handle_t *handle, uint8_t id[4])
fm11rfxx anti collision cl1
uint8_t fm11rfxx_info(fm11rfxx_info_t *info)
get chip information
uint8_t fm11rfxx_set_sector_permission(fm11rfxx_handle_t *handle, uint8_t sector, uint8_t key_a[6], uint8_t block_0_0_4, uint8_t block_1_5_9, uint8_t block_2_10_14, uint8_t block_3_15, uint8_t user_data, uint8_t key_b[6])
fm11rfxx set the sector permission
fm11rfxx_type_t
fm11rfxx type enumeration definition
uint8_t fm11rfxx_read(fm11rfxx_handle_t *handle, uint8_t block, uint8_t data[16])
fm11rfxx read
uint8_t fm11rfxx_authentication(fm11rfxx_handle_t *handle, uint8_t id[4], uint8_t block, fm11rfxx_authentication_key_t key_type, uint8_t key[6])
fm11rfxx authentication
uint8_t fm11rfxx_value_write(fm11rfxx_handle_t *handle, uint8_t block, int32_t value, uint8_t addr)
fm11rfxx value write
struct fm11rfxx_info_s fm11rfxx_info_t
fm11rfxx information structure definition
uint8_t fm11rfxx_restore(fm11rfxx_handle_t *handle, uint8_t block)
fm11rfxx restore
uint8_t fm11rfxx_value_init(fm11rfxx_handle_t *handle, uint8_t block, int32_t value, uint8_t addr)
fm11rfxx init one block as a value block
uint8_t fm11rfxx_select_cl2(fm11rfxx_handle_t *handle, uint8_t id[4])
fm11rfxx select cl2
struct fm11rfxx_handle_s fm11rfxx_handle_t
fm11rfxx handle structure definition
fm11rfxx_load_modulation_t
fm11rfxx load modulation enumeration definition
uint8_t fm11rfxx_decrement(fm11rfxx_handle_t *handle, uint8_t block, uint32_t value)
fm11rfxx decrement
fm11rfxx_authentication_key_t
fm11rfxx authentication key enumeration definition
uint8_t fm11rfxx_set_modulation(fm11rfxx_handle_t *handle, fm11rfxx_load_modulation_t mod)
fm11rfxx set the load modulation
uint8_t fm11rfxx_value_read(fm11rfxx_handle_t *handle, uint8_t block, int32_t *value, uint8_t *addr)
fm11rfxx value read
uint8_t fm11rfxx_request(fm11rfxx_handle_t *handle, fm11rfxx_type_t *type)
fm11rfxx request
uint8_t fm11rfxx_wake_up(fm11rfxx_handle_t *handle, fm11rfxx_type_t *type)
fm11rfxx wake up
uint8_t fm11rfxx_halt(fm11rfxx_handle_t *handle)
fm11rfxx halt
uint8_t fm11rfxx_anticollision_cl2(fm11rfxx_handle_t *handle, uint8_t id[4])
fm11rfxx anti collision cl2
uint8_t fm11rfxx_init(fm11rfxx_handle_t *handle)
initialize the chip
uint8_t fm11rfxx_increment(fm11rfxx_handle_t *handle, uint8_t block, uint32_t value)
fm11rfxx increment
uint8_t fm11rfxx_write(fm11rfxx_handle_t *handle, uint8_t block, uint8_t data[16])
fm11rfxx write
uint8_t fm11rfxx_block_to_sector(fm11rfxx_handle_t *handle, uint8_t block, uint8_t *sector)
fm11rfxx block number to sector number
uint8_t fm11rfxx_transfer(fm11rfxx_handle_t *handle, uint8_t block)
fm11rfxx transfer
uint8_t fm11rfxx_sector_block_count(fm11rfxx_handle_t *handle, uint8_t sector, uint8_t *count)
fm11rfxx get the sector's block counter
@ FM11RFXX_PERSONALIZED_UID_3
@ FM11RFXX_PERSONALIZED_UID_2
@ FM11RFXX_PERSONALIZED_UID_1
@ FM11RFXX_PERSONALIZED_UID_0
@ FM11RFXX_TYPE_FM11RF08
@ FM11RFXX_TYPE_INVALID
@ FM11RFXX_TYPE_FM11RF32
@ FM11RFXX_LOAD_MODULATION_NORMAL
@ FM11RFXX_LOAD_MODULATION_STRONG
@ FM11RFXX_AUTHENTICATION_KEY_B
@ FM11RFXX_AUTHENTICATION_KEY_A
uint8_t fm11rfxx_transceiver(fm11rfxx_handle_t *handle, uint8_t *in_buf, uint8_t in_len, uint8_t *out_buf, uint8_t *out_len)
transceiver data
fm11rfxx handle structure definition
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* contactless_deinit)(void)
uint8_t(* contactless_transceiver)(uint8_t *in_buf, uint8_t in_len, uint8_t *out_buf, uint8_t *out_len)
uint8_t(* contactless_init)(void)
fm11rfxx information structure definition
char manufacturer_name[32]