Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 350e452e authored by Andre Eisenbach's avatar Andre Eisenbach
Browse files

Shutdown alarm callbacks on stack disable; added OSI module

Change-Id: Iecf1e2258da012bdac69a4f57d38b12a272e3edd
parent e52a6060
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ LOCAL_SRC_FILES := \
    src/counter.c \
    src/device_class.c \
    src/module.c \
    src/osi_module.c \
    src/property.c \
    src/uuid.c

+21 −0
Original line number Diff line number Diff line
/******************************************************************************
 *
 *  Copyright (C) 2015 Google, Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at:
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 ******************************************************************************/

#pragma once

static const char OSI_MODULE[] = "osi_module";
+44 −0
Original line number Diff line number Diff line
/******************************************************************************
 *
 *  Copyright (C) 2015 Google, Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at:
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 ******************************************************************************/

#define LOG_TAG "bt_osi_module"

#include "btcore/include/module.h"
#include "btcore/include/osi_module.h"
#include "osi/include/alarm.h"
#include "osi/include/future.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"

future_t *osi_start_up(void) {
  return NULL;
}

future_t *osi_shut_down(void) {
  alarm_shutdown();
  return NULL;
}

const module_t osi_module = {
  .name = OSI_MODULE,
  .init = NULL,
  .start_up = osi_start_up,
  .shut_down = osi_shut_down,
  .clean_up = NULL,
  .dependencies = {NULL}
};
+4 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include "btif_common.h"
#include "device/include/controller.h"
#include "btcore/include/module.h"
#include "btcore/include/osi_module.h"
#include "osi/include/osi.h"
#include "osi/include/log.h"
#include "osi/include/semaphore.h"
@@ -125,6 +126,7 @@ static void event_start_up_stack(UNUSED_ATTR void *context) {
  LOG_DEBUG("%s is bringing up the stack.", __func__);
  hack_future = future_new();

  module_start_up(get_module(OSI_MODULE));
  // Include this for now to put btif config into a shutdown-able state
  module_start_up(get_module(BTIF_CONFIG_MODULE));
  bte_main_enable();
@@ -156,6 +158,8 @@ static void event_shut_down_stack(UNUSED_ATTR void *context) {

  future_await(hack_future);
  module_shut_down(get_module(CONTROLLER_MODULE)); // Doesn't do any work, just puts it in a restartable state
  module_shut_down(get_module(OSI_MODULE));

  LOG_DEBUG("%s finished.", __func__);
  btif_thread_post(event_signal_stack_down, NULL);
}
+1 −1
Original line number Diff line number Diff line
@@ -44,13 +44,13 @@
#include "btsnoop.h"
#include "bt_utils.h"
#include "btcore/include/counter.h"
#include "btcore/include/module.h"
#include "osi/include/fixed_queue.h"
#include "osi/include/future.h"
#include "gki.h"
#include "osi/include/hash_functions.h"
#include "osi/include/hash_map.h"
#include "hci_layer.h"
#include "btcore/include/module.h"
#include "osi/include/osi.h"
#include "osi/include/log.h"
#include "stack_config.h"
Loading