1 /******************************************************************************
2  *
3  *  Copyright (C) 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  *  HAL Adaptation Interface (HAI). This interface regulates the interaction
22  *  between standard Android HAL and Broadcom-specific HAL.  It adapts
23  *  Broadcom-specific features to the Android framework.
24  *
25  ******************************************************************************/
26 #pragma once
27 #include <hardware/hardware.h>
28 #include <hardware/nfc.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 typedef struct {
35   struct nfc_nci_device nci_device;
36   // below declarations are private variables within Broadcom HAL
37   void* data;
38 } bcm2079x_dev_t;
39 
40 /*
41 All functions return POSIX error codes (see errno):
42   0 means success.
43   non-zero means failure; for example EACCES.
44 */
45 
46 extern int HaiInitializeLibrary(const bcm2079x_dev_t* device);
47 extern int HaiTerminateLibrary();
48 extern int HaiOpen(const bcm2079x_dev_t* device,
49                    nfc_stack_callback_t* halCallbackFunc,
50                    nfc_stack_data_callback_t* halDataCallbackFunc);
51 extern int HaiClose(const bcm2079x_dev_t* device);
52 extern int HaiCoreInitialized(const bcm2079x_dev_t* device,
53                               uint8_t* coreInitResponseParams);
54 extern int HaiWrite(const bcm2079x_dev_t* dev, uint16_t dataLen,
55                     const uint8_t* data);
56 extern int HaiPreDiscover(const bcm2079x_dev_t* device);
57 extern int HaiControlGranted(const bcm2079x_dev_t* device);
58 extern int HaiPowerCycle(const bcm2079x_dev_t* device);
59 extern int HaiGetMaxNfcee(const bcm2079x_dev_t* device, uint8_t* maxNfcee);
60 
61 #ifdef __cplusplus
62 }
63 #endif
64