tpu-sg2002 0.1.0

TPU driver in Rust for SG2002 SoC.
Documentation
//! Minimal TPU device layer for SG2002.
//!
//! Bare-metal, OS-agnostic TPU driver for the CVITEK SG2002 SoC.
//!
//! # Usage
//!
//! ```ignore
//! use tpu_sg2002::{TpuDevice, TpuConfig, KernelFns, LogLevel, TimeStamp};
//! use core::ptr::NonNull;
//!
//! struct MyKernelFns;
//! impl KernelFns for MyKernelFns {
//!     fn sleep_ms(&self, ms: u32) { /* ... */ }
//!     fn now_us(&self) -> TimeStamp { /* ... */ }
//!     fn log(&self, level: LogLevel, msg: &str) { /* ... */ }
//! }
//!
//! let tdma_base = NonNull::new(0x0C00_0000 as *mut u8).unwrap();
//! let tiu_base = NonNull::new(0x0C01_0000 as *mut u8).unwrap();
//! let mut tpu = TpuDevice::new(tdma_base, tiu_base, TpuConfig::default(), MyKernelFns);
//! tpu.platform_init().expect("TPU init failed");
//! ```

#![no_std]

mod device;
mod kernel_fns;
mod types;
pub mod ioctrl;
pub mod platform;
pub mod pmu;
pub mod registers;

// Error type
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TpuError {
    InvalidParameter,
    Timeout,
    DeviceError,
}

// Core types
pub use types::{CpuSyncDesc, DmabufView, DmaHeader, TpuConfig, TpuTdmaPioInfo, parse_dmabuf_view};
pub use device::TpuDevice;
pub use kernel_fns::{PhysAddr, TimeStamp, LogLevel, KernelFns};

// Re-export essential platform types
pub use platform::{TdmaReg, TpuRegBackup, TdmaSyncStatus, TiuCtrlStatus, TIMEOUT_US};
pub use pmu::{TpuPmu, TpuPmuEvent, PmuSummary};
pub use registers::TiuLaneNum;