Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][DNM] Initial commit adding BASS in bttester #1764

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 156 additions & 0 deletions .gdb_out
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
GNU gdb (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.1.90.20221210-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.linaro.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
SEGGER J-Link GDB Server V7.96 Command Line Version

JLinkARM.dll V7.96 (DLL compiled Mar 7 2024 16:49:04)

Command line: -device nrf52840_xxaa -speed 1000 -if SWD -port 3333 -singlerun
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 3333
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection: localhost only
Generate logfile: off
Verify download: off
Init regs on start: off
Silent mode: off
Single run mode: on
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: nrf52840_xxaa
Target device parameters: none
Target interface: SWD
Target interface speed: 1000kHz
Target endian: little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Oct 30 2023 12:12:17
Hardware: V1.00
S/N: 683403725
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 3333
Connecting to target...
Halting core...
Connected to target
Waiting for GDB connection...Connected to 0000:0000:0000:0000:0000:0000:0000:0001
GDB client (conn. 888) requested target.xml from GDB Server
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
Reading common registers: Read register 'r0' (4 bytes) from hardware: 0xFF7F0000
Read register 'r1' (4 bytes) from hardware: 0x01010600
Read register 'r2' (4 bytes) from hardware: 0x00010600
Read register 'r3' (4 bytes) from hardware: 0x00100140
Read register 'r4' (4 bytes) from hardware: 0x80000000
Read register 'r5' (4 bytes) from hardware: 0x80000000
Read register 'r6' (4 bytes) from hardware: 0x00000000
Read register 'r7' (4 bytes) from hardware: 0x01060000
Read register 'r8' (4 bytes) from hardware: 0x00000000
Read register 'r9' (4 bytes) from hardware: 0x40000000
Read register 'r10' (4 bytes) from hardware: 0x00000000
Read register 'r11' (4 bytes) from hardware: 0x00000000
Read register 'r12' (4 bytes) from hardware: 0x00000000
Read register 'sp' (4 bytes) from hardware: 0x00DA0020
Read register 'lr' (4 bytes) from hardware: 0x19FE0400
Read register 'pc' (4 bytes) from hardware: 0xA0FE0400
Read register 'xpsr' (4 bytes) from hardware: 0x00000021
Read 4 bytes @ address 0x0004FEA0 (Data = 0xBD38B954)
Read 2 bytes @ address 0x0004FEA0 (Data = 0xB954)
0x0004fea0 in ?? ()
Received monitor command: reset
Resetting target
Resetting target
Downloading 16000 bytes @ address 0x0000C000
Downloading 15968 bytes @ address 0x0000FE80
Downloading 16000 bytes @ address 0x00013CE0
Downloading 16096 bytes @ address 0x00017B60
Downloading 16048 bytes @ address 0x0001BA40
Downloading 15824 bytes @ address 0x0001F8F0
Downloading 16160 bytes @ address 0x000236C0
Downloading 16064 bytes @ address 0x000275E0
Downloading 16096 bytes @ address 0x0002B4A0
Downloading 16048 bytes @ address 0x0002F380
Downloading 16096 bytes @ address 0x00033230
Downloading 16048 bytes @ address 0x00037110
Downloading 16016 bytes @ address 0x0003AFC0
Downloading 16016 bytes @ address 0x0003EE50
Downloading 16064 bytes @ address 0x00042CE0
Downloading 15936 bytes @ address 0x00046BA0
Downloading 15952 bytes @ address 0x0004A9E0
Downloading 16128 bytes @ address 0x0004E830
Downloading 11416 bytes @ address 0x00052730
Restoring binary file ..\..\bin\targets\bttester\app\@apache-mynewt-nimble\apps\bttester\bttester.img into memory (0xc000 to 0x553c8)
Reading register 'msp' = 0x20040000
Reading register 'psp' = 0x00000000
Reading register 'primask' = 0x00000000
Reading register 'basepri' = 0x00000000
Reading register 'faultmask' = 0x00000000
Reading register 'control' = 0x00000000
Reading register 'apsr' = 0x00000000
Reading register 'epsr' = 0x01000000
Reading register 'ipsr' = 0x00000000
Reading register 'iapsr' = 0x00000000
Reading register 'eapsr' = 0x01000000
Reading register 'iepsr' = 0x01000000
Reading register 'fpscr' = 0x00000000
r0 0x7fff 32767
r1 0x60101 393473
r2 0x60100 393472
r3 0x40011000 1073811456
r4 0x80 128
r5 0x80 128
r6 0x0 0
r7 0x601 1537
r8 0x0 0
r9 0x40 64
r10 0x0 0
r11 0x0 0
r12 0x0 0
sp 0x2000da00 0x2000da00
lr 0x4fe19 327193
pc 0x4fea0 0x4fea0
xpsr 0x21000000 553648128
msp 0x20040000 0x20040000
psp 0x0 0x0
primask 0x0 0
basepri 0x0 0
faultmask 0x0 0
control 0x0 0
apsr 0x0 0
epsr 0x1000000 16777216
ipsr 0x0 0
iapsr 0x0 0
eapsr 0x1000000 16777216
iepsr 0x1000000 16777216
fpscr 0x0 0
Received monitor command: reset
Resetting target
Resetting target
GDB closed TCP/IP connection (Socket 888)
A debugging session is active.

Inferior 1 [Remote target] will be killed.

Quit anyway? (y or n) [answered Y; input not from terminal]
Restoring target state and closing J-Link connection...
Shutting down...
Expand Down
1 change: 1 addition & 0 deletions apps/bttester/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pkg.deps:
- "@apache-mynewt-nimble/nimble/host/services/gap"
- "@apache-mynewt-nimble/nimble/host/services/gatt"
- "@apache-mynewt-nimble/nimble/host/services/dis"
- "@apache-mynewt-nimble/nimble/host/audio/services/bass"
- "@apache-mynewt-nimble/nimble/host/store/config"
- "@apache-mynewt-core/hw/drivers/uart"
- "@apache-mynewt-core/hw/drivers/rtt"
Expand Down
1 change: 1 addition & 0 deletions apps/bttester/src/btp/btp.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#define BTP_SERVICE_ID_MESH 4
#define BTP_SERVICE_ID_GATTC 6
#define BTP_SERVICE_ID_BAP 14
#define BTP_SERVICE_ID_BASS 14

#define BTP_SERVICE_ID_MAX BTP_SERVICE_ID_BAP

Expand Down
37 changes: 37 additions & 0 deletions apps/bttester/src/btp/btp_bass.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

#ifndef H_BTP_BASS_
#define H_BTP_BASS_

#include "nimble/ble.h"
#include <stdint.h>

#ifndef __packed
#define __packed __attribute__((__packed__))
#endif

/* BAS Service */
/* commands */
#define BTP_BASS_READ_SUPPORTED_COMMANDS 0x01
struct btp_bass_read_supported_commands_rp {
uint8_t data[0];
} __packed;

#endif /* H_BTP_BASS_ */
10 changes: 10 additions & 0 deletions apps/bttester/src/btp/btp_gap.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct btp_gap_read_controller_index_list_rp {
#define BTP_GAP_SETTINGS_PRIVACY 13
#define BTP_GAP_SETTINGS_CONTROLLER_CONFIG 14
#define BTP_GAP_SETTINGS_STATIC_ADDRESS 15
#define BTP_GAP_SETTINGS_EXTENDED_ADVERTISING 17
#define BTP_GAP_SETTINGS_PERIODIC_ADVERTISING 18

#define BTP_GAP_READ_CONTROLLER_INFO 0x03
Expand Down Expand Up @@ -258,6 +259,15 @@ struct btp_gap_set_filter_accept_list_cmd {
ble_addr_t addrs[];
} __packed;

#define GAP_SET_EXT_ADV 0x21
struct btp_gap_set_ext_advertising_cmd {
uint8_t flags;
} __packed;

struct btp_gap_set_ext_advertising_rp {
uint32_t current_settings;
} __packed;

#define GAP_PADV_CONFIGURE 0x22
struct gap_periodic_adv_configure_cmd {
uint8_t flags;
Expand Down
7 changes: 5 additions & 2 deletions apps/bttester/src/btp/bttester.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ tester_init_bap(void);
uint8_t
tester_unregister_bap(void);
#endif /* MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE) */

#endif /* __BTTESTER_H__ */
uint8_t
tester_init_bass(void);
uint8_t
tester_unregister_bass(void);
#endif /* MYNEWT_VAL(BLE_ISO_BROADCASTER) */

77 changes: 77 additions & 0 deletions apps/bttester/src/btp_bass.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

/* btp_bass.c - Bluetooth Broadcast Audio Stream Service Tester */

#include "syscfg/syscfg.h"
#include <stdint.h>

#if MYNEWT_VAL(BLE_AUDIO)

#include "btp/btp_bass.h"


#include "btp/btp.h"
#include "console/console.h"

#include "nimble/ble.h"
#include "host/ble_hs.h"
#include "host/util/util.h"
#include "math.h"

#include "audio/ble_audio_broadcast_source.h"
#include "services/bass/ble_audio_svc_bass.h"
#include "audio/ble_audio.h"
#include "host/ble_iso.h"

#include "bsp/bsp.h"

static uint8_t
supported_commands(const void *cmd, uint16_t cmd_len,
void *rsp, uint16_t *rsp_len)
{
return BTP_STATUS_SUCCESS;
}

static const struct btp_handler handlers[] = {
{
.opcode = BTP_BASS_READ_SUPPORTED_COMMANDS,
.index = BTP_INDEX_NONE,
.expect_len = 0,
.func = supported_commands,
},
};

uint8_t
tester_init_bass(void)
{
tester_register_command_handlers(BTP_SERVICE_ID_BASS, handlers,
ARRAY_SIZE(handlers));

return BTP_STATUS_SUCCESS;
}

uint8_t
tester_unregister_bass(void)
{
return BTP_STATUS_SUCCESS;
}

#endif /* MYNEWT_VAL(BLE_AUDIO) */

2 changes: 1 addition & 1 deletion apps/bttester/src/btp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ register_service(const void *cmd, uint16_t cmd_len,
case BTP_SERVICE_ID_BAP:
status = tester_init_bap();
break;
#endif /* MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE) */
#endif /* MYNEWT_VAL(BLE_ISO_BROADCASTER) */
case BTP_SERVICE_ID_GATTC:
status = tester_init_gatt_cl();
break;
Expand Down
Loading