• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "nfa_sys.h"
29 
30 /*******************************************************************************
31 **
32 ** Function         nfa_nv_ci_read
33 **
34 ** Description      call-in function for non volatile memory read acess
35 **
36 ** Returns          none
37 **
38 *******************************************************************************/
nfa_nv_ci_read(uint16_t num_bytes_read,tNFA_NV_CO_STATUS status,uint8_t block)39 void nfa_nv_ci_read(uint16_t num_bytes_read, tNFA_NV_CO_STATUS status,
40                     uint8_t block) {
41   tNFA_HCI_EVENT_DATA* p_msg;
42 
43   p_msg = (tNFA_HCI_EVENT_DATA*)GKI_getbuf(sizeof(tNFA_HCI_EVENT_DATA));
44   if (p_msg != NULL) {
45     p_msg->nv_read.hdr.event = NFA_HCI_RSP_NV_READ_EVT;
46 
47     if ((status == NFA_STATUS_OK) && (num_bytes_read != 0))
48       p_msg->nv_read.status = NFA_STATUS_OK;
49     else
50       p_msg->nv_read.status = NFA_STATUS_FAILED;
51 
52     p_msg->nv_read.size = num_bytes_read;
53     p_msg->nv_read.block = block;
54     nfa_sys_sendmsg(p_msg);
55   }
56 }
57 
58 /*******************************************************************************
59 **
60 ** Function         nfa_nv_ci_write
61 **
62 ** Description      call-in function for non volatile memory write acess
63 **
64 ** Returns          none
65 **
66 *******************************************************************************/
nfa_nv_ci_write(tNFA_NV_CO_STATUS status)67 void nfa_nv_ci_write(tNFA_NV_CO_STATUS status) {
68   tNFA_HCI_EVENT_DATA* p_msg;
69 
70   p_msg = (tNFA_HCI_EVENT_DATA*)GKI_getbuf(sizeof(tNFA_HCI_EVENT_DATA));
71   if (p_msg != NULL) {
72     p_msg->nv_write.hdr.event = NFA_HCI_RSP_NV_WRITE_EVT;
73     p_msg->nv_write.status = 0;
74     nfa_sys_sendmsg(p_msg);
75   }
76 }
77