1 /******************************************************************************
2  *
3  *  Copyright (C) 2012-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  *  NFC Hardware Abstraction Layer API
22  *
23  ******************************************************************************/
24 #ifndef NFC_HAL_API_H
25 #define NFC_HAL_API_H
26 #include <hardware/nfc.h>
27 #include "data_types.h"
28 #include "nfc_hal_target.h"
29 
30 typedef uint8_t tHAL_NFC_STATUS;
31 typedef void(tHAL_NFC_STATUS_CBACK)(tHAL_NFC_STATUS status);
32 typedef void(tHAL_NFC_CBACK)(uint8_t event, tHAL_NFC_STATUS status);
33 typedef void(tHAL_NFC_DATA_CBACK)(uint16_t data_len, uint8_t* p_data);
34 
35 /*******************************************************************************
36 ** tHAL_NFC_ENTRY HAL entry-point lookup table
37 *******************************************************************************/
38 
39 typedef void(tHAL_API_INITIALIZE)(void);
40 typedef void(tHAL_API_TERMINATE)(void);
41 typedef void(tHAL_API_OPEN)(tHAL_NFC_CBACK* p_hal_cback,
42                             tHAL_NFC_DATA_CBACK* p_data_cback);
43 typedef void(tHAL_API_CLOSE)(void);
44 typedef void(tHAL_API_CORE_INITIALIZED)(uint16_t data_len,
45                                         uint8_t* p_core_init_rsp_params);
46 typedef void(tHAL_API_WRITE)(uint16_t data_len, uint8_t* p_data);
47 typedef bool(tHAL_API_PREDISCOVER)(void);
48 typedef void(tHAL_API_CONTROL_GRANTED)(void);
49 typedef void(tHAL_API_POWER_CYCLE)(void);
50 typedef uint8_t(tHAL_API_GET_MAX_NFCEE)(void);
51 
52 typedef struct {
53   tHAL_API_INITIALIZE* initialize;
54   tHAL_API_TERMINATE* terminate;
55   tHAL_API_OPEN* open;
56   tHAL_API_CLOSE* close;
57   tHAL_API_CORE_INITIALIZED* core_initialized;
58   tHAL_API_WRITE* write;
59   tHAL_API_PREDISCOVER* prediscover;
60   tHAL_API_CONTROL_GRANTED* control_granted;
61   tHAL_API_POWER_CYCLE* power_cycle;
62   tHAL_API_GET_MAX_NFCEE* get_max_ee;
63 
64 } tHAL_NFC_ENTRY;
65 
66 /*******************************************************************************
67 ** HAL API Function Prototypes
68 *******************************************************************************/
69 
70 #endif /* NFC_HAL_API_H  */
71