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