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