1/******************************************************************************
2 *
3 *  Copyright (C) 2003-2013 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 is the interface file for storing nv data
23 *
24 ******************************************************************************/
25#ifndef NFC_HAL_NV_CO_H
26#define NFC_HAL_NV_CO_H
27
28#include <time.h>
29
30
31/*****************************************************************************
32**  Constants and Data Types
33*****************************************************************************/
34
35
36/**************************
37**  Common Definitions
38***************************/
39
40/* Status codes returned by call-out functions, or in call-in functions as status */
41#define NFC_HAL_NV_CO_OK            0x00
42#define NFC_HAL_NV_CO_FAIL          0x01 /* Used to pass all other errors */
43#define NFC_HAL_NV_CO_EACCES        0x02
44#define NFC_HAL_NV_CO_ENOTEMPTY     0x03
45#define NFC_HAL_NV_CO_EOF           0x04
46#define NFC_HAL_NV_CO_EODIR         0x05
47#define NFC_HAL_NV_CO_ENOSPACE      0x06 /* Returned in nfa_nv_ci_open if no room */
48#define NFC_HAL_NV_CO_EIS_DIR       0x07
49#define NFC_HAL_NV_CO_RESUME        0x08 /* used in nfa_nv_ci_open, on resume */
50#define NFC_HAL_NV_CO_NONE          0x09 /* used in nfa_nv_ci_open, on resume (no file to resume) */
51
52typedef UINT8 tNFC_HAL_NV_CO_STATUS;
53
54#define  DH_NV_BLOCK            0x01
55#define  HC_F3_NV_BLOCK         0x02
56#define  HC_F4_NV_BLOCK         0x03
57#define  HC_F2_NV_BLOCK         0x04
58
59/*****************************************************************************
60**  Function Declarations
61*****************************************************************************/
62/**************************
63**  Common Functions
64***************************/
65
66/*******************************************************************************
67**
68** Function         nfc_hal_nv_co_read
69**
70** Description      This function is called by NFA to read in data from the
71**                  previously opened file.
72**
73** Parameters       p_buf   - buffer to read the data into.
74**                  nbytes  - number of bytes to read into the buffer.
75**
76** Returns          void
77**
78**                  Note: Upon completion of the request, nfa_nv_ci_read () is
79**                        called with the buffer of data, along with the number
80**                        of bytes read into the buffer, and a status.  The
81**                        call-in function should only be called when ALL requested
82**                        bytes have been read, the end of file has been detected,
83**                        or an error has occurred.
84**
85*******************************************************************************/
86void nfc_hal_nv_co_read (UINT8 *p_buf, UINT16 nbytes, UINT8 block);
87
88/*******************************************************************************
89**
90** Function         nfc_hal_nv_co_write
91**
92** Description      This function is called by io to send file data to the
93**                  phone.
94**
95** Parameters       p_buf   - buffer to read the data from.
96**                  nbytes  - number of bytes to write out to the file.
97**
98** Returns          void
99**
100**                  Note: Upon completion of the request, nfa_nv_ci_write () is
101**                        called with the file descriptor and the status.  The
102**                        call-in function should only be called when ALL requested
103**                        bytes have been written, or an error has been detected,
104**
105*******************************************************************************/
106void nfc_hal_nv_co_write (const UINT8 *p_buf, UINT16 nbytes, UINT8 block);
107
108
109#endif /* NFC_HAL_NV_CO_H */
110