⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

veridian_kernel/drivers/bluetooth/
mod.rs

1//! Bluetooth driver subsystem
2//!
3//! Provides HCI (Host Controller Interface) transport, command/event protocol,
4//! L2CAP basics, and SDP service discovery stubs.
5
6#![allow(dead_code)]
7
8pub mod device_node;
9pub mod hci;
10
11// Phase 8 Wave 2: Bluetooth L2CAP/RFCOMM/Profiles
12pub mod l2cap;
13pub mod profiles;
14pub mod rfcomm;
15
16pub use hci::{BluetoothController, ControllerState};
17use spin::Mutex;
18
19use crate::sync::once_lock::OnceLock;
20
21/// Global Bluetooth controller instance
22static BT_CONTROLLER: OnceLock<Mutex<BluetoothController>> = OnceLock::new();
23
24/// Initialize the Bluetooth subsystem
25pub fn init() {
26    let controller = BluetoothController::new();
27    let _ = BT_CONTROLLER.set(Mutex::new(controller));
28    crate::println!("[BT] Bluetooth subsystem initialized");
29}
30
31/// Access the global Bluetooth controller
32pub fn get_controller() -> &'static Mutex<BluetoothController> {
33    BT_CONTROLLER
34        .get()
35        .expect("Bluetooth controller not initialized")
36}