1 /****************************************************************************** 2 * 3 * Copyright (C) 2010-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 * Registration/deregistration functions for inter-module callbacks 22 * 23 ******************************************************************************/ 24 #include "nfa_sys.h" 25 #include "nfa_sys_int.h" 26 27 /******************************************************************************* 28 ** 29 ** Function nfa_sys_cback_reg_enable_complete 30 ** 31 ** Description Called to register an initialization complete callback 32 ** function 33 ** 34 ** Returns void 35 ** 36 *******************************************************************************/ 37 void nfa_sys_cback_reg_enable_complete(tNFA_SYS_ENABLE_CBACK* p_cback) { 38 nfa_sys_cb.p_enable_cback = p_cback; 39 nfa_sys_cb.enable_cplt_flags = 0; 40 } 41 42 /******************************************************************************* 43 ** 44 ** Function nfa_sys_cback_notify_enable_complete 45 ** 46 ** Description Called by other NFA subsystems to notify initialization is 47 ** complete 48 ** 49 ** Returns void 50 ** 51 *******************************************************************************/ 52 void nfa_sys_cback_notify_enable_complete(uint8_t id) { 53 nfa_sys_cb.enable_cplt_flags |= (0x0001 << id); 54 55 NFA_TRACE_DEBUG2( 56 "nfa_sys_cback_notify_enable_complete () enable_cplt_flags=0x%x, " 57 "enable_cplt_mask=0x%x", 58 nfa_sys_cb.enable_cplt_flags, nfa_sys_cb.enable_cplt_mask); 59 60 if ((nfa_sys_cb.enable_cplt_flags == nfa_sys_cb.enable_cplt_mask) && 61 (nfa_sys_cb.p_enable_cback)) { 62 nfa_sys_cb.p_enable_cback(); 63 nfa_sys_cb.p_enable_cback = NULL; 64 } 65 } 66 67 /******************************************************************************* 68 ** 69 ** Function nfa_sys_cback_reg_nfcc_power_mode_proc_complete 70 ** 71 ** Description Called to register a callback function for complete of 72 ** processing NFCC power mode change from NFA sub-systems 73 ** 74 ** Returns void 75 ** 76 *******************************************************************************/ 77 void nfa_sys_cback_reg_nfcc_power_mode_proc_complete( 78 tNFA_SYS_PROC_NFCC_PWR_MODE_CMPL* p_cback) { 79 nfa_sys_cb.p_proc_nfcc_pwr_mode_cmpl_cback = p_cback; 80 nfa_sys_cb.proc_nfcc_pwr_mode_cplt_flags = 0; 81 } 82 83 /******************************************************************************* 84 ** 85 ** Function nfa_sys_cback_notify_nfcc_power_mode_proc_complete 86 ** 87 ** Description Called by other NFA subsystems to notify processing NFCC 88 ** power mode is complete 89 ** 90 ** Returns void 91 ** 92 *******************************************************************************/ 93 void nfa_sys_cback_notify_nfcc_power_mode_proc_complete(uint8_t id) { 94 nfa_sys_cb.proc_nfcc_pwr_mode_cplt_flags |= (0x0001 << id); 95 96 NFA_TRACE_DEBUG2( 97 "nfa_sys_cback_notify_nfcc_power_mode_proc_complete () flags=0x%x, " 98 "mask=0x%x", 99 nfa_sys_cb.proc_nfcc_pwr_mode_cplt_flags, 100 nfa_sys_cb.proc_nfcc_pwr_mode_cplt_mask); 101 102 /* except SYS */ 103 if ((nfa_sys_cb.proc_nfcc_pwr_mode_cplt_flags == 104 nfa_sys_cb.proc_nfcc_pwr_mode_cplt_mask) && 105 (nfa_sys_cb.p_proc_nfcc_pwr_mode_cmpl_cback)) { 106 nfa_sys_cb.p_proc_nfcc_pwr_mode_cmpl_cback(); 107 nfa_sys_cb.p_proc_nfcc_pwr_mode_cmpl_cback = NULL; 108 } 109 } 110