alpha
Login
or
Join now
arthomnix.dev
/
eepy
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
firmware for my Touchscreen E-Paper Input Module for Framework Laptop 16
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
eepy-sys: migrate to rust 2024
author
arthomnix
date
1 year ago
(Mar 23, 2025, 8:15 PM UTC)
commit
92773542
92773542334b01e7a958a41b249575a3f88182e3
parent
f90c922c
f90c922c7e458e90de329c2e1e3258858e544098
+13
-13
3 changed files
Expand all
Collapse all
Unified
Split
eepy-sys
Cargo.toml
src
flash.rs
header.rs
+1
-1
eepy-sys/Cargo.toml
Reviewed
···
1
1
[package]
2
2
name = "eepy-sys"
3
3
version = "0.1.0"
4
4
-
edition = "2021"
4
4
+
edition = "2024"
5
5
6
6
[dependencies]
7
7
eepy-derive = { path = "../eepy-derive" }
+6
-6
eepy-sys/src/flash.rs
Reviewed
···
10
10
EraseAndProgram = 2,
11
11
}
12
12
13
13
-
pub unsafe fn erase(start_addr: u32, len: u32) {
13
13
+
pub unsafe fn erase(start_addr: u32, len: u32) { unsafe {
14
14
syscall!(
15
15
SyscallNumber::Flash,
16
16
in FlashSyscall::Erase,
17
17
in start_addr,
18
18
in len,
19
19
);
20
20
-
}
20
20
+
}}
21
21
22
22
-
pub unsafe fn program(start_addr: u32, data: &[u8]) {
22
22
+
pub unsafe fn program(start_addr: u32, data: &[u8]) { unsafe {
23
23
syscall!(
24
24
SyscallNumber::Flash,
25
25
in FlashSyscall::Program,
···
27
27
in data.len(),
28
28
in data.as_ptr(),
29
29
);
30
30
-
}
30
30
+
}}
31
31
32
32
-
pub unsafe fn erase_and_program(start_addr: u32, data: &[u8]) {
32
32
+
pub unsafe fn erase_and_program(start_addr: u32, data: &[u8]) { unsafe {
33
33
syscall!(
34
34
SyscallNumber::Flash,
35
35
in FlashSyscall::EraseAndProgram,
···
37
37
in data.len(),
38
38
in data.as_ptr(),
39
39
);
40
40
-
}
40
40
+
}}
+6
-6
eepy-sys/src/header.rs
Reviewed
···
8
8
9
9
pub const SLOT_SIZE: usize = 0x80000;
10
10
11
11
-
pub const unsafe fn slot_ptr(id: u8) -> *const u8 {
11
11
+
pub const unsafe fn slot_ptr(id: u8) -> *const u8 { unsafe {
12
12
if id > 31 {
13
13
panic!("slot ID must be between 0 and 31");
14
14
}
···
19
19
} else {
20
20
XIP_BASE.add(SLOT_SIZE * id as usize)
21
21
}
22
22
-
}
22
22
+
}}
23
23
24
24
-
pub const unsafe fn slot(id: u8) -> *const ProgramSlotHeader {
24
24
+
pub const unsafe fn slot(id: u8) -> *const ProgramSlotHeader { unsafe {
25
25
slot_ptr(id).cast()
26
26
-
}
26
26
+
}}
27
27
28
28
29
29
pub struct Programs {
···
199
199
}
200
200
}
201
201
202
202
-
pub unsafe fn load(&self) {
202
202
+
pub unsafe fn load(&self) { unsafe {
203
203
if self.data_len > 0 {
204
204
core::ptr::copy_nonoverlapping(self.data_lma, self.data_vma, self.data_len);
205
205
}
···
207
207
if self.bss_len > 0 {
208
208
self.bss_vma.write_bytes(0, self.bss_len);
209
209
}
210
210
-
}
210
210
+
}}
211
211
}