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