• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 1999-2012 Broadcom Corporation
4  *  Copyright 2018-2019 NXP
5  *
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at:
9  *
10  *  http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *
18  ******************************************************************************/
19 /******************************************************************************
20  *
21  *  Registration/deregistration functions for inter-module callbacks
22  *
23  ******************************************************************************/
24 
25 #include "uci_log.h"
26 #include "uwa_sys.h"
27 #include "uwa_sys_int.h"
28 #include "uwb_osal_common.h"
29 
30 /*******************************************************************************
31 **
32 ** Function         uwa_sys_cback_reg_enable_complete
33 **
34 ** Description      Called to register an initialization complete callback
35 **                  function
36 **
37 ** Returns          void
38 **
39 *******************************************************************************/
uwa_sys_cback_reg_enable_complete(tUWA_SYS_ENABLE_CBACK * p_cback)40 void uwa_sys_cback_reg_enable_complete(tUWA_SYS_ENABLE_CBACK* p_cback) {
41   uwa_sys_cb.p_enable_cback = p_cback;
42   uwa_sys_cb.enable_cplt_flags = 0;
43 }
44 
45 /*******************************************************************************
46 **
47 ** Function         uwa_sys_cback_notify_enable_complete
48 **
49 ** Description      Called by other UWA subsystems to notify initialization is
50 **                  complete
51 **
52 ** Returns          void
53 **
54 *******************************************************************************/
uwa_sys_cback_notify_enable_complete(uint8_t id)55 void uwa_sys_cback_notify_enable_complete(uint8_t id) {
56   uwa_sys_cb.enable_cplt_flags |= (uint16_t)(0x0001 << id);
57 
58   UCI_TRACE_I("enable_cplt_flags=0x%x, enable_cplt_mask=0x%x",
59               uwa_sys_cb.enable_cplt_flags, uwa_sys_cb.enable_cplt_mask);
60 
61   if ((uwa_sys_cb.enable_cplt_flags == uwa_sys_cb.enable_cplt_mask) &&
62       (uwa_sys_cb.p_enable_cback)) {
63     uwa_sys_cb.p_enable_cback();
64     uwa_sys_cb.p_enable_cback = NULL;
65   }
66 }
67