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 * 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 "gki.h" 28 #include "nfa_api.h" 29 #include "nfc_target.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_SNEP, /* SNEP sub-system */ 42 NFA_ID_RW, /* Reader/writer sub-system */ 43 NFA_ID_CE, /* Card-emulation sub-system */ 44 NFA_ID_HCI, /* Host controller interface sub-system*/ 45 #if (NFA_DTA_INCLUDED == TRUE) 46 NFA_ID_DTA, /* Device Test Application sub-system */ 47 #endif 48 NFA_ID_MAX 49 }; 50 typedef uint8_t tNFA_SYS_ID; 51 52 /* enable function type */ 53 typedef void(tNFA_SYS_ENABLE)(void); 54 55 /* event handler function type */ 56 typedef bool(tNFA_SYS_EVT_HDLR)(NFC_HDR* p_msg); 57 58 /* disable function type */ 59 typedef void(tNFA_SYS_DISABLE)(void); 60 61 /* function type for processing the change of NFCC power mode */ 62 typedef void(tNFA_SYS_PROC_NFCC_PWR_MODE)(uint8_t nfcc_power_mode); 63 64 typedef void(tNFA_SYS_CBACK)(void); 65 typedef void(tNFA_SYS_ENABLE_CBACK)(void); 66 typedef void(tNFA_SYS_PROC_NFCC_PWR_MODE_CMPL)(void); 67 68 /* registration structure */ 69 typedef struct { 70 tNFA_SYS_ENABLE* enable; 71 tNFA_SYS_EVT_HDLR* evt_hdlr; 72 tNFA_SYS_DISABLE* disable; 73 tNFA_SYS_PROC_NFCC_PWR_MODE* proc_nfcc_pwr_mode; 74 } tNFA_SYS_REG; 75 76 /* system manager configuration structure */ 77 typedef struct { 78 uint16_t mbox_evt; /* GKI mailbox event */ 79 uint8_t mbox; /* GKI mailbox id */ 80 uint8_t timer; /* GKI timer id */ 81 uint8_t trace_level; /* initial trace level */ 82 } tNFA_SYS_CFG; 83 84 /***************************************************************************** 85 ** Global data 86 *****************************************************************************/ 87 88 /***************************************************************************** 89 ** Macros 90 *****************************************************************************/ 91 92 /* Calculate start of event enumeration; id is top 8 bits of event */ 93 #define NFA_SYS_EVT_START(id) ((id) << 8) 94 95 /***************************************************************************** 96 ** Function declarations 97 *****************************************************************************/ 98 99 #ifdef __cplusplus 100 extern "C" { 101 #endif 102 103 extern void nfa_sys_init(void); 104 extern void nfa_sys_event(NFC_HDR* p_msg); 105 extern void nfa_sys_timer_update(void); 106 extern void nfa_sys_disable_timers(void); 107 extern void nfa_sys_set_trace_level(uint8_t level); 108 109 extern void nfa_sys_register(uint8_t id, const tNFA_SYS_REG* p_reg); 110 extern void nfa_sys_deregister(uint8_t id); 111 extern void nfa_sys_check_disabled(void); 112 extern bool nfa_sys_is_register(uint8_t id); 113 extern void nfa_sys_disable_subsystems(bool graceful); 114 extern void nfa_sys_enable_subsystems(void); 115 116 extern bool nfa_sys_is_graceful_disable(void); 117 extern void nfa_sys_sendmsg(void* p_msg); 118 extern void nfa_sys_start_timer(TIMER_LIST_ENT* p_tle, uint16_t type, 119 int32_t timeout); 120 extern void nfa_sys_stop_timer(TIMER_LIST_ENT* p_tle); 121 122 extern void nfa_sys_cback_reg_enable_complete(tNFA_SYS_ENABLE_CBACK* p_cback); 123 extern void nfa_sys_cback_notify_enable_complete(uint8_t id); 124 125 extern void nfa_sys_notify_nfcc_power_mode(uint8_t nfcc_power_mode); 126 extern void nfa_sys_cback_reg_nfcc_power_mode_proc_complete( 127 tNFA_SYS_PROC_NFCC_PWR_MODE_CMPL* p_cback); 128 extern void nfa_sys_cback_notify_nfcc_power_mode_proc_complete(uint8_t id); 129 130 #ifdef __cplusplus 131 } 132 #endif 133 134 #endif /* NFA_SYS_H */ 135