aboutsummaryrefslogtreecommitdiff
path: root/pw_bluetooth
diff options
context:
space:
mode:
authorJason Graffius <jgraff@google.com>2024-02-08 20:59:02 +0000
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-02-08 20:59:02 +0000
commit322850723d19c9104b77e6ec3a0999097af4337a (patch)
tree3bc90d00a4d4689bbfab74ebc89e2fd8f0bf00d1 /pw_bluetooth
parent67a4b97833869aac300bfc2fff3a6e61d9c1eb37 (diff)
downloadpigweed-322850723d19c9104b77e6ec3a0999097af4337a.tar.gz
pw_bluetooth: Add l2cap_frames.emb
Create an emboss file to contain frames defined in L2CAP. Currently only supports K-Frames (used in credit-based flow control), but can be expanded to other frames. Change-Id: I202690e03ea8da41153afd65cbc293c1d5474828 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/185751 Reviewed-by: Ben Lawson <benlawson@google.com> Commit-Queue: Jason Graffius <jgraff@google.com> Reviewed-by: Faraaz Sareshwala <fsareshwala@google.com> Reviewed-by: Josh Conner <joshconner@google.com>
Diffstat (limited to 'pw_bluetooth')
-rw-r--r--pw_bluetooth/BUILD.gn8
-rw-r--r--pw_bluetooth/emboss_test.cc1
-rw-r--r--pw_bluetooth/public/pw_bluetooth/l2cap_frames.emb37
3 files changed, 46 insertions, 0 deletions
diff --git a/pw_bluetooth/BUILD.gn b/pw_bluetooth/BUILD.gn
index 9ef081ce0..cbff17112 100644
--- a/pw_bluetooth/BUILD.gn
+++ b/pw_bluetooth/BUILD.gn
@@ -113,6 +113,11 @@ if (dir_pw_third_party_emboss != "") {
deps = [ ":emboss_hci_common" ]
}
+ emboss_cc_library("emboss_l2cap_frames") {
+ public_configs = [ ":emboss_include_path" ]
+ source = "public/pw_bluetooth/l2cap_frames.emb"
+ }
+
group("emboss_hci_group") {
public_configs = [ ":emboss_include_path" ]
public_deps = [
@@ -135,6 +140,8 @@ if (dir_pw_third_party_emboss != "") {
}
group("emboss_hci_group") {
}
+ group("emboss_l2cap_frames") {
+ }
}
pw_test_group("tests") {
@@ -176,6 +183,7 @@ pw_test("emboss_test") {
":emboss_hci_events",
":emboss_hci_test",
":emboss_hci_vendor",
+ ":emboss_l2cap_frames",
]
}
diff --git a/pw_bluetooth/emboss_test.cc b/pw_bluetooth/emboss_test.cc
index 10de11f9d..563351bf5 100644
--- a/pw_bluetooth/emboss_test.cc
+++ b/pw_bluetooth/emboss_test.cc
@@ -15,6 +15,7 @@
#include "pw_bluetooth/hci_events.emb.h"
#include "pw_bluetooth/hci_test.emb.h"
#include "pw_bluetooth/hci_vendor.emb.h"
+#include "pw_bluetooth/l2cap_frames.emb.h"
#include "pw_unit_test/framework.h"
namespace pw::bluetooth {
diff --git a/pw_bluetooth/public/pw_bluetooth/l2cap_frames.emb b/pw_bluetooth/public/pw_bluetooth/l2cap_frames.emb
new file mode 100644
index 000000000..b227f4788
--- /dev/null
+++ b/pw_bluetooth/public/pw_bluetooth/l2cap_frames.emb
@@ -0,0 +1,37 @@
+# Copyright 2023 The Pigweed Authors
+#
+# 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
+#
+# https://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.
+
+[$default byte_order: "LittleEndian"]
+[(cpp) namespace: "pw::bluetooth::emboss"]
+
+# This file contins Emboss definitions for the logical link control and
+# adaptation protocol (l2cap) frames found in the Bluetooth core specification.
+# The Emboss compiler is used to generate a C++ header from this file.
+
+# ========================= Data Packet Format =================================
+# Core Spec v5.4 Vol 3, Part A, Section 3
+#
+# ========== 3.4 Credit-Based Flow Control Frames ==========
+
+struct KFrameSduHeader:
+ -- 3.4.2
+ -- A frame header for a K-Frame (credit based flow control) SDU.
+ 0 [+2] UInt sdu_length
+
+struct KFramePduHeader:
+ -- 3.4.1
+ -- A frame header for a K-Frame (credit based flow control) PDU.
+ 0 [+2] UInt pdu_length
+ $next [+2] UInt channel_id
+