• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 public interface file for the BTA system manager.
23  *
24  ******************************************************************************/
25 #ifndef NFA_SYS_H
26 #define NFA_SYS_H
27 
28 #include "nfc_target.h"
29 #include "gki.h"
30 #include "nfa_api.h"
31 
32 /*****************************************************************************
33 **  Constants and data types
34 *****************************************************************************/
35 
36 /* SW sub-systems */
37 enum {
38     NFA_ID_SYS,         /* system manager                      */
39     NFA_ID_DM,          /* device manager                      */
40     NFA_ID_EE,          /* NFCEE sub-system                    */
41     NFA_ID_P2P,         /* Peer-to-Peer sub-system             */
42     NFA_ID_CHO,         /* Connection Handover sub-system      */
43     NFA_ID_SNEP,        /* SNEP sub-system                     */
44     NFA_ID_RW,          /* Reader/writer sub-system            */
45     NFA_ID_CE,          /* Card-emulation sub-system           */
46     NFA_ID_HCI,         /* Host controller interface sub-system*/
47 #if (NFA_DTA_INCLUDED == TRUE)
48     NFA_ID_DTA,         /* Device Test Application sub-system  */
49 #endif
50     NFA_ID_MAX
51 };
52 typedef UINT8 tNFA_SYS_ID;
53 
54 /* enable function type */
55 typedef void (tNFA_SYS_ENABLE) (void);
56 
57 /* event handler function type */
58 typedef BOOLEAN (tNFA_SYS_EVT_HDLR) (BT_HDR *p_msg);
59 
60 /* disable function type */
61 typedef void (tNFA_SYS_DISABLE) (void);
62 
63 /* function type for processing the change of NFCC power mode */
64 typedef void (tNFA_SYS_PROC_NFCC_PWR_MODE) (UINT8 nfcc_power_mode);
65 
66 typedef void (tNFA_SYS_CBACK) (void);
67 typedef void (tNFA_SYS_ENABLE_CBACK) (void);
68 typedef void (tNFA_SYS_PROC_NFCC_PWR_MODE_CMPL) (void);
69 
70 /* registration structure */
71 typedef struct
72 {
73     tNFA_SYS_ENABLE                 *enable;
74     tNFA_SYS_EVT_HDLR               *evt_hdlr;
75     tNFA_SYS_DISABLE                *disable;
76     tNFA_SYS_PROC_NFCC_PWR_MODE     *proc_nfcc_pwr_mode;
77 } tNFA_SYS_REG;
78 
79 /* system manager configuration structure */
80 typedef struct
81 {
82     UINT16          mbox_evt;                       /* GKI mailbox event */
83     UINT8           mbox;                           /* GKI mailbox id */
84     UINT8           timer;                          /* GKI timer id */
85     UINT8           trace_level;                    /* initial trace level */
86 } tNFA_SYS_CFG;
87 
88 
89 /*****************************************************************************
90 **  Global data
91 *****************************************************************************/
92 
93 /*****************************************************************************
94 **  Macros
95 *****************************************************************************/
96 
97 /* Calculate start of event enumeration; id is top 8 bits of event */
98 #define NFA_SYS_EVT_START(id)       ((id) << 8)
99 
100 
101 /*****************************************************************************
102 **  Function declarations
103 *****************************************************************************/
104 
105 #ifdef __cplusplus
106 extern "C" {
107 #endif
108 
109 NFC_API extern void nfa_sys_init (void);
110 NFC_API extern void nfa_sys_event (BT_HDR *p_msg);
111 NFC_API extern void nfa_sys_timer_update (void);
112 NFC_API extern void nfa_sys_disable_timers (void);
113 NFC_API extern void nfa_sys_set_trace_level (UINT8 level);
114 
115 extern void nfa_sys_register (UINT8 id, const tNFA_SYS_REG *p_reg);
116 extern void nfa_sys_deregister (UINT8 id);
117 extern void nfa_sys_check_disabled (void);
118 extern BOOLEAN nfa_sys_is_register (UINT8 id);
119 extern void nfa_sys_disable_subsystems (BOOLEAN graceful);
120 extern void nfa_sys_enable_subsystems (void);
121 
122 extern BOOLEAN nfa_sys_is_graceful_disable (void);
123 extern void nfa_sys_sendmsg (void *p_msg);
124 extern void nfa_sys_start_timer (TIMER_LIST_ENT *p_tle, UINT16 type, INT32 timeout);
125 extern void nfa_sys_stop_timer (TIMER_LIST_ENT *p_tle);
126 
127 extern void nfa_sys_cback_reg_enable_complete (tNFA_SYS_ENABLE_CBACK *p_cback);
128 extern void nfa_sys_cback_notify_enable_complete (UINT8 id);
129 
130 extern void nfa_sys_notify_nfcc_power_mode (UINT8 nfcc_power_mode);
131 extern void nfa_sys_cback_reg_nfcc_power_mode_proc_complete (tNFA_SYS_PROC_NFCC_PWR_MODE_CMPL *p_cback);
132 extern void nfa_sys_cback_notify_nfcc_power_mode_proc_complete (UINT8 id);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
138 #endif /* NFA_SYS_H */
139