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 #include "../includes/common.h" 18 #include <stdlib.h> 19 20 #include <nfc_api.h> 21 #include <rw_int.h> 22 23 #define INITIAL_VALUE 0xBE 24 #define NUM_BYTES 1 25 26 extern tRW_CB rw_cb; 27 void rw_init(void); 28 void rw_t2t_handle_rsp(uint8_t *p_data); 29 poc_cback(tRW_EVENT event,tRW_DATA * p_rw_data)30void poc_cback(tRW_EVENT event, tRW_DATA *p_rw_data) { 31 (void)event; 32 (void)p_rw_data; 33 } 34 main()35int main() { 36 tRW_T2T_CB *p_t2t = &rw_cb.tcb.t2t; 37 rw_init(); 38 rw_cb.p_cback = &poc_cback; 39 p_t2t->state = RW_T2T_STATE_DETECT_TLV; 40 p_t2t->tlv_detect = TAG_LOCK_CTRL_TLV; 41 p_t2t->substate = RW_T2T_SUBSTATE_WAIT_READ_TLV_VALUE; 42 p_t2t->found_tlv = TAG_LOCK_CTRL_TLV; 43 p_t2t->bytes_count = NUM_BYTES; 44 p_t2t->tlv_value[1] = UINT8_MAX; 45 uint8_t *base_ptr = (uint8_t *)(p_t2t->lockbyte + RW_T1T_MAX_LOCK_BYTES); 46 memset((void *)base_ptr, INITIAL_VALUE, sizeof(tRW_T1T_LOCK)); 47 uint8_t data[T2T_READ_DATA_LEN]; 48 rw_t2t_handle_rsp(data); 49 return EXIT_SUCCESS; 50 } 51