android-A20蓝牙驱动调用流程

2019-04-14 21:10发布

倒退bt的上电流程:

     wifi_pm_gpio_ctrl
               |                                                                          kerne层
     rfkill_set_power          (lichee/linux-3.3/arch/arm/mach-sun7i/rf)  
               |
-----------------------------------------------------------------------------------------------------------------------------------------------------
  upio_set_bluetooth_power    (android/device/common/libbt/src)
               |
op(bt_vendor_opcode_t opcode, void *param)   利用BLUETOOTH_VENDOR_LIB_INTERFACE向上注册 (android/device/common/libbt/src)
               |
     init_vnd_if(bt_hw.c)      (android/external/bluetooth/bluedroid/hci/src/bt_hw.c) 初始化bt_vnd_if 去调用op方法
               |
     set_power       通过init_vnd_if中初始化的bt_vnd_if去调用op方法,利用bluetoothHCLibInterface向上注册。(/android/external/bluetooth/bluedroid/hci/src/bt_hci_bdroid.c)
               |
       bt_hc_get_interface           返回一个bluetoothHCLibInterface
               |
    bte_main_in_hw_init  初始化bt_hc_if,可调用到上面的set_power。(android/external/bluetooth/bluedroid/main/bte_main.c)      HAL层
               |
     bte_main_enable  通过bt_hc_if调用set_power (android/external/bluetooth/bluedroid/main/bte_main.c)
               |
    btif_enable_bluetooth (android/external/bluetooth/bluedroid/btif/src/btif_core.c)
               |
            enable  通过bluetoothInterface向上注册(android/external/bluetooth/bluedroid/btif/src/bluetooth.c)
              |
   bluetooth__get_bluetooth_interface     返回一个bluetoothInterface(android/external/bluetooth/bluedroid/btif/src/bluetooth.c)
              |
     open_bluetooth_stack  HAL层的注册接口,上层通过一个module去打开一个模块然后调用模块的方法。id:BT_HARDWARE_MODULE_ID 这个和JNI使用的应该一致
----------------------------------------------------------------------------------------------------------------------------------------------------------
              |
  android/packages/apps/Bluetooth/jni                              JNI层代码               | android/packages/apps/Bluetooth/                                    android应用软件