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 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 36 typedef struct 37 { 38 struct nfc_nci_device nci_device; 39 //below declarations are private variables within Broadcom HAL 40 void* data; 41 } 42 bcm2079x_dev_t; 43 44 45 /* 46 All functions return POSIX error codes (see errno): 47 0 means success. 48 non-zero means failure; for example EACCES. 49 */ 50 51 52 extern int HaiInitializeLibrary (const bcm2079x_dev_t* device); 53 extern int HaiTerminateLibrary (); 54 extern int HaiOpen (const bcm2079x_dev_t* device, nfc_stack_callback_t* halCallbackFunc, nfc_stack_data_callback_t* halDataCallbackFunc); 55 extern int HaiClose (const bcm2079x_dev_t* device); 56 extern int HaiCoreInitialized (const bcm2079x_dev_t* device, uint8_t* coreInitResponseParams); 57 extern int HaiWrite (const bcm2079x_dev_t* dev, uint16_t dataLen, const uint8_t* data); 58 extern int HaiPreDiscover (const bcm2079x_dev_t* device); 59 extern int HaiControlGranted (const bcm2079x_dev_t* device); 60 extern int HaiPowerCycle (const bcm2079x_dev_t* device); 61 extern int HaiGetMaxNfcee (const bcm2079x_dev_t* device, uint8_t* maxNfcee); 62 63 64 #ifdef __cplusplus 65 } 66 #endif 67