LibDriver MIFARE_CLASSIC
Loading...
Searching...
No Matches
driver_mifare_classic.h File Reference

driver mifare classic header file More...

#include <stdio.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for driver_mifare_classic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mifare_classic_handle_s
 mifare_classic handle structure definition More...
struct  mifare_classic_info_s
 mifare_classic information structure definition More...

Macros

#define DRIVER_MIFARE_CLASSIC_LINK_INIT(HANDLE, STRUCTURE)
 initialize mifare_classic_handle_t structure
#define DRIVER_MIFARE_CLASSIC_LINK_CONTACTLESS_INIT(HANDLE, FUC)
 link contactless_init function
#define DRIVER_MIFARE_CLASSIC_LINK_CONTACTLESS_DEINIT(HANDLE, FUC)
 link contactless_deinit function
#define DRIVER_MIFARE_CLASSIC_LINK_CONTACTLESS_TRANSCEIVER(HANDLE, FUC)
 link contactless_transceiver function
#define DRIVER_MIFARE_CLASSIC_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_MIFARE_CLASSIC_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct mifare_classic_handle_s mifare_classic_handle_t
 mifare_classic handle structure definition
typedef struct mifare_classic_info_s mifare_classic_info_t
 mifare_classic information structure definition

Enumerations

enum  mifare_classic_type_t { MIFARE_CLASSIC_TYPE_INVALID = 0x00 , MIFARE_CLASSIC_TYPE_S50 = 0x01 , MIFARE_CLASSIC_TYPE_S70 = 0x02 }
 mifare_classic type enumeration definition More...
enum  mifare_classic_load_modulation_t { MIFARE_CLASSIC_LOAD_MODULATION_NORMAL = 0x00 , MIFARE_CLASSIC_LOAD_MODULATION_STRONG = 0x01 }
 mifare_classic load modulation enumeration definition More...
enum  mifare_classic_personalized_uid_t { MIFARE_CLASSIC_PERSONALIZED_UID_0 = 0x00 , MIFARE_CLASSIC_PERSONALIZED_UID_1 = 0x40 , MIFARE_CLASSIC_PERSONALIZED_UID_2 = 0x20 , MIFARE_CLASSIC_PERSONALIZED_UID_3 = 0x60 }
 mifare_classic personalized uid enumeration definition More...
enum  mifare_classic_authentication_key_t { MIFARE_CLASSIC_AUTHENTICATION_KEY_A = 0x00 , MIFARE_CLASSIC_AUTHENTICATION_KEY_B = 0x01 }
 mifare_classic authentication key enumeration definition More...

Functions

uint8_t mifare_classic_info (mifare_classic_info_t *info)
 get chip information
uint8_t mifare_classic_init (mifare_classic_handle_t *handle)
 initialize the chip
uint8_t mifare_classic_deinit (mifare_classic_handle_t *handle)
 close the chip
uint8_t mifare_classic_request (mifare_classic_handle_t *handle, mifare_classic_type_t *type)
 mifare request
uint8_t mifare_classic_wake_up (mifare_classic_handle_t *handle, mifare_classic_type_t *type)
 mifare wake up
uint8_t mifare_classic_halt (mifare_classic_handle_t *handle)
 mifare halt
uint8_t mifare_classic_set_modulation (mifare_classic_handle_t *handle, mifare_classic_load_modulation_t mod)
 mifare set the load modulation
uint8_t mifare_classic_set_personalized_uid (mifare_classic_handle_t *handle, mifare_classic_personalized_uid_t type)
 mifare set the personalized uid
uint8_t mifare_classic_anticollision_cl1 (mifare_classic_handle_t *handle, uint8_t id[4])
 mifare anti collision cl1
uint8_t mifare_classic_anticollision_cl2 (mifare_classic_handle_t *handle, uint8_t id[4])
 mifare anti collision cl2
uint8_t mifare_classic_select_cl1 (mifare_classic_handle_t *handle, uint8_t id[4])
 mifare select cl1
uint8_t mifare_classic_select_cl2 (mifare_classic_handle_t *handle, uint8_t id[4])
 mifare select cl2
uint8_t mifare_classic_authentication (mifare_classic_handle_t *handle, uint8_t id[4], uint8_t block, mifare_classic_authentication_key_t key_type, uint8_t key[6])
 mifare authentication
uint8_t mifare_classic_read (mifare_classic_handle_t *handle, uint8_t block, uint8_t data[16])
 mifare read
uint8_t mifare_classic_write (mifare_classic_handle_t *handle, uint8_t block, uint8_t data[16])
 mifare write
uint8_t mifare_classic_value_init (mifare_classic_handle_t *handle, uint8_t block, int32_t value, uint8_t addr)
 mifare init one block as a value block
uint8_t mifare_classic_value_write (mifare_classic_handle_t *handle, uint8_t block, int32_t value, uint8_t addr)
 mifare value write
uint8_t mifare_classic_value_read (mifare_classic_handle_t *handle, uint8_t block, int32_t *value, uint8_t *addr)
 mifare value read
uint8_t mifare_classic_increment (mifare_classic_handle_t *handle, uint8_t block, uint32_t value)
 mifare increment
uint8_t mifare_classic_decrement (mifare_classic_handle_t *handle, uint8_t block, uint32_t value)
 mifare decrement
uint8_t mifare_classic_transfer (mifare_classic_handle_t *handle, uint8_t block)
 mifare transfer
uint8_t mifare_classic_restore (mifare_classic_handle_t *handle, uint8_t block)
 mifare restore
uint8_t mifare_classic_block_to_sector (mifare_classic_handle_t *handle, uint8_t block, uint8_t *sector)
 mifare block number to sector number
uint8_t mifare_classic_sector_block_count (mifare_classic_handle_t *handle, uint8_t sector, uint8_t *count)
 mifare get the sector's block counter
uint8_t mifare_classic_sector_first_block (mifare_classic_handle_t *handle, uint8_t sector, uint8_t *block)
 mifare get the sector's first block
uint8_t mifare_classic_sector_last_block (mifare_classic_handle_t *handle, uint8_t sector, uint8_t *block)
 mifare get the sector's last block
uint8_t mifare_classic_set_sector_permission (mifare_classic_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])
 mifare set the sector permission
uint8_t mifare_classic_get_sector_permission (mifare_classic_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])
 mifare get the sector permission
uint8_t mifare_classic_transceiver (mifare_classic_handle_t *handle, uint8_t *in_buf, uint8_t in_len, uint8_t *out_buf, uint8_t *out_len)
 transceiver data

Detailed Description

driver mifare classic header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2022-06-30

history

Date Version Author Description
2022/06/30 1.0 Shifeng Li first upload

Definition in file driver_mifare_classic.h.