1 /******************************************************************************
2  *
3  *  Copyright (C) 2009-2014 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 
20 /******************************************************************************
21  *
22  *  This file contains the common data types shared by Reader/Writer mode
23  *  and Card Emulation.
24  *
25  ******************************************************************************/
26 
27 #ifndef TAGS_INT_H
28 #define TAGS_INT_H
29 
30 /******************************************************************************
31 // T1T command and response definitions
32 ******************************************************************************/
33 
34 typedef struct
35 {
36     UINT8   opcode;
37     UINT8   cmd_len;
38     UINT8   uid_offset;
39     UINT8   rsp_len;
40 } tT1T_CMD_RSP_INFO;
41 
42 typedef struct
43 {
44     UINT8   tag_model;
45     UINT8   tms;
46     UINT8   b_dynamic;
47     UINT8   lock_tlv[3];
48     UINT8   mem_tlv[3];
49 } tT1T_INIT_TAG;
50 
51 typedef struct
52 {
53     UINT8   manufacturer_id;
54     BOOLEAN b_multi_version;
55     UINT8   version_block;
56     UINT16  version_no;
57     UINT16  version_bmask;
58     UINT8   b_calc_cc;
59     UINT8   tms;
60     BOOLEAN b_otp;
61     UINT8   default_lock_blpb;
62 } tT2T_INIT_TAG;
63 
64 typedef struct
65 {
66     UINT8   opcode;
67     UINT8   cmd_len;
68     UINT8   rsp_len;
69     UINT8   nack_rsp_len;
70 } tT2T_CMD_RSP_INFO;
71 
72 extern const UINT8 t4t_v10_ndef_tag_aid[];  /* V1.0 Type 4 Tag Applicaiton ID */
73 extern const UINT8 t4t_v20_ndef_tag_aid[];  /* V2.0 Type 4 Tag Applicaiton ID */
74 
75 extern const tT1T_CMD_RSP_INFO t1t_cmd_rsp_infos[];
76 extern const tT1T_INIT_TAG t1t_init_content[];
77 extern const tT1T_CMD_RSP_INFO * t1t_cmd_to_rsp_info (UINT8 opcode);
78 extern const tT1T_INIT_TAG * t1t_tag_init_data (UINT8 tag_model);
79 extern UINT8 t1t_info_to_evt (const tT1T_CMD_RSP_INFO * p_info);
80 
81 extern const tT2T_INIT_TAG * t2t_tag_init_data (UINT8 manufacturer_id, BOOLEAN b_valid_ver, UINT16 version_no);
82 extern const tT2T_CMD_RSP_INFO t2t_cmd_rsp_infos[];
83 extern const tT2T_CMD_RSP_INFO * t2t_cmd_to_rsp_info (UINT8 opcode);
84 extern UINT8 t2t_info_to_evt (const tT2T_CMD_RSP_INFO * p_info);
85 
86 
87 #if (BT_TRACE_PROTOCOL == TRUE)
88 extern const char * t1t_info_to_str (const tT1T_CMD_RSP_INFO * p_info);
89 extern const char * t2t_info_to_str (const tT2T_CMD_RSP_INFO * p_info);
90 #else
91 #define t1t_info_to_str(x) ""
92 #define t2t_info_to_str(x) ""
93 #endif
94 extern int tags_pow (int x, int y);
95 extern unsigned int tags_log2 (register unsigned int x);
96 
97 
98 #endif /* TAGS_INT_H */
99