Skip to main content

axvisor_driver/
lib.rs

1// Copyright 2025 The Axvisor Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#![no_std]
16
17extern crate axklib;
18
19use core::ptr::NonNull;
20
21use rdrive::probe::OnProbeError;
22
23#[allow(unused_imports)]
24#[macro_use]
25extern crate alloc;
26
27#[allow(unused_imports)]
28#[macro_use]
29extern crate log;
30
31mod blk;
32mod soc;
33// mod serial;
34
35#[allow(unused)]
36fn iomap(base: u64, size: usize) -> Result<NonNull<u8>, OnProbeError> {
37    axklib::mem::iomap((base as usize).into(), size)
38        .map(|ptr| unsafe { NonNull::new_unchecked(ptr.as_mut_ptr()) })
39        .map_err(|e| OnProbeError::Other(format!("{e}:?").into()))
40}