Skip to content

Commit

Permalink
Moved device_init function in rpi driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanMcMillan54 committed Aug 7, 2022
1 parent 8e0a481 commit 3eb7212
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This branch is dedicated to maintaining updating Novusk v3,
[this issue](https://github.com/NathanMcMillan54/novusk/issues/14) has a list of things that are needed in this current
major version and in future major versions.

Join the [Discord](https://discord.gg/hcVcCugVFP) server for updates on the kernel and projects for the kernel.
Join the [Discord](https://discord.gg/hcVcCugVFP) server for updates and discussion related to the kernel.

Also, this is Jared:
```commandline
Expand Down
22 changes: 0 additions & 22 deletions drivers/rpi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,6 @@ pub use rpi2::registers::*;
#[cfg(feature = "rpi3")]
pub use rpi3::*;


#[cfg(all(feature = "rpi3", not(feature = "rpi2")))]
#[no_mangle]
// #[export_name = "device_init"]
pub extern "C" fn device_init() -> (Result<(), &'static str>, &'static str) {
let mut pi = Rpi3::new();
pi.init();

if pi.error.0 {
return (Err(pi.error.1), "RPi 3");
} else { return (Ok(()), "RPi 3"); }
}

#[cfg(all(feature = "rpi2", not(feature = "rpi3")))]
#[no_mangle]
pub extern "C" fn device_init() -> (Result<(), &'static str>, &'static str) {
let mut pi = Rpi2::new();
pi.init();

return (Ok(()), "RPi 2");
}

fn irq_init() {

}
Expand Down
8 changes: 8 additions & 0 deletions drivers/rpi/src/rpi2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ pub mod registers;
pub mod mb;
pub mod uart;

#[no_mangle]
pub extern "C" fn device_init() -> (Result<(), &'static str>, &'static str) {
let mut pi = Rpi2::new();
pi.init();

return (Ok(()), "RPi 2");
}

extern "C" {
static mut BOARD: Board;
fn rpi2_kernel_init();
Expand Down
11 changes: 11 additions & 0 deletions drivers/rpi/src/rpi3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ use mailbox::MailBox;
pub mod gpio;
pub mod led;

#[no_mangle]
// #[export_name = "device_init"]
pub extern "C" fn device_init() -> (Result<(), &'static str>, &'static str) {
let mut pi = Rpi3::new();
pi.init();

if pi.error.0 {
return (Err(pi.error.1), "RPi 3");
} else { return (Ok(()), "RPi 3"); }
}

pub struct Rpi3 {
pub error: (bool, &'static str),
pub gpio: gpio::Rpi3Gpio,
Expand Down

0 comments on commit 3eb7212

Please sign in to comment.