1/******************************************************************************
2 *
3 *  Copyright (C) 2009-2012 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 *  This file contains the common data types shared by Reader/Writer mode
22 *  and Card Emulation.
23 *
24 ******************************************************************************/
25
26#ifndef TAGS_INT_H
27#define TAGS_INT_H
28
29/******************************************************************************
30// T1T command and response definitions
31******************************************************************************/
32
33typedef struct
34{
35    UINT8   opcode;
36    UINT8   cmd_len;
37    UINT8   uid_offset;
38    UINT8   rsp_len;
39} tT1T_CMD_RSP_INFO;
40
41typedef struct
42{
43    UINT8   tag_model;
44    UINT8   tms;
45    UINT8   b_dynamic;
46    UINT8   lock_tlv[3];
47    UINT8   mem_tlv[3];
48} tT1T_INIT_TAG;
49
50typedef struct
51{
52    UINT8   manufacturer_id;
53    BOOLEAN b_multi_version;
54    UINT8   version_block;
55    UINT16  version_no;
56    UINT16  version_bmask;
57    UINT8   b_calc_cc;
58    UINT8   tms;
59    BOOLEAN b_otp;
60    UINT8   default_lock_blpb;
61} tT2T_INIT_TAG;
62
63typedef struct
64{
65    UINT8   opcode;
66    UINT8   cmd_len;
67    UINT8   rsp_len;
68    UINT8   nack_rsp_len;
69} tT2T_CMD_RSP_INFO;
70
71extern const UINT8 t4t_v10_ndef_tag_aid[];  /* V1.0 Type 4 Tag Applicaiton ID */
72extern const UINT8 t4t_v20_ndef_tag_aid[];  /* V2.0 Type 4 Tag Applicaiton ID */
73
74extern const tT1T_CMD_RSP_INFO t1t_cmd_rsp_infos[];
75extern const tT1T_INIT_TAG t1t_init_content[];
76extern const tT1T_CMD_RSP_INFO * t1t_cmd_to_rsp_info (UINT8 opcode);
77extern const tT1T_INIT_TAG * t1t_tag_init_data (UINT8 tag_model);
78extern UINT8 t1t_info_to_evt (const tT1T_CMD_RSP_INFO * p_info);
79
80extern const tT2T_INIT_TAG * t2t_tag_init_data (UINT8 manufacturer_id, BOOLEAN b_valid_ver, UINT16 version_no);
81extern const tT2T_CMD_RSP_INFO t2t_cmd_rsp_infos[];
82extern const tT2T_CMD_RSP_INFO * t2t_cmd_to_rsp_info (UINT8 opcode);
83extern UINT8 t2t_info_to_evt (const tT2T_CMD_RSP_INFO * p_info);
84
85
86#if (BT_TRACE_PROTOCOL == TRUE)
87extern const char * t1t_info_to_str (const tT1T_CMD_RSP_INFO * p_info);
88extern const char * t2t_info_to_str (const tT2T_CMD_RSP_INFO * p_info);
89#else
90#define t1t_info_to_str(x) ""
91#define t2t_info_to_str(x) ""
92#endif
93extern int tags_pow (int x, int y);
94extern unsigned int tags_log2 (register unsigned int x);
95
96
97#endif /* TAGS_INT_H */
98