yincheng.zhong
2024-08-20 7744fffacb03dc81cc9dbaf9f5d86a0f21e79c03
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
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef _7816_3_T1_CONFIG_COMMON_H_
#define _7816_3_T1_CONFIG_COMMON_H_
 
#ifdef __cplusplus
extern "C" {
#endif
 
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
 
typedef enum
{
    ESESTATUS_SUCCESS = 0,
    ESESTATUS_FAILED = 1,
    ESESTATUS_INVALID_PARAMETER = 2,
    ESESTATUS_NOT_INITIALISED = 3,
    ESESTATUS_ALREADY_INITIALISED = 4,
    ESESTATUS_FEATURE_NOT_SUPPORTED = 5,
    ESESTATUS_CONNECTION_SUCCESS = 6,
    ESESTATUS_CONNECTION_FAILED = 7,
    ESESTATUS_BUSY = 8,
    ESESTATUS_CLOSED = 9,
    ESESTATUS_OPENED = 10,
    ESESTATUS_MEM_EXCEPTION = 11,       // memory exception
    ESESTATUS_PH_IO = 12,               // write or read failed, return res < 0
    ESESTATUS_PH_IOR_INVALID_DATA = 13, // read invalid data
    ESESTATUS_RES_EXCEPTION = 14,       // resource exception
    ESESTATUS_PARITY_ERROR = 15,        // LRC or CRC error
    ESESTATUS_INVALID_PCB = 16,         // not I/R/S PCB
    ESESTATUS_INVALID_T1_LEN = 17,      // T1 INF length not matched
    ESESTATUS_FATAL_ERROR = 18,         // fatal error, need chip do hard reset to recovery.
    ESESTATUS_UNKNOWN_ERROR = 19,
    ESESTATUS_NO_DATA_TO_RECEIVE = 20,
} ESESTATUS;
 
typedef struct
{
    uint16_t len;
    uint8_t *p_data;
} SE_data;
 
#ifndef LRC_CRC_0
#define LRC_CRC_0
#endif
 
#ifndef USE_SPI_SPLIT_READ
#define USE_SPI_SPLIT_READ
#endif
 
extern unsigned int config_getUnsigned(const char *key, const unsigned int defaultVal);
extern void config_getString(char *buff, const char *key, const char *defaultVal);
 
#ifdef __cplusplus
}
#endif
 
#endif