1 /****************************************************************************** 2 * 3 * Copyright (C) 2010-2013 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 * 22 * This file contains the call-in functions for NFC HAL HCI 23 * 24 ******************************************************************************/ 25 #include <string.h> 26 #include "gki.h" 27 #include "nfc_hal_api.h" 28 #include "nfc_hal_int.h" 29 #include "nfc_hal_nv_ci.h" 30 #include "nfc_hal_nv_co.h" 31 32 /******************************************************************************* 33 ** 34 ** Function nfc_hal_nv_ci_read 35 ** 36 ** Description call-in function for non volatile memory read acess 37 ** 38 ** Returns none 39 ** 40 *******************************************************************************/ 41 void nfc_hal_nv_ci_read (UINT16 num_bytes_read, tNFC_HAL_NV_CO_STATUS status, UINT8 block) 42 { 43 tNFC_HAL_HCI_EVENT_DATA *p_msg; 44 45 /* Send message to NCIT task */ 46 if ((p_msg = (tNFC_HAL_HCI_EVENT_DATA *) GKI_getbuf (sizeof (tNFC_HAL_HCI_EVENT_DATA))) != NULL) 47 { 48 p_msg->nv_read.hdr.event = NFC_HAL_HCI_RSP_NV_READ_EVT; 49 p_msg->hdr.offset = 0; 50 p_msg->hdr.len = sizeof (tNFC_HAL_HCI_RSP_NV_READ_EVT); 51 p_msg->hdr.layer_specific = 0; 52 53 if ( (status == NFC_HAL_NV_CO_OK) 54 &&(num_bytes_read != 0) ) 55 p_msg->nv_read.status = HAL_NFC_STATUS_OK; 56 else 57 p_msg->nv_read.status = HAL_NFC_STATUS_FAILED; 58 59 p_msg->nv_read.size = num_bytes_read; 60 p_msg->nv_read.block = block; 61 62 GKI_send_msg (NFC_HAL_TASK, NFC_HAL_TASK_MBOX, p_msg); 63 } 64 } 65 66 /******************************************************************************* 67 ** 68 ** Function nfc_hal_nv_ci_write 69 ** 70 ** Description call-in function for non volatile memory write acess 71 ** 72 ** Returns none 73 ** 74 *******************************************************************************/ 75 void nfc_hal_nv_ci_write (tNFC_HAL_NV_CO_STATUS status) 76 { 77 tNFC_HAL_HCI_EVENT_DATA *p_msg; 78 79 if ((p_msg = (tNFC_HAL_HCI_EVENT_DATA *) GKI_getbuf (sizeof (tNFC_HAL_HCI_EVENT_DATA))) != NULL) 80 { 81 p_msg->nv_write.hdr.event = NFC_HAL_HCI_RSP_NV_WRITE_EVT; 82 p_msg->nv_write.hdr.offset = 0; 83 p_msg->nv_write.hdr.len = sizeof (tNFC_HAL_HCI_RSP_NV_READ_EVT); 84 p_msg->nv_write.hdr.layer_specific = 0; 85 p_msg->nv_write.status = HAL_NFC_STATUS_OK; 86 87 GKI_send_msg (NFC_HAL_TASK, NFC_HAL_TASK_MBOX, p_msg); 88 } 89 } 90 91