xref: /aosp_15_r20/system/nfc/src/include/hardware_nfc.h (revision 7eba2f3b06c51ae21384f6a4f14577b668a869b3)
1*7eba2f3bSAndroid Build Coastguard Worker /*
2*7eba2f3bSAndroid Build Coastguard Worker  * Copyright (C) 2021 The Android Open Source Project
3*7eba2f3bSAndroid Build Coastguard Worker  *
4*7eba2f3bSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*7eba2f3bSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*7eba2f3bSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*7eba2f3bSAndroid Build Coastguard Worker  *
8*7eba2f3bSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*7eba2f3bSAndroid Build Coastguard Worker  *
10*7eba2f3bSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*7eba2f3bSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*7eba2f3bSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*7eba2f3bSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*7eba2f3bSAndroid Build Coastguard Worker  * limitations under the License.
15*7eba2f3bSAndroid Build Coastguard Worker  */
16*7eba2f3bSAndroid Build Coastguard Worker #pragma once
17*7eba2f3bSAndroid Build Coastguard Worker 
18*7eba2f3bSAndroid Build Coastguard Worker typedef uint8_t nfc_event_t;
19*7eba2f3bSAndroid Build Coastguard Worker typedef uint8_t nfc_status_t;
20*7eba2f3bSAndroid Build Coastguard Worker 
21*7eba2f3bSAndroid Build Coastguard Worker /*
22*7eba2f3bSAndroid Build Coastguard Worker  * The callback passed in from the NFC stack that the HAL
23*7eba2f3bSAndroid Build Coastguard Worker  * can use to pass events back to the stack.
24*7eba2f3bSAndroid Build Coastguard Worker  */
25*7eba2f3bSAndroid Build Coastguard Worker typedef void(nfc_stack_callback_t)(nfc_event_t event,
26*7eba2f3bSAndroid Build Coastguard Worker                                    nfc_status_t event_status);
27*7eba2f3bSAndroid Build Coastguard Worker 
28*7eba2f3bSAndroid Build Coastguard Worker /*
29*7eba2f3bSAndroid Build Coastguard Worker  * The callback passed in from the NFC stack that the HAL
30*7eba2f3bSAndroid Build Coastguard Worker  * can use to pass incomming data to the stack.
31*7eba2f3bSAndroid Build Coastguard Worker  */
32*7eba2f3bSAndroid Build Coastguard Worker typedef void(nfc_stack_data_callback_t)(uint16_t data_len, uint8_t* p_data);
33*7eba2f3bSAndroid Build Coastguard Worker 
34*7eba2f3bSAndroid Build Coastguard Worker enum {
35*7eba2f3bSAndroid Build Coastguard Worker   HAL_NFC_OPEN_CPLT_EVT = 0u,
36*7eba2f3bSAndroid Build Coastguard Worker   HAL_NFC_CLOSE_CPLT_EVT = 1u,
37*7eba2f3bSAndroid Build Coastguard Worker   HAL_NFC_POST_INIT_CPLT_EVT = 2u,
38*7eba2f3bSAndroid Build Coastguard Worker   HAL_NFC_PRE_DISCOVER_CPLT_EVT = 3u,
39*7eba2f3bSAndroid Build Coastguard Worker   HAL_NFC_REQUEST_CONTROL_EVT = 4u,
40*7eba2f3bSAndroid Build Coastguard Worker   HAL_NFC_RELEASE_CONTROL_EVT = 5u,
41*7eba2f3bSAndroid Build Coastguard Worker   HAL_NFC_ERROR_EVT = 6u,
42*7eba2f3bSAndroid Build Coastguard Worker   HAL_HCI_NETWORK_RESET = 7u,
43*7eba2f3bSAndroid Build Coastguard Worker };
44*7eba2f3bSAndroid Build Coastguard Worker 
45*7eba2f3bSAndroid Build Coastguard Worker enum {
46*7eba2f3bSAndroid Build Coastguard Worker   HAL_NFC_STATUS_OK = 0u,
47*7eba2f3bSAndroid Build Coastguard Worker   HAL_NFC_STATUS_FAILED = 1u,
48*7eba2f3bSAndroid Build Coastguard Worker   HAL_NFC_STATUS_ERR_TRANSPORT = 2u,
49*7eba2f3bSAndroid Build Coastguard Worker   HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 3u,
50*7eba2f3bSAndroid Build Coastguard Worker   HAL_NFC_STATUS_REFUSED = 4u,
51*7eba2f3bSAndroid Build Coastguard Worker };
52