nfa_sys.h revision e9df6ba5a8fcccf306a80b1670b423be8fe7746a
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 */
36enum {
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};
51typedef UINT8 tNFA_SYS_ID;
52
53/* enable function type */
54typedef void (tNFA_SYS_ENABLE) (void);
55
56/* event handler function type */
57typedef BOOLEAN (tNFA_SYS_EVT_HDLR) (BT_HDR *p_msg);
58
59/* disable function type */
60typedef void (tNFA_SYS_DISABLE) (void);
61
62/* function type for processing the change of NFCC power mode */
63typedef void (tNFA_SYS_PROC_NFCC_PWR_MODE) (UINT8 nfcc_power_mode);
64
65typedef void (tNFA_SYS_CBACK) (void);
66typedef void (tNFA_SYS_ENABLE_CBACK) (void);
67typedef void (tNFA_SYS_PROC_NFCC_PWR_MODE_CMPL) (void);
68
69/* registration structure */
70typedef 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 */
79typedef 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
105extern "C" {
106#endif
107
108NFC_API extern void nfa_sys_init (void);
109NFC_API extern void nfa_sys_event (BT_HDR *p_msg);
110NFC_API extern void nfa_sys_timer_update (void);
111NFC_API extern void nfa_sys_disable_timers (void);
112NFC_API extern void nfa_sys_set_trace_level (UINT8 level);
113
114extern void nfa_sys_register (UINT8 id, const tNFA_SYS_REG *p_reg);
115extern void nfa_sys_deregister (UINT8 id);
116extern void nfa_sys_check_disabled (void);
117extern BOOLEAN nfa_sys_is_register (UINT8 id);
118extern void nfa_sys_disable_subsystems (BOOLEAN graceful);
119extern void nfa_sys_enable_subsystems (void);
120
121extern BOOLEAN nfa_sys_is_graceful_disable (void);
122extern void nfa_sys_sendmsg (void *p_msg);
123extern void nfa_sys_start_timer (TIMER_LIST_ENT *p_tle, UINT16 type, INT32 timeout);
124extern void nfa_sys_stop_timer (TIMER_LIST_ENT *p_tle);
125
126extern void nfa_sys_cback_reg_enable_complete (tNFA_SYS_ENABLE_CBACK *p_cback);
127extern void nfa_sys_cback_notify_enable_complete (UINT8 id);
128
129extern void nfa_sys_notify_nfcc_power_mode (UINT8 nfcc_power_mode);
130extern void nfa_sys_cback_reg_nfcc_power_mode_proc_complete (tNFA_SYS_PROC_NFCC_PWR_MODE_CMPL *p_cback);
131extern 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