Skip to content

Commit bc85c46

Browse files
authored
bump to v0.1.0-alpha.1 (#2)
* prerelease-0.2.0 * Fix: rename .github/workflow to .github/workflows * Fix: remove invalid cross-file dependencies * Fix: remove duplicate categories and switch to nightly toolchain * chore: update repository and docs url to upstream
1 parent 7c0fc05 commit bc85c46

7 files changed

Lines changed: 181 additions & 2 deletions

File tree

.github/workflows/check.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Check
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
check:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install Rust
19+
uses: dtolnay/rust-toolchain@nightly
20+
with:
21+
components: rustfmt, clippy, llvm-tools-preview
22+
23+
- name: Check Formatting
24+
run: cargo fmt --all -- --check
25+
26+
- name: Check Clippy
27+
run: cargo clippy --all-features -- -D warnings
28+
29+
- name: Check Documentation Build
30+
run: cargo doc --no-deps --all-features

.github/workflows/deploy.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install Rust
17+
uses: dtolnay/rust-toolchain@nightly
18+
19+
- name: Build Documentation
20+
run: cargo doc --no-deps --all-features
21+
22+
- name: Create index.html
23+
run: echo '<meta http-equiv="refresh" content="0;url=axklib/index.html">' > target/doc/index.html
24+
25+
- name: Deploy to GitHub Pages
26+
uses: peaceiris/actions-gh-pages@v3
27+
with:
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
publish_dir: ./target/doc

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install Rust
18+
uses: dtolnay/rust-toolchain@nightly
19+
20+
- name: Publish to Crates.io
21+
env:
22+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
23+
run: cargo publish
24+
25+
- name: Create GitHub Release
26+
uses: softprops/action-gh-release@v1
27+
if: startsWith(github.ref, 'refs/tags/')
28+
with:
29+
generate_release_notes: true
30+
prerelease: ${{ contains(github.ref, '-') }}

.github/workflows/test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install Rust
19+
uses: dtolnay/rust-toolchain@nightly
20+
21+
- name: Run Tests
22+
run: cargo test --all-features

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
[package]
22
name = "axklib"
3-
version = "0.2.0"
3+
version = "0.1.0-alpha.1"
44
edition = "2024"
55
authors = ["周睿 <zrufo747@outlook.com>"]
6+
description = "Small kernel-helper abstractions used across the microkernel"
7+
repository = "https://github.com/arceos-hypervisor/axklib"
68
license = "GPL-3.0-or-later OR Apache-2.0 OR MulanPSL-2.0"
79
keywords = ["arceos", "kernel"]
810
categories = ["os", "no-std"]
11+
readme = "README.md"
12+
documentation = "https://arceos-hypervisor.github.io/axklib"
913

1014
[dependencies]
1115
axerrno = "0.1"

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# axklib
2+
3+
[![Crates.io](https://img.shields.io/crates/v/axklib.svg)](https://crates.io/crates/axklib)
4+
[![Docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://numpy1314.github.io/axklib)
5+
[![License](https://img.shields.io/crates/l/axklib.svg)](https://github.com/numpy1314/axklib/blob/main/LICENSE)
6+
7+
**axklib** — Small kernel-helper abstractions used across the ArceOS microkernel.
8+
9+
## Overview
10+
11+
This crate exposes a tiny, `no_std`-compatible trait (`Klib`) that the platform/board layer must implement. The trait provides a handful of common kernel helpers such as:
12+
13+
- Memory mapping helpers
14+
- Timing utilities (busy-wait)
15+
- IRQ registration and enabling/disabling
16+
17+
The implementation is typically supplied by the platform layer (e.g., `modules/axklib-impl`) and consumed by drivers and other modules.
18+
19+
The crate also provides small convenience modules (`mem`, `time`, `irq`) that re-export the trait methods with shorter names to make call sites more ergonomic.
20+
21+
## Usage
22+
23+
Add this to your `Cargo.toml`:
24+
25+
```toml
26+
[dependencies]
27+
axklib = "0.2.0"
28+
```
29+
30+
## Example
31+
32+
```rust
33+
// 1. Map 4K of device MMIO at physical address `paddr`
34+
// Returns axerrno::AxResult<VirtAddr>
35+
let vaddr = axklib::mem::iomap(paddr, 0x1000)?;
36+
37+
// 2. Busy-wait for 100 microseconds
38+
axklib::time::busy_wait(core::time::Duration::from_micros(100));
39+
40+
// 3. Register an IRQ handler
41+
// Returns bool indicating success
42+
axklib::irq::register(32, my_irq_handler);
43+
44+
fn my_irq_handler() {
45+
// Handle interrupt...
46+
}
47+
```
48+
49+
## License
50+
This project is licensed under either of
51+
52+
- GNU General Public License, Version 3.0 or later (LICENSE-GPL
53+
or https://www.gnu.org/licenses/gpl-3.0.html
54+
)
55+
56+
- Apache License, Version 2.0 (LICENSE-APACHE
57+
or http://www.apache.org/licenses/LICENSE-2.0
58+
)
59+
60+
- Mulan Permissive Software License, Version 2.0 (LICENSE-MULAN
61+
or https://license.coscl.org.cn/MulanPSL2/
62+
)
63+
64+
at your option.

0 commit comments

Comments
 (0)