xref: /aosp_15_r20/system/nfc/src/include/debug_lmrt.h (revision 7eba2f3b06c51ae21384f6a4f14577b668a869b3)
1 /**
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _DEBUG_LMRT_
18 #define _DEBUG_LMRT_
19 
20 #include <stdint.h>
21 
22 #include <string>
23 #include <vector>
24 
25 #include "nfc_int.h"
26 
27 /* The type definition of a group of RF_SET_LISTEN_MODE_ROUTING_CMD(s) */
28 typedef struct lmrt_payload_t {
29   std::vector<uint8_t> more;
30   std::vector<uint8_t> entry_count;
31   std::vector<std::vector<uint8_t>> tlvs;
32 }__attribute__((__packed__)) lmrt_payload_t;
33 
34 /*******************************************************************************
35 **
36 ** Function         debug_lmrt_init
37 **
38 ** Description      initialize the lmrt_payloads
39 **
40 ** Returns          None
41 **
42 *******************************************************************************/
43 void debug_lmrt_init(void);
44 
45 /*******************************************************************************
46 **
47 ** Function         lmrt_log
48 **
49 ** Description      print the listen mode routing configuration for debug use
50 **
51 ** Returns          None
52 **
53 *******************************************************************************/
54 void lmrt_log(void);
55 
56 /*******************************************************************************
57 **
58 ** Function         lmrt_capture
59 **
60 ** Description      record the last RF_SET_LISTEN_MODE_ROUTING_CMD
61 **
62 ** Returns          None
63 **
64 *******************************************************************************/
65 void lmrt_capture(uint8_t* buf, uint8_t buf_size);
66 
67 /*******************************************************************************
68 **
69 ** Function         lmrt_update
70 **
71 ** Description      Update the committed tlvs to committed_lmrt_tlvs
72 **
73 ** Returns          None
74 **
75 *******************************************************************************/
76 void lmrt_update(void);
77 
78 /*******************************************************************************
79 **
80 ** Function         lmrt_get_max_size
81 **
82 ** Description      This function is used to get the max size of the routing
83 **                  table from cache
84 **
85 ** Returns          Max Routing Table Size
86 **
87 *******************************************************************************/
88 int lmrt_get_max_size(void);
89 
90 /*******************************************************************************
91 **
92 ** Function         lmrt_get_tlvs
93 **
94 ** Description      This function is used to get the committed listen mode
95 **                  routing configuration command
96 **
97 ** Returns          The committed listen mode routing configuration command
98 **
99 *******************************************************************************/
100 std::vector<uint8_t>* lmrt_get_tlvs();
101 
102 #endif /* _DEBUG_LMRT_ */
103