|
|
|
@ -8,12 +8,14 @@ pub struct Soc {
@@ -8,12 +8,14 @@ pub struct Soc {
|
|
|
|
|
|
|
|
|
|
impl Soc { |
|
|
|
|
pub fn init() -> ::Result<Soc> { |
|
|
|
|
const SOC_MEM_SIZE: usize = 0x100000; |
|
|
|
|
Soc::init_with_buffer_size(0x100000) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn init_with_buffer_size(num_bytes: usize) -> ::Result<Soc> { |
|
|
|
|
unsafe { |
|
|
|
|
let soc_mem = memalign(0x1000, SOC_MEM_SIZE) as *mut u32; |
|
|
|
|
let soc_mem = memalign(0x1000, num_bytes) as *mut u32; |
|
|
|
|
|
|
|
|
|
let r = socInit(soc_mem, SOC_MEM_SIZE as u32); |
|
|
|
|
let r = socInit(soc_mem, num_bytes as u32); |
|
|
|
|
if r < 0 { |
|
|
|
|
Err(r.into()) |
|
|
|
|
} else { |
|
|
|
|