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