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