Bluetooth Driver services: Difference between revisions
Line 291: | Line 291: | ||
This is used by [[BTM_services|btm]]. | This is used by [[BTM_services|btm]]. | ||
This first calls an interface funcptr, on failure 0xCA71 is returned. | [1.0.0-11.0.1] This first calls an interface funcptr, on failure 0xCA71 is returned. | ||
A global fixed [[#Address]] is copied to stack, this stack data is then overwritten with the output from [[Settings_services|GetBluetoothBdAddress]]. If GetBluetoothBdAddress fails, this will Abort. Then the same funcptr used by [[#SetAdapterProperty]] is called with this stack data, with [[#BluetoothPropertyType|type2]]. A converted error is returned if needed. | [1.0.0-11.0.1] A global fixed [[#Address]] is copied to stack, this stack data is then overwritten with the output from [[Settings_services|GetBluetoothBdAddress]]. If GetBluetoothBdAddress fails, this will Abort. Then the same funcptr used by [[#SetAdapterProperty]] is called with this stack data, with [[#BluetoothPropertyType|type2]]. A converted error is returned if needed. | ||
The last two bytes of the stack [[#Address]] are inverted (byteval = ~byteval), then the above funcptr is called with this for [[#BluetoothPropertyType|type3]]. Error conversion is handled if needed, then this returns 0. | [1.0.0-11.0.1] The last two bytes of the stack [[#Address]] are inverted (byteval = ~byteval), then the above funcptr is called with this for [[#BluetoothPropertyType|type3]]. Error conversion is handled if needed, then this returns 0. | ||
The first funcptr called above does the following: | The first funcptr called above does the following ([12.0.0+] this code is now inlined): | ||
* Calls a GPIO func with param=0, [[SVC|sleeps]] for 10000000 nanoseconds, then calls the GPIO func again with param=1. | * Calls a GPIO func with param=0, [[SVC|sleeps]] for 10000000 nanoseconds, then calls the GPIO func again with param=1. | ||
* [12.0.0+] Calls a func to update an interface object ptr to use the enabled-object. A vfunc for various interface objects are called, with Result 0xCA71 being returned if the ret is non-zero (failure after the first interface object will trigger an Abort). | |||
* [12.0.0+] [[Settings_services|GetBluetoothBdAddress]] is used, on failure this will Abort. Then the same vfunc used by [[#SetAdapterProperty]] is called with the output from GetBluetoothBdAddress, with [[#AdapterPropertyType|type0]]. This will Abort on failure. | |||
* [12.0.0+] The last two bytes of the stack [[#Address]] are inverted (byteval = ~byteval), then the above vfunc is called with this for [[#AdapterPropertyType|type3]]. This will Abort on failure, otherwise 0 is returned. | |||
* Calls a func for initializing the paired-devices table (empty). | * Calls a func for initializing the paired-devices table (empty). | ||
* Calls a modified version of BSA_Boot, which handles BSA server initialization. | * Calls a modified version of BSA_Boot, which handles BSA server initialization. |