pw_hal: Rename rp2xxx UartDriver to RawUartDriver Change-Id: I7e14cdc73113088d22bc2ab4a0d4a79b9ce9a299 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/sandbox/+/473027
diff --git a/pw_hal/uart/public/pw_hal/uart/uart_driver.h b/pw_hal/uart/public/pw_hal/uart/uart_driver.h index 88adfa3..1aa8c43 100644 --- a/pw_hal/uart/public/pw_hal/uart/uart_driver.h +++ b/pw_hal/uart/public/pw_hal/uart/uart_driver.h
@@ -60,47 +60,47 @@ /// @returns The number of bytes available in the internal buffer (or FIFO). virtual size_t TxBytesAvailable() const = 0; - /// Set the buffer level at which the notify callback is called. + /// Set the level at which the _space available_ callback is called. /// /// When this level is reached, it is guaranteed that the next call to /// Send() will be able to accept _at least_ `bytes` number of bytes (or /// the maximum buffer capacity, whichever is lower). /// - /// @warning The notification level does not guarantee that multiple calls to - /// Send() will be able to accept that many bytes. For example, if - /// the level is set to 16 bytes, it is not guaranteed that two - /// Send() calls of 8 bytes will succeed. Only that the first call - /// will succeed. The second call may or may not depending on the - /// specific driver implementation. + /// @isrsafe{no} + /// + /// @note The notification level does not guarantee that multiple calls to + /// Send() will be able to accept that many bytes. For example, if + /// the level is set to 16 bytes, it is not guaranteed that two + /// Send() calls of 8 bytes will succeed. Only that the first call + /// will succeed. The second call may or may not depending on the + /// specific driver implementation. /// /// @note The notification will be called when _at least_ that many bytes are /// available to be sent. The buffer may have additional space /// available beyond that. /// - /// @isrsafe{no} - /// /// @param bytes The new level at which to notify the user of space available /// in the buffer. /// @returns /// * @OK: Level was set successfully. /// * @INVALID_ARGUMENT: The specified level was not valid. - virtual Status SetTxBufferNotifyLevel(size_t bytes) = 0; + virtual Status SetTxReadyNotifyLevel(size_t bytes) = 0; /// Set the notification callback used to notify the user of available space /// in the TX buffer. /// - /// @warning The provided callback function may run in ISR context! - /// /// @isrsafe{no} /// - /// @param on_available The callback function to call when the TX buffer + /// @warning The provided callback function may run in ISR context! + /// + /// @param on_ready The callback function to call when the TX buffer /// notification level is reached. The size_t parameter in the /// callback is the number of bytes currently available to send. /// @returns /// * @OK: Successfully set notification callback. /// * @UNAVAILABLE: Driver cannot change the notifier at this time. - virtual Status SetTxBufferNotifier( - pw::Function<void(size_t)> on_available) = 0; + virtual Status SetTxReadyNotifier( + pw::Function<void(size_t)> on_ready) = 0; /// Send the given array of bytes. /// @@ -109,10 +109,10 @@ /// actually been sent across the wire when the function returns. The buffer /// may be stored internally for later transmission. /// - /// @note This function is guaranteed not to block. - /// /// @isrsafe{no} /// + /// @note This function is guaranteed not to block. + /// /// @param tx_buffer The buffer of bytes to send. /// @return A Status along with the number of bytes accepted. /// * @OK: All bytes were accepted. Included size is equal to the size of the @@ -148,6 +148,8 @@ /// /// @isrsafe{yes} /// + /// @note There are _at least_ this many bytes available, there may be more. + /// /// @returns The number of bytes available in the internal buffer (or FIFO). virtual size_t RxBytesAvailable() const = 0; @@ -156,17 +158,17 @@ /// When this level is reached, it is guaranteed that the next call to /// Receive() will be able to provide _at least_ `bytes` number of bytes. /// + /// @isrsafe{no} + /// /// @note The notification will be called when _at least_ that many bytes are /// available. The buffer may have additional bytes beyond that. /// - /// @isrsafe{no} - /// /// @param bytes The new level at which to notify the user of bytes available /// in the buffer. /// @returns /// * @OK: Level was set successfully. /// * @INVALID_ARGUMENT: The specified level was not valid. - virtual Status SetRxBufferNotifyLevel(size_t bytes) = 0; + virtual Status SetRxReadyNotifyLevel(size_t bytes) = 0; /// Set the notification callback used to notify the user of available bytes /// in the RX buffer. @@ -175,13 +177,14 @@ /// /// @isrsafe{no} /// - /// @param on_available The callback function to call when the RX buffer + /// @param on_ready The callback function to call when the RX buffer /// notification level is reached. The size_t parameter in the /// callback is the number of bytes currently available to receive. /// @returns /// * @OK: Successfully set notification callback. /// * @UNAVAILABLE: Driver cannot change the notifier at this time. - virtual Status SetRxBufferNotifier(pw::Function<void(size_t)> on_ready) = 0; + virtual Status SetRxReadyNotifier( + pw::Function<void(size_t)> on_ready) = 0; /// Receive up to the given array size of bytes. /// @@ -194,7 +197,7 @@ /// /// @isrsafe{no} /// - /// @param tx_buffer The buffer of bytes to send. + /// @param rx_buffer The buffer to write bytes into. /// @return A Status along with the number of bytes accepted. /// * @OK: Buffer was filled. Included size is equal to the size of the /// provided span. @@ -204,12 +207,19 @@ virtual StatusWithSize Receive(std::span<std::byte> rx_buffer) = 0; }; +class BufferedUartDriver : public UartDriver, + public BufferedTxDevice, + public BufferedRxDevice { + public: + virtual ~BufferedUartDriver() = default; +}; + class ZeroCopyTxDevice { public: virtual ~ZeroCopyTxDevice() = default; - virtual Status SetTxAvailableNotifier( - pw::Function<void()> on_tx_available) = 0; + virtual Status SetTxReadyNotifier( + pw::Function<void()> on_tx_ready) = 0; virtual StatusWithSize Send(pw::ConstBuf tx_buffer) = 0; }; @@ -217,18 +227,11 @@ public: virtual ~ZeroCopyRxDevice() = default; - virtual Status SetRxAvailableNotifier( - pw::Function<void()> on_rx_available) = 0; + virtual Status SetRxReadyNotifier( + pw::Function<void()> on_rx_ready) = 0; virtual StatusWithSize Receive(pw::Buf tx_buffer) = 0; }; -class BufferedUartDriver : public UartDriver, - public BufferedTxDevice, - public BufferedRxDevice { - public: - virtual ~BufferedUartDriver() = default; -}; - /// @endsubmodule } // namespace pw::hal::uart
diff --git a/pw_hal/uart/uart_golden_hiltest.cc b/pw_hal/uart/uart_golden_hiltest.cc index 099a52e..d06ccd0 100644 --- a/pw_hal/uart/uart_golden_hiltest.cc +++ b/pw_hal/uart/uart_golden_hiltest.cc
@@ -172,31 +172,31 @@ kByteArrayLength_96, kByteArrayLength_128}; const pw::Vector<pw::ConstByteSpan, 18> kTransactions_AllDecreasing{ - kByteArrayLength_1, - kByteArrayLength_2, - kByteArrayLength_3, - kByteArrayLength_4, - kByteArrayLength_5, - kByteArrayLength_6, - kByteArrayLength_7, - kByteArrayLength_8, - kByteArrayLength_12, - kByteArrayLength_16, - kByteArrayLength_20, - kByteArrayLength_24, - kByteArrayLength_28, - kByteArrayLength_32, - kByteArrayLength_48, - kByteArrayLength_64, + kByteArrayLength_128, kByteArrayLength_96, - kByteArrayLength_128}; + kByteArrayLength_64, + kByteArrayLength_48, + kByteArrayLength_32, + kByteArrayLength_28, + kByteArrayLength_24, + kByteArrayLength_20, + kByteArrayLength_16, + kByteArrayLength_12, + kByteArrayLength_8, + kByteArrayLength_7, + kByteArrayLength_6, + kByteArrayLength_5, + kByteArrayLength_4, + kByteArrayLength_3, + kByteArrayLength_2, + kByteArrayLength_1}; void SendByteTransactions(BufferedUartDriver& driver, size_t notify_level, const pw::Vector<pw::ConstByteSpan>& transactions) { pw::sync::BinarySemaphore tx_available; - PW_TEST_ASSERT_OK(driver.SetTxBufferNotifyLevel(notify_level)); - PW_TEST_ASSERT_OK(driver.SetTxBufferNotifier( + PW_TEST_ASSERT_OK(driver.SetTxReadyNotifyLevel(notify_level)); + PW_TEST_ASSERT_OK(driver.SetTxReadyNotifier( [&tx_available](size_t) { tx_available.release(); })); for (const pw::ConstByteSpan& transaction : transactions) { @@ -217,7 +217,7 @@ } } - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifier(nullptr)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifier(nullptr)); } } // namespace pw::hal::uart
diff --git a/pw_hal_rp2xxx/uart/BUILD.bazel b/pw_hal_rp2xxx/uart/BUILD.bazel index 25f3032..7c3386e 100644 --- a/pw_hal_rp2xxx/uart/BUILD.bazel +++ b/pw_hal_rp2xxx/uart/BUILD.bazel
@@ -23,9 +23,12 @@ licenses(["notice"]) cc_library( - name = "uart_driver", - srcs = ["uart_driver.cc"], - hdrs = ["public/pw_hal_rp2xxx/uart/uart_driver.h"], + name = "raw_uart_driver", + srcs = ["raw_uart_driver.cc"], + hdrs = [ + "public/pw_hal_rp2xxx/uart/raw_uart_driver.h", + "public/pw_hal_rp2xxx/uart/uart_config.h", + ], strip_include_prefix = "public", visibility = ["//visibility:public"], deps = [ @@ -41,10 +44,10 @@ ) pw_cc_test( - name = "uart_driver_hiltest_cc", - srcs = ["uart_driver_hiltest.cc"], + name = "raw_uart_driver_hiltest_cc", + srcs = ["raw_uart_driver_hiltest.cc"], deps = [ - ":uart_driver", + ":raw_uart_driver", "//pw_bytes", "//pw_hal/uart:sync_uart", "//pw_hal/uart:uart_golden_hiltest", @@ -58,13 +61,26 @@ ) pw_hil_test( - name = "uart_driver_hiltest", - dut_target = ":uart_driver_hiltest_cc", - hil_test = ":uart_driver_hiltest.py", + name = "raw_uart_driver_hiltest", + dut_target = ":raw_uart_driver_hiltest_cc", + hil_test = ":raw_uart_driver_hiltest.py", +) + +pw_cc_test( + name = "raw_uart_driver_golden_hiltest_cc", + srcs = ["raw_uart_driver_golden_hiltest.cc"], + deps = [ + ":raw_uart_driver", + "//pw_bytes", + "//pw_hal/uart:sync_uart", + "//pw_hal/uart:uart_golden_hiltest", + "//pw_thread:sleep", + "//pw_unit_test", + ], ) pw_hil_test( - name = "uart_golden_hiltest", - dut_target = ":uart_driver_hiltest_cc", - hil_test = ":uart_golden_hiltest.py", + name = "raw_uart_driver_golden_hiltest", + dut_target = ":raw_uart_driver_golden_hiltest_cc", + hil_test = ":raw_uart_driver_golden_hiltest.py", )
diff --git a/pw_hal_rp2xxx/uart/docs.rst b/pw_hal_rp2xxx/uart/docs.rst new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/pw_hal_rp2xxx/uart/docs.rst
diff --git a/pw_hal_rp2xxx/uart/public/pw_hal_rp2xxx/uart/uart_driver.h b/pw_hal_rp2xxx/uart/public/pw_hal_rp2xxx/uart/raw_uart_driver.h similarity index 64% rename from pw_hal_rp2xxx/uart/public/pw_hal_rp2xxx/uart/uart_driver.h rename to pw_hal_rp2xxx/uart/public/pw_hal_rp2xxx/uart/raw_uart_driver.h index ccd87c5..94692dd 100644 --- a/pw_hal_rp2xxx/uart/public/pw_hal_rp2xxx/uart/uart_driver.h +++ b/pw_hal_rp2xxx/uart/public/pw_hal_rp2xxx/uart/raw_uart_driver.h
@@ -19,44 +19,18 @@ #include "pico/types.h" #include "pw_function/function.h" #include "pw_hal/uart/uart_driver.h" +#include "pw_hal_rp2xxx/uart/uart_config.h" #include "pw_status/status_with_size.h" namespace pw::hal::uart { -class Rp2xxxBufferedUartDriver : public BufferedUartDriver { +class Rp2xxxRawUartDriver : public BufferedUartDriver { public: - struct Config { - enum class Parity : uint8_t { - kNone = UART_PARITY_NONE, - kOdd = UART_PARITY_ODD, - kEven = UART_PARITY_EVEN, - }; - - enum class DataBits : uint8_t { - k5 = 5, - k6 = 6, - k7 = 7, - k8 = 8, - }; - - enum class StopBits : uint8_t { - k1 = 1, - k2 = 2, - }; - - uint32_t baud_rate; - DataBits data_bits = DataBits::k8; - StopBits stop_bits = StopBits::k1; - Parity parity = Parity::kNone; - uint8_t txd_pin; - uint8_t rxd_pin; - }; - // Once the driver is constructed it will always be tied to the same hardware // instance. Configuration may be changed at run-time, though (via Init). - explicit Rp2xxxBufferedUartDriver(uart_inst_t* instance); + explicit Rp2xxxRawUartDriver(uart_inst_t* instance); - Status Init(const Config& config); + Status Init(const UartConfig& config); Status DeInit(); void Enable() override; @@ -65,15 +39,16 @@ // TxDevice interface size_t TxBufferCapacity() const override; size_t TxBytesAvailable() const override; - Status SetTxBufferNotifyLevel(size_t bytes) override; - Status SetTxBufferNotifier(pw::Function<void(size_t)> on_available) override; + Status SetTxReadyNotifyLevel(size_t bytes) override; + Status SetTxReadyNotifier( + pw::Function<void(size_t)> on_ready) override; StatusWithSize Send(std::span<const std::byte> tx_buffer) override; // RxDevice interface size_t RxBufferCapacity() const override; size_t RxBytesAvailable() const override; - Status SetRxBufferNotifyLevel(size_t bytes) override; - Status SetRxBufferNotifier(pw::Function<void(size_t)> on_ready) override; + Status SetRxReadyNotifyLevel(size_t bytes) override; + Status SetRxReadyNotifier(pw::Function<void(size_t)> on_ready) override; StatusWithSize Receive(std::span<std::byte> rx_buffer) override; private: @@ -87,10 +62,10 @@ void HandleRxReady(); void HandleTxReady(); void UpdateFifoLevels(); - size_t GetTxAvailableNotifyBytes() const; - size_t GetRxAvailableNotifyBytes() const; + size_t GetTxReadyNotifyBytes() const; + size_t GetRxReadyNotifyBytes() const; - Config config_{}; + UartConfig config_{}; uart_inst_t* instance_{nullptr}; bool initialized_{false}; bool enabled_{false}; @@ -98,7 +73,7 @@ bool tx_irq_enabled_{false}; size_t tx_notify_level_{1}; size_t rx_notify_level_{1}; - pw::Function<void(size_t)> on_tx_available_{}; + pw::Function<void(size_t)> on_tx_ready_{}; pw::Function<void(size_t)> on_rx_ready_{}; };
diff --git a/pw_hal_rp2xxx/uart/public/pw_hal_rp2xxx/uart/uart_config.h b/pw_hal_rp2xxx/uart/public/pw_hal_rp2xxx/uart/uart_config.h new file mode 100644 index 0000000..dabb761 --- /dev/null +++ b/pw_hal_rp2xxx/uart/public/pw_hal_rp2xxx/uart/uart_config.h
@@ -0,0 +1,49 @@ +// Copyright 2026 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. +#pragma once + +#include <cstdint> + +#include "hardware/uart.h" + +namespace pw::hal::uart { + +struct UartConfig { + enum class Parity : uint8_t { + kNone = UART_PARITY_NONE, + kOdd = UART_PARITY_ODD, + kEven = UART_PARITY_EVEN, + }; + + enum class DataBits : uint8_t { + k5 = 5, + k6 = 6, + k7 = 7, + k8 = 8, + }; + + enum class StopBits : uint8_t { + k1 = 1, + k2 = 2, + }; + + uint32_t baud_rate; + DataBits data_bits = DataBits::k8; + StopBits stop_bits = StopBits::k1; + Parity parity = Parity::kNone; + uint8_t txd_pin; + uint8_t rxd_pin; +}; + +} // namespace pw::hal::uart
diff --git a/pw_hal_rp2xxx/uart/uart_driver.cc b/pw_hal_rp2xxx/uart/raw_uart_driver.cc similarity index 81% rename from pw_hal_rp2xxx/uart/uart_driver.cc rename to pw_hal_rp2xxx/uart/raw_uart_driver.cc index 8fb5bea..b51172b 100644 --- a/pw_hal_rp2xxx/uart/uart_driver.cc +++ b/pw_hal_rp2xxx/uart/raw_uart_driver.cc
@@ -12,7 +12,7 @@ // License for the specific language governing permissions and limitations under // the License. -#include "pw_hal_rp2xxx/uart/uart_driver.h" +#include "pw_hal_rp2xxx/uart/raw_uart_driver.h" #include <utility> @@ -25,7 +25,7 @@ namespace pw::hal::uart { -static Rp2xxxBufferedUartDriver* s_instances[2] = {nullptr, nullptr}; +static Rp2xxxRawUartDriver* s_instances[2] = {nullptr, nullptr}; static inline size_t GetUartIndex(uart_inst_t* instance) { return instance == uart1 ? 1 : 0; @@ -35,13 +35,13 @@ return instance == uart1 ? UART1_IRQ : UART0_IRQ; } -Rp2xxxBufferedUartDriver::Rp2xxxBufferedUartDriver(uart_inst_t* instance) +Rp2xxxRawUartDriver::Rp2xxxRawUartDriver(uart_inst_t* instance) : instance_(instance) { PW_CHECK_NOTNULL(instance_); PW_ASSERT(instance_ == uart0 || instance_ == uart1); } -Status Rp2xxxBufferedUartDriver::Init(const Config& config) { +Status Rp2xxxRawUartDriver::Init(const UartConfig& config) { if (config.baud_rate == 0) { return Status::InvalidArgument(); } @@ -70,7 +70,7 @@ return OkStatus(); } -Status Rp2xxxBufferedUartDriver::DeInit() { +Status Rp2xxxRawUartDriver::DeInit() { if (enabled_) { Disable(); } @@ -78,7 +78,7 @@ return OkStatus(); } -void Rp2xxxBufferedUartDriver::Enable() { +void Rp2xxxRawUartDriver::Enable() { if (enabled_) { return; } @@ -115,7 +115,7 @@ enabled_ = true; } -void Rp2xxxBufferedUartDriver::Disable() { +void Rp2xxxRawUartDriver::Disable() { if (!enabled_) { return; } @@ -139,16 +139,16 @@ enabled_ = false; } -size_t Rp2xxxBufferedUartDriver::TxBufferCapacity() const { return kFifoDepth; } +size_t Rp2xxxRawUartDriver::TxBufferCapacity() const { return kFifoDepth; } -size_t Rp2xxxBufferedUartDriver::TxBytesAvailable() const { +size_t Rp2xxxRawUartDriver::TxBytesAvailable() const { if (!enabled_) { return 0; } return uart_is_writable(instance_) ? 1 : 0; } -Status Rp2xxxBufferedUartDriver::SetTxBufferNotifyLevel(size_t bytes) { +Status Rp2xxxRawUartDriver::SetTxReadyNotifyLevel(size_t bytes) { if (bytes == 0 || bytes > kFifoDepth) { return Status::InvalidArgument(); } @@ -157,10 +157,10 @@ return OkStatus(); } -Status Rp2xxxBufferedUartDriver::SetTxBufferNotifier( - pw::Function<void(size_t)> on_available) { - on_tx_available_ = std::move(on_available); - if (on_tx_available_ == nullptr) { +Status Rp2xxxRawUartDriver::SetTxReadyNotifier( + pw::Function<void(size_t)> on_ready) { + on_tx_ready_ = std::move(on_ready); + if (on_tx_ready_ == nullptr) { tx_irq_enabled_ = false; if (enabled_) { uart_set_irqs_enabled(instance_, rx_irq_enabled_, false); @@ -169,7 +169,7 @@ return OkStatus(); } -StatusWithSize Rp2xxxBufferedUartDriver::Send( +StatusWithSize Rp2xxxRawUartDriver::Send( std::span<const std::byte> tx_buffer) { if (!enabled_) { return StatusWithSize(Status::Unavailable(), 0); @@ -184,7 +184,7 @@ bytes_sent++; } - if (on_tx_available_ != nullptr && + if (on_tx_ready_ != nullptr && (bytes_sent < tx_buffer.size() || tx_buffer.size() >= tx_notify_level_)) { tx_irq_enabled_ = true; uart_set_irqs_enabled(instance_, rx_irq_enabled_, tx_irq_enabled_); @@ -196,16 +196,16 @@ return StatusWithSize(Status::ResourceExhausted(), bytes_sent); } -size_t Rp2xxxBufferedUartDriver::RxBufferCapacity() const { return kFifoDepth; } +size_t Rp2xxxRawUartDriver::RxBufferCapacity() const { return kFifoDepth; } -size_t Rp2xxxBufferedUartDriver::RxBytesAvailable() const { +size_t Rp2xxxRawUartDriver::RxBytesAvailable() const { if (!enabled_) { return 0; } return uart_is_readable(instance_) ? 1 : 0; } -Status Rp2xxxBufferedUartDriver::SetRxBufferNotifyLevel(size_t bytes) { +Status Rp2xxxRawUartDriver::SetRxReadyNotifyLevel(size_t bytes) { if (bytes == 0 || bytes > kFifoDepth) { return Status::InvalidArgument(); } @@ -214,7 +214,7 @@ return OkStatus(); } -Status Rp2xxxBufferedUartDriver::SetRxBufferNotifier( +Status Rp2xxxRawUartDriver::SetRxReadyNotifier( pw::Function<void(size_t)> on_ready) { on_rx_ready_ = std::move(on_ready); rx_irq_enabled_ = (on_rx_ready_ != nullptr); @@ -224,7 +224,7 @@ return OkStatus(); } -StatusWithSize Rp2xxxBufferedUartDriver::Receive( +StatusWithSize Rp2xxxRawUartDriver::Receive( std::span<std::byte> rx_buffer) { if (!enabled_) { return StatusWithSize(Status::Unavailable(), 0); @@ -250,23 +250,23 @@ return StatusWithSize(Status::ResourceExhausted(), bytes_received); } -void Rp2xxxBufferedUartDriver::IrqHandler0() { +void Rp2xxxRawUartDriver::IrqHandler0() { if (s_instances[0] != nullptr) { s_instances[0]->HandleInterrupt(); } } -void Rp2xxxBufferedUartDriver::IrqHandler1() { +void Rp2xxxRawUartDriver::IrqHandler1() { if (s_instances[1] != nullptr) { s_instances[1]->HandleInterrupt(); } } -void Rp2xxxBufferedUartDriver::HandleBusError() { +void Rp2xxxRawUartDriver::HandleBusError() { uart_get_hw(instance_)->rsr = 0; } -void Rp2xxxBufferedUartDriver::HandleInterrupt() { +void Rp2xxxRawUartDriver::HandleInterrupt() { HandleBusError(); if (uart_is_readable(instance_)) { @@ -277,23 +277,23 @@ } } -void Rp2xxxBufferedUartDriver::HandleRxReady() { +void Rp2xxxRawUartDriver::HandleRxReady() { if (on_rx_ready_ != nullptr) { rx_irq_enabled_ = false; uart_set_irqs_enabled(instance_, false, tx_irq_enabled_); - on_rx_ready_(GetRxAvailableNotifyBytes()); + on_rx_ready_(GetRxReadyNotifyBytes()); } } -void Rp2xxxBufferedUartDriver::HandleTxReady() { - if (on_tx_available_ != nullptr) { +void Rp2xxxRawUartDriver::HandleTxReady() { + if (on_tx_ready_ != nullptr) { tx_irq_enabled_ = false; uart_set_irqs_enabled(instance_, rx_irq_enabled_, false); - on_tx_available_(GetTxAvailableNotifyBytes()); + on_tx_ready_(GetTxReadyNotifyBytes()); } } -size_t Rp2xxxBufferedUartDriver::GetTxAvailableNotifyBytes() const { +size_t Rp2xxxRawUartDriver::GetTxReadyNotifyBytes() const { if (tx_notify_level_ >= 28) { return 28; } @@ -309,11 +309,11 @@ return 4; } -size_t Rp2xxxBufferedUartDriver::GetRxAvailableNotifyBytes() const { +size_t Rp2xxxRawUartDriver::GetRxReadyNotifyBytes() const { return rx_notify_level_; } -void Rp2xxxBufferedUartDriver::UpdateFifoLevels() { +void Rp2xxxRawUartDriver::UpdateFifoLevels() { uint32_t rx_level = 0; if (rx_notify_level_ >= 28) { rx_level = 4; // 7/8 full (28 bytes)
diff --git a/pw_hal_rp2xxx/uart/raw_uart_driver_golden_hiltest.cc b/pw_hal_rp2xxx/uart/raw_uart_driver_golden_hiltest.cc new file mode 100644 index 0000000..3021b29 --- /dev/null +++ b/pw_hal_rp2xxx/uart/raw_uart_driver_golden_hiltest.cc
@@ -0,0 +1,69 @@ +// Copyright 2026 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. +#include <array> +#include <span> + +#include "pw_bytes/span.h" +#include "pw_chrono/system_clock.h" +#include "pw_hal/uart/uart_golden_hiltest.h" +#include "pw_hal_rp2xxx/uart/raw_uart_driver.h" +#include "pw_sync/binary_semaphore.h" +#include "pw_thread/sleep.h" +#include "pw_unit_test/framework.h" + +namespace pw::hal::uart { +namespace { + +constexpr uint8_t kTxPin = 4; +constexpr uint8_t kRxPin = 5; + +UartConfig GetDefaultConfig() { + UartConfig config; + config.baud_rate = 115200; + config.data_bits = UartConfig::DataBits::k8; + config.stop_bits = UartConfig::StopBits::k1; + config.parity = UartConfig::Parity::kNone; + config.txd_pin = kTxPin; + config.rxd_pin = kRxPin; + return config; +} + +TEST(Rp2xxxRawUartDriverTest, GoldenTest_16x1Bytes) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); + PW_TEST_EXPECT_OK(driver.Init(config)); + driver.Enable(); + + pw::this_thread::sleep_for(std::chrono::milliseconds(10)); + SendByteTransactions(driver, 8, kTransactions_16x1); + pw::this_thread::sleep_for(std::chrono::milliseconds(10)); + + driver.Disable(); +} + +TEST(Rp2xxxRawUartDriverTest, GoldenTest_AllIncreasing) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); + PW_TEST_EXPECT_OK(driver.Init(config)); + driver.Enable(); + + pw::this_thread::sleep_for(std::chrono::milliseconds(10)); + SendByteTransactions(driver, 16, kTransactions_AllIncreasing); + pw::this_thread::sleep_for(std::chrono::milliseconds(10)); + + driver.Disable(); +} + +} // namespace +} // namespace pw::hal::uart
diff --git a/pw_hal_rp2xxx/uart/uart_golden_hiltest.py b/pw_hal_rp2xxx/uart/raw_uart_driver_golden_hiltest.py similarity index 88% rename from pw_hal_rp2xxx/uart/uart_golden_hiltest.py rename to pw_hal_rp2xxx/uart/raw_uart_driver_golden_hiltest.py index 918c8be..ccaacb1 100644 --- a/pw_hal_rp2xxx/uart/uart_golden_hiltest.py +++ b/pw_hal_rp2xxx/uart/raw_uart_driver_golden_hiltest.py
@@ -31,12 +31,12 @@ def test_golden_16x1_bytes(self): _LOG.info("Testing GoldenTest_16x1Bytes") uart_block = self.sim.create(uart.Uart("uart")) - self.dut.run("Rp2xxxBufferedUartDriverTest", "GoldenTest_16x1Bytes") + self.dut.run("Rp2xxxRawUartDriverTest", "GoldenTest_16x1Bytes") def test_golden_all_increasing(self): _LOG.info("Testing GoldenTest_AllIncreasing") uart_block = self.sim.create(uart.Uart("uart")) - self.dut.run("Rp2xxxBufferedUartDriverTest", "GoldenTest_AllIncreasing") + self.dut.run("Rp2xxxRawUartDriverTest", "GoldenTest_AllIncreasing") if __name__ == "__main__":
diff --git a/pw_hal_rp2xxx/uart/uart_driver_hiltest.cc b/pw_hal_rp2xxx/uart/raw_uart_driver_hiltest.cc similarity index 65% rename from pw_hal_rp2xxx/uart/uart_driver_hiltest.cc rename to pw_hal_rp2xxx/uart/raw_uart_driver_hiltest.cc index 53d3e83..b081f21 100644 --- a/pw_hal_rp2xxx/uart/uart_driver_hiltest.cc +++ b/pw_hal_rp2xxx/uart/raw_uart_driver_hiltest.cc
@@ -19,7 +19,7 @@ #include "pw_bytes/span.h" #include "pw_chrono/system_clock.h" #include "pw_hal/uart/uart_golden_hiltest.h" -#include "pw_hal_rp2xxx/uart/uart_driver.h" +#include "pw_hal_rp2xxx/uart/raw_uart_driver.h" #include "pw_sync/binary_semaphore.h" #include "pw_thread/sleep.h" #include "pw_unit_test/framework.h" @@ -41,27 +41,27 @@ }; static GlobalPinInit s_global_pin_init; -Rp2xxxBufferedUartDriver::Config GetDefaultConfig() { - Rp2xxxBufferedUartDriver::Config config; +UartConfig GetDefaultConfig() { + UartConfig config; config.baud_rate = 115200; - config.data_bits = Rp2xxxBufferedUartDriver::Config::DataBits::k8; - config.stop_bits = Rp2xxxBufferedUartDriver::Config::StopBits::k1; - config.parity = Rp2xxxBufferedUartDriver::Config::Parity::kNone; + config.data_bits = UartConfig::DataBits::k8; + config.stop_bits = UartConfig::StopBits::k1; + config.parity = UartConfig::Parity::kNone; config.txd_pin = kTxPin; config.rxd_pin = kRxPin; return config; } -TEST(Rp2xxxBufferedUartDriverTest, InvalidConfigFails) { - Rp2xxxBufferedUartDriver driver(uart1); - Rp2xxxBufferedUartDriver::Config config = GetDefaultConfig(); +TEST(Rp2xxxRawUartDriverTest, InvalidConfigFails) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); config.baud_rate = 0; EXPECT_EQ(driver.Init(config), Status::InvalidArgument()); } -TEST(Rp2xxxBufferedUartDriverTest, SendWhenDisabledFails) { - Rp2xxxBufferedUartDriver driver(uart1); - Rp2xxxBufferedUartDriver::Config config = GetDefaultConfig(); +TEST(Rp2xxxRawUartDriverTest, SendWhenDisabledFails) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); PW_TEST_EXPECT_OK(driver.Init(config)); std::array<std::byte, 4> data = { @@ -71,9 +71,9 @@ EXPECT_EQ(result.size(), 0u); } -TEST(Rp2xxxBufferedUartDriverTest, ReceiveWhenDisabledFails) { - Rp2xxxBufferedUartDriver driver(uart1); - Rp2xxxBufferedUartDriver::Config config = GetDefaultConfig(); +TEST(Rp2xxxRawUartDriverTest, ReceiveWhenDisabledFails) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); PW_TEST_EXPECT_OK(driver.Init(config)); std::array<std::byte, 4> rx_buf{}; @@ -82,25 +82,25 @@ EXPECT_EQ(result.size(), 0u); } -TEST(Rp2xxxBufferedUartDriverTest, BufferCapacityAndNotifyLevels) { - Rp2xxxBufferedUartDriver driver(uart1); - Rp2xxxBufferedUartDriver::Config config = GetDefaultConfig(); +TEST(Rp2xxxRawUartDriverTest, BufferCapacityAndNotifyLevels) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); PW_TEST_EXPECT_OK(driver.Init(config)); EXPECT_EQ(driver.TxBufferCapacity(), 32u); EXPECT_EQ(driver.RxBufferCapacity(), 32u); - EXPECT_EQ(driver.SetTxBufferNotifyLevel(0), Status::InvalidArgument()); - EXPECT_EQ(driver.SetTxBufferNotifyLevel(33), Status::InvalidArgument()); - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifyLevel(1)); - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifyLevel(16)); - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifyLevel(32)); + EXPECT_EQ(driver.SetTxReadyNotifyLevel(0), Status::InvalidArgument()); + EXPECT_EQ(driver.SetTxReadyNotifyLevel(33), Status::InvalidArgument()); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifyLevel(1)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifyLevel(16)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifyLevel(32)); - EXPECT_EQ(driver.SetRxBufferNotifyLevel(0), Status::InvalidArgument()); - EXPECT_EQ(driver.SetRxBufferNotifyLevel(33), Status::InvalidArgument()); - PW_TEST_EXPECT_OK(driver.SetRxBufferNotifyLevel(1)); - PW_TEST_EXPECT_OK(driver.SetRxBufferNotifyLevel(16)); - PW_TEST_EXPECT_OK(driver.SetRxBufferNotifyLevel(32)); + EXPECT_EQ(driver.SetRxReadyNotifyLevel(0), Status::InvalidArgument()); + EXPECT_EQ(driver.SetRxReadyNotifyLevel(33), Status::InvalidArgument()); + PW_TEST_EXPECT_OK(driver.SetRxReadyNotifyLevel(1)); + PW_TEST_EXPECT_OK(driver.SetRxReadyNotifyLevel(16)); + PW_TEST_EXPECT_OK(driver.SetRxReadyNotifyLevel(32)); driver.Enable(); @@ -108,54 +108,54 @@ EXPECT_NE(uart_get_hw(uart1)->lcr_h & UART_UARTLCR_H_FEN_BITS, 0u); // Verify conservative RX FIFO level select - PW_TEST_EXPECT_OK(driver.SetRxBufferNotifyLevel(18)); + PW_TEST_EXPECT_OK(driver.SetRxReadyNotifyLevel(18)); EXPECT_EQ((uart_get_hw(uart1)->ifls >> 3) & 0x7, 2u); // 1/2 full (16 bytes) - PW_TEST_EXPECT_OK(driver.SetRxBufferNotifyLevel(4)); + PW_TEST_EXPECT_OK(driver.SetRxReadyNotifyLevel(4)); EXPECT_EQ((uart_get_hw(uart1)->ifls >> 3) & 0x7, 0u); // 1/8 full (4 bytes) - PW_TEST_EXPECT_OK(driver.SetRxBufferNotifyLevel(8)); + PW_TEST_EXPECT_OK(driver.SetRxReadyNotifyLevel(8)); EXPECT_EQ((uart_get_hw(uart1)->ifls >> 3) & 0x7, 1u); // 1/4 full (8 bytes) - PW_TEST_EXPECT_OK(driver.SetRxBufferNotifyLevel(16)); + PW_TEST_EXPECT_OK(driver.SetRxReadyNotifyLevel(16)); EXPECT_EQ((uart_get_hw(uart1)->ifls >> 3) & 0x7, 2u); // 1/2 full (16 bytes) - PW_TEST_EXPECT_OK(driver.SetRxBufferNotifyLevel(24)); + PW_TEST_EXPECT_OK(driver.SetRxReadyNotifyLevel(24)); EXPECT_EQ((uart_get_hw(uart1)->ifls >> 3) & 0x7, 3u); // 3/4 full (24 bytes) - PW_TEST_EXPECT_OK(driver.SetRxBufferNotifyLevel(28)); + PW_TEST_EXPECT_OK(driver.SetRxReadyNotifyLevel(28)); EXPECT_EQ((uart_get_hw(uart1)->ifls >> 3) & 0x7, 4u); // 7/8 full (28 bytes) - PW_TEST_EXPECT_OK(driver.SetRxBufferNotifyLevel(32)); + PW_TEST_EXPECT_OK(driver.SetRxReadyNotifyLevel(32)); EXPECT_EQ((uart_get_hw(uart1)->ifls >> 3) & 0x7, 4u); // 7/8 full (28 bytes) // Verify conservative TX FIFO level select - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifyLevel(28)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifyLevel(28)); EXPECT_EQ(uart_get_hw(uart1)->ifls & 0x7, 0u); // <= 1/8 full (>= 28 bytes space) - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifyLevel(24)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifyLevel(24)); EXPECT_EQ(uart_get_hw(uart1)->ifls & 0x7, 1u); // <= 1/4 full (>= 24 bytes space) - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifyLevel(18)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifyLevel(18)); EXPECT_EQ(uart_get_hw(uart1)->ifls & 0x7, 2u); // <= 1/2 full (>= 16 bytes space) - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifyLevel(8)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifyLevel(8)); EXPECT_EQ(uart_get_hw(uart1)->ifls & 0x7, 3u); // <= 3/4 full (>= 8 bytes space) - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifyLevel(1)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifyLevel(1)); EXPECT_EQ(uart_get_hw(uart1)->ifls & 0x7, 4u); // <= 7/8 full (>= 4 bytes space) driver.Disable(); } -TEST(Rp2xxxBufferedUartDriverTest, BytesAvailable) { - Rp2xxxBufferedUartDriver driver(uart1); - Rp2xxxBufferedUartDriver::Config config = GetDefaultConfig(); +TEST(Rp2xxxRawUartDriverTest, BytesAvailable) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); PW_TEST_EXPECT_OK(driver.Init(config)); EXPECT_EQ(driver.TxBytesAvailable(), 0u); @@ -170,9 +170,9 @@ EXPECT_EQ(driver.RxBytesAvailable(), 0u); } -TEST(Rp2xxxBufferedUartDriverTest, SendData_Success) { - Rp2xxxBufferedUartDriver driver(uart1); - Rp2xxxBufferedUartDriver::Config config = GetDefaultConfig(); +TEST(Rp2xxxRawUartDriverTest, SendData_Success) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); PW_TEST_EXPECT_OK(driver.Init(config)); driver.Enable(); @@ -193,9 +193,9 @@ driver.Disable(); } -TEST(Rp2xxxBufferedUartDriverTest, Loopback) { - Rp2xxxBufferedUartDriver driver(uart1); - Rp2xxxBufferedUartDriver::Config config = GetDefaultConfig(); +TEST(Rp2xxxRawUartDriverTest, Loopback) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); PW_TEST_EXPECT_OK(driver.Init(config)); driver.Enable(); @@ -210,7 +210,7 @@ } ctx; PW_TEST_EXPECT_OK( - driver.SetRxBufferNotifier([&ctx](size_t bytes_available) { + driver.SetRxReadyNotifier([&ctx](size_t bytes_available) { ctx.available_bytes = bytes_available; ctx.rx_done.release(); })); @@ -231,7 +231,7 @@ EXPECT_EQ(rx_result.size(), 1u); EXPECT_EQ(rx_byte, tx_byte); - PW_TEST_EXPECT_OK(driver.SetRxBufferNotifier(nullptr)); + PW_TEST_EXPECT_OK(driver.SetRxReadyNotifier(nullptr)); pw::this_thread::sleep_for(std::chrono::milliseconds(10)); } @@ -239,22 +239,22 @@ driver.Disable(); } -TEST(Rp2xxxBufferedUartDriverTest, SendBelowNotifyLevel_NoNotification) { - Rp2xxxBufferedUartDriver driver(uart1); - Rp2xxxBufferedUartDriver::Config config = GetDefaultConfig(); +TEST(Rp2xxxRawUartDriverTest, SendBelowNotifyLevel_NoNotification) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); PW_TEST_EXPECT_OK(driver.Init(config)); driver.Enable(); pw::this_thread::sleep_for(std::chrono::milliseconds(10)); - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifyLevel(4)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifyLevel(4)); struct TestContext { pw::sync::BinarySemaphore tx_notified; bool notification_fired = false; } ctx; - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifier([&ctx](size_t) { + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifier([&ctx](size_t) { ctx.notification_fired = true; ctx.tx_notified.release(); })); @@ -267,19 +267,19 @@ EXPECT_FALSE(ctx.tx_notified.try_acquire_for(std::chrono::milliseconds(100))); EXPECT_FALSE(ctx.notification_fired); - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifier(nullptr)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifier(nullptr)); driver.Disable(); } -TEST(Rp2xxxBufferedUartDriverTest, SendAboveNotifyLevel_NotificationFires) { - Rp2xxxBufferedUartDriver driver(uart1); - Rp2xxxBufferedUartDriver::Config config = GetDefaultConfig(); +TEST(Rp2xxxRawUartDriverTest, SendAboveNotifyLevel_NotificationFires) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); PW_TEST_EXPECT_OK(driver.Init(config)); driver.Enable(); pw::this_thread::sleep_for(std::chrono::milliseconds(10)); - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifyLevel(4)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifyLevel(4)); struct TestContext { pw::sync::BinarySemaphore tx_notified; @@ -287,11 +287,12 @@ size_t available_bytes = 0; } ctx; - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifier([&ctx](size_t bytes_available) { - ctx.notification_fired = true; - ctx.available_bytes = bytes_available; - ctx.tx_notified.release(); - })); + PW_TEST_EXPECT_OK( + driver.SetTxReadyNotifier([&ctx](size_t bytes_available) { + ctx.notification_fired = true; + ctx.available_bytes = bytes_available; + ctx.tx_notified.release(); + })); std::array<std::byte, 6> data = {std::byte{'1'}, std::byte{'2'}, @@ -307,19 +308,19 @@ EXPECT_TRUE(ctx.notification_fired); EXPECT_GE(ctx.available_bytes, 4u); - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifier(nullptr)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifier(nullptr)); driver.Disable(); } -TEST(Rp2xxxBufferedUartDriverTest, SendLargeBuffer_NotificationAndDrain) { - Rp2xxxBufferedUartDriver driver(uart1); - Rp2xxxBufferedUartDriver::Config config = GetDefaultConfig(); +TEST(Rp2xxxRawUartDriverTest, SendLargeBuffer_NotificationAndDrain) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); PW_TEST_EXPECT_OK(driver.Init(config)); driver.Enable(); pw::this_thread::sleep_for(std::chrono::milliseconds(10)); - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifyLevel(16)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifyLevel(16)); struct TestContext { pw::sync::BinarySemaphore tx_notified; @@ -327,11 +328,12 @@ size_t available_bytes = 0; } ctx; - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifier([&ctx](size_t bytes_available) { - ctx.notification_fired = true; - ctx.available_bytes = bytes_available; - ctx.tx_notified.release(); - })); + PW_TEST_EXPECT_OK( + driver.SetTxReadyNotifier([&ctx](size_t bytes_available) { + ctx.notification_fired = true; + ctx.available_bytes = bytes_available; + ctx.tx_notified.release(); + })); std::array<std::byte, 48> data; for (size_t i = 0; i < data.size(); ++i) { @@ -356,13 +358,13 @@ PW_TEST_EXPECT_OK(remaining_result.status()); EXPECT_EQ(remaining_result.size(), 16u); - PW_TEST_EXPECT_OK(driver.SetTxBufferNotifier(nullptr)); + PW_TEST_EXPECT_OK(driver.SetTxReadyNotifier(nullptr)); driver.Disable(); } -TEST(Rp2xxxBufferedUartDriverTest, GoldenTest_16x1Bytes) { - Rp2xxxBufferedUartDriver driver(uart1); - Rp2xxxBufferedUartDriver::Config config = GetDefaultConfig(); +TEST(Rp2xxxRawUartDriverTest, GoldenTest_16x1Bytes) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); PW_TEST_EXPECT_OK(driver.Init(config)); driver.Enable(); @@ -373,9 +375,9 @@ driver.Disable(); } -TEST(Rp2xxxBufferedUartDriverTest, GoldenTest_AllIncreasing) { - Rp2xxxBufferedUartDriver driver(uart1); - Rp2xxxBufferedUartDriver::Config config = GetDefaultConfig(); +TEST(Rp2xxxRawUartDriverTest, GoldenTest_AllIncreasing) { + Rp2xxxRawUartDriver driver(uart1); + UartConfig config = GetDefaultConfig(); PW_TEST_EXPECT_OK(driver.Init(config)); driver.Enable();
diff --git a/pw_hal_rp2xxx/uart/uart_driver_hiltest.py b/pw_hal_rp2xxx/uart/raw_uart_driver_hiltest.py similarity index 81% rename from pw_hal_rp2xxx/uart/uart_driver_hiltest.py rename to pw_hal_rp2xxx/uart/raw_uart_driver_hiltest.py index eea986c..cfd224d 100644 --- a/pw_hal_rp2xxx/uart/uart_driver_hiltest.py +++ b/pw_hal_rp2xxx/uart/raw_uart_driver_hiltest.py
@@ -30,30 +30,30 @@ # def test_invalid_config(self): # _LOG.info("Testing InvalidConfigFails") - # self.dut.run("Rp2xxxBufferedUartDriverTest", "InvalidConfigFails") + # self.dut.run("Rp2xxxRawUartDriverTest", "InvalidConfigFails") # def test_send_disabled(self): # _LOG.info("Testing SendWhenDisabledFails") - # self.dut.run("Rp2xxxBufferedUartDriverTest", "SendWhenDisabledFails") + # self.dut.run("Rp2xxxRawUartDriverTest", "SendWhenDisabledFails") # def test_receive_disabled(self): # _LOG.info("Testing ReceiveWhenDisabledFails") - # self.dut.run("Rp2xxxBufferedUartDriverTest", "ReceiveWhenDisabledFails") + # self.dut.run("Rp2xxxRawUartDriverTest", "ReceiveWhenDisabledFails") # def test_buffer_capacity_and_notify_levels(self): # _LOG.info("Testing BufferCapacityAndNotifyLevels") - # self.dut.run("Rp2xxxBufferedUartDriverTest", "BufferCapacityAndNotifyLevels") + # self.dut.run("Rp2xxxRawUartDriverTest", "BufferCapacityAndNotifyLevels") def test_bytes_available(self): _LOG.info("Testing BytesAvailable") - self.dut.run("Rp2xxxBufferedUartDriverTest", "BytesAvailable") + self.dut.run("Rp2xxxRawUartDriverTest", "BytesAvailable") def test_uart_driver_send(self): _LOG.info("Testing UartDriver SendData_Success") uart_block = self.sim.create(uart.Uart("uart")) self.sim.start() - self.dut.run("Rp2xxxBufferedUartDriverTest", "SendData_Success") + self.dut.run("Rp2xxxRawUartDriverTest", "SendData_Success") self.sim.stop() events = uart_block.events() @@ -71,7 +71,7 @@ self.sim.connect(uart_block.rxd_byte(), uart_block.tx_byte()) self.sim.start() - self.dut.run("Rp2xxxBufferedUartDriverTest", "Loopback") + self.dut.run("Rp2xxxRawUartDriverTest", "Loopback") self.sim.stop() events = uart_block.events() @@ -88,7 +88,7 @@ uart_block = self.sim.create(uart.Uart("uart")) self.sim.start() self.dut.run( - "Rp2xxxBufferedUartDriverTest", "SendBelowNotifyLevel_NoNotification" + "Rp2xxxRawUartDriverTest", "SendBelowNotifyLevel_NoNotification" ) self.sim.stop() metrics = self.sim.metrics() @@ -99,7 +99,7 @@ uart_block = self.sim.create(uart.Uart("uart")) self.sim.start() self.dut.run( - "Rp2xxxBufferedUartDriverTest", "SendAboveNotifyLevel_NotificationFires" + "Rp2xxxRawUartDriverTest", "SendAboveNotifyLevel_NotificationFires" ) self.sim.stop() metrics = self.sim.metrics() @@ -110,7 +110,7 @@ uart_block = self.sim.create(uart.Uart("uart")) self.sim.start() self.dut.run( - "Rp2xxxBufferedUartDriverTest", "SendLargeBuffer_NotificationAndDrain" + "Rp2xxxRawUartDriverTest", "SendLargeBuffer_NotificationAndDrain" ) self.sim.stop() metrics = self.sim.metrics()