mirror of https://github.com/ARMmbed/mbed-os.git
add more feature toggles in cordio init
parent
9a22db0e96
commit
26cc72f191
|
@ -380,13 +380,15 @@ void BLE::stack_setup()
|
||||||
|
|
||||||
#if BLE_FEATURE_SECURITY
|
#if BLE_FEATURE_SECURITY
|
||||||
SecInit();
|
SecInit();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Note: enable once security is supported
|
|
||||||
SecRandInit();
|
SecRandInit();
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SECURITY
|
||||||
SecAesInit();
|
SecAesInit();
|
||||||
SecCmacInit();
|
SecCmacInit();
|
||||||
SecEccInit();
|
SecEccInit();
|
||||||
#endif // BLE_FEATURE_SECURITY
|
#endif
|
||||||
|
|
||||||
handlerId = WsfOsSetNextHandler(HciHandler);
|
handlerId = WsfOsSetNextHandler(HciHandler);
|
||||||
HciHandlerInit(handlerId);
|
HciHandlerInit(handlerId);
|
||||||
|
@ -395,74 +397,110 @@ void BLE::stack_setup()
|
||||||
|
|
||||||
#if BLE_ROLE_BROADCASTER
|
#if BLE_ROLE_BROADCASTER
|
||||||
DmAdvInit();
|
DmAdvInit();
|
||||||
#endif // BLE_ROLE_BROADCASTER
|
#endif
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
#if BLE_ROLE_OBSERVER
|
||||||
DmScanInit();
|
DmScanInit();
|
||||||
#endif // BLE_ROLE_OBSERVER
|
#endif
|
||||||
|
|
||||||
#if (BLE_ROLE_CENTRAL || BLE_ROLE_PERIPHERAL)
|
#if BLE_ROLE_CONNECTABLE
|
||||||
DmConnInit();
|
DmConnInit();
|
||||||
#endif // (BLE_ROLE_CENTRAL || BLE_ROLE_PERIPHERAL)
|
#endif
|
||||||
|
|
||||||
#if BLE_ROLE_CENTRAL
|
#if BLE_ROLE_CENTRAL
|
||||||
DmConnMasterInit();
|
DmConnMasterInit();
|
||||||
#endif // BLE_ROLE_CENTRAL
|
#endif
|
||||||
|
|
||||||
#if BLE_ROLE_PERIPHERAL
|
#if BLE_ROLE_PERIPHERAL
|
||||||
DmConnSlaveInit();
|
DmConnSlaveInit();
|
||||||
#endif // BLE_ROLE_PERIPHERAL
|
#endif
|
||||||
|
|
||||||
#if BLE_FEATURE_SECURITY
|
#if BLE_FEATURE_SECURITY
|
||||||
DmSecInit();
|
DmSecInit();
|
||||||
#endif // BLE_FEATURE_SECURITY
|
#endif
|
||||||
|
|
||||||
|
#if BLE_FEATURE_PHY_MANAGEMENT
|
||||||
DmPhyInit();
|
DmPhyInit();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Note: enable once security is supported
|
#if BLE_FEATURE_SECURE_CONNECTIONS
|
||||||
|
|
||||||
#if BLE_FEATURE_SECURITY
|
|
||||||
DmSecLescInit();
|
DmSecLescInit();
|
||||||
#endif // BLE_FEATURE_SECURITY
|
#endif
|
||||||
|
|
||||||
#if BLE_FEATURE_PRIVACY
|
#if BLE_FEATURE_PRIVACY
|
||||||
DmPrivInit();
|
DmPrivInit();
|
||||||
#endif // BLE_FEATURE_PRIVACY
|
#endif
|
||||||
|
|
||||||
DmHandlerInit(handlerId);
|
DmHandlerInit(handlerId);
|
||||||
|
|
||||||
|
#if BLE_ROLE_PERIPHERAL
|
||||||
handlerId = WsfOsSetNextHandler(L2cSlaveHandler);
|
handlerId = WsfOsSetNextHandler(L2cSlaveHandler);
|
||||||
L2cSlaveHandlerInit(handlerId);
|
L2cSlaveHandlerInit(handlerId);
|
||||||
L2cInit();
|
#endif
|
||||||
L2cSlaveInit();
|
|
||||||
L2cMasterInit();
|
|
||||||
|
|
||||||
#if BLE_FEATURE_GATT_SERVER
|
#if BLE_ROLE_CONNECTABLE
|
||||||
|
L2cInit();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BLE_ROLE_PERIPHERAL
|
||||||
|
L2cSlaveInit();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BLE_ROLE_CENTRAL
|
||||||
|
L2cMasterInit();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BLE_FEATURE_ATT
|
||||||
handlerId = WsfOsSetNextHandler(AttHandler);
|
handlerId = WsfOsSetNextHandler(AttHandler);
|
||||||
AttHandlerInit(handlerId);
|
AttHandlerInit(handlerId);
|
||||||
|
|
||||||
|
#if BLE_FEATURE_GATT_SERVER
|
||||||
AttsInit();
|
AttsInit();
|
||||||
AttsIndInit();
|
AttsIndInit();
|
||||||
AttsSignInit();
|
|
||||||
AttsAuthorRegister(GattServer::atts_auth_cb);
|
AttsAuthorRegister(GattServer::atts_auth_cb);
|
||||||
AttcInit();
|
#if BLE_FEATURE_SIGNING
|
||||||
AttcSignInit();
|
AttsSignInit();
|
||||||
|
#endif
|
||||||
#endif // BLE_FEATURE_GATT_SERVER
|
#endif // BLE_FEATURE_GATT_SERVER
|
||||||
|
|
||||||
|
#if BLE_FEATURE_GATT_CLIENT
|
||||||
|
AttcInit();
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
|
AttcSignInit();
|
||||||
|
#endif
|
||||||
|
#endif // BLE_FEATURE_GATT_CLIENT
|
||||||
|
|
||||||
|
#endif // BLE_FEATURE_ATT
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SECURITY
|
||||||
handlerId = WsfOsSetNextHandler(SmpHandler);
|
handlerId = WsfOsSetNextHandler(SmpHandler);
|
||||||
SmpHandlerInit(handlerId);
|
SmpHandlerInit(handlerId);
|
||||||
|
|
||||||
|
#if BLE_ROLE_PERIPHERAL
|
||||||
SmprInit();
|
SmprInit();
|
||||||
SmprScInit();
|
SmprScInit();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BLE_ROLE_CENTRAL
|
||||||
SmpiInit();
|
SmpiInit();
|
||||||
SmpiScInit();
|
SmpiScInit();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // BLE_FEATURE_SECURITY
|
||||||
|
|
||||||
stack_handler_id = WsfOsSetNextHandler(&BLE::stack_handler);
|
stack_handler_id = WsfOsSetNextHandler(&BLE::stack_handler);
|
||||||
|
|
||||||
HciSetMaxRxAclLen(100);
|
HciSetMaxRxAclLen(100);
|
||||||
|
|
||||||
DmRegister(BLE::device_manager_cb);
|
DmRegister(BLE::device_manager_cb);
|
||||||
|
#if BLE_ROLE_CONNECTABLE
|
||||||
DmConnRegister(DM_CLIENT_ID_APP, BLE::device_manager_cb);
|
DmConnRegister(DM_CLIENT_ID_APP, BLE::device_manager_cb);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BLE_FEATURE_ATT
|
||||||
AttConnRegister(BLE::connection_handler);
|
AttConnRegister(BLE::connection_handler);
|
||||||
AttRegister((attCback_t) ble::pal::vendor::cordio::CordioAttClient::att_client_handler);
|
AttRegister((attCback_t) ble::pal::vendor::cordio::CordioAttClient::att_client_handler);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLE::start_stack_reset()
|
void BLE::start_stack_reset()
|
||||||
|
|
Loading…
Reference in New Issue