1 /****************************************************************************** 2 * 3 * Copyright (C) 2010-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 * This file contains the call-in functions for NFA HCI 22 * 23 ******************************************************************************/ 24 #include <string.h> 25 #include "nfa_hci_api.h" 26 #include "nfa_hci_int.h" 27 #include "nfa_nv_co.h" 28 29 /******************************************************************************* 30 ** 31 ** Function nfa_nv_ci_read 32 ** 33 ** Description call-in function for non volatile memory read acess 34 ** 35 ** Returns none 36 ** 37 *******************************************************************************/ nfa_nv_ci_read(uint16_t num_bytes_read,tNFA_NV_CO_STATUS status,uint8_t block)38void nfa_nv_ci_read(uint16_t num_bytes_read, tNFA_NV_CO_STATUS status, 39 uint8_t block) { 40 tNFA_HCI_EVENT_DATA* p_msg; 41 42 p_msg = (tNFA_HCI_EVENT_DATA*)GKI_getbuf(sizeof(tNFA_HCI_EVENT_DATA)); 43 if (p_msg != nullptr) { 44 p_msg->nv_read.hdr.event = NFA_HCI_RSP_NV_READ_EVT; 45 46 if ((status == NFA_STATUS_OK) && (num_bytes_read != 0)) 47 p_msg->nv_read.status = NFA_STATUS_OK; 48 else 49 p_msg->nv_read.status = NFA_STATUS_FAILED; 50 51 p_msg->nv_read.size = num_bytes_read; 52 p_msg->nv_read.block = block; 53 nfa_sys_sendmsg(p_msg); 54 } 55 } 56 57 /******************************************************************************* 58 ** 59 ** Function nfa_nv_ci_write 60 ** 61 ** Description call-in function for non volatile memory write acess 62 ** 63 ** Returns none 64 ** 65 *******************************************************************************/ nfa_nv_ci_write(tNFA_NV_CO_STATUS status)66void nfa_nv_ci_write(tNFA_NV_CO_STATUS status) { 67 tNFA_HCI_EVENT_DATA* p_msg; 68 69 p_msg = (tNFA_HCI_EVENT_DATA*)GKI_getbuf(sizeof(tNFA_HCI_EVENT_DATA)); 70 if (p_msg != nullptr) { 71 p_msg->nv_write.hdr.event = NFA_HCI_RSP_NV_WRITE_EVT; 72 p_msg->nv_write.status = 73 (status == NFA_NV_CO_OK) ? NFA_STATUS_OK : NFA_STATUS_FAILED; 74 nfa_sys_sendmsg(p_msg); 75 } 76 } 77