mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
refactor spim divider equation to reflect reality
This commit is contained in:
parent
12327ab255
commit
0f79056ac7
4 changed files with 7 additions and 7 deletions
|
|
@ -819,7 +819,7 @@ impl Spim {
|
||||||
.expect("couldn't map serial port");
|
.expect("couldn't map serial port");
|
||||||
let csr = CSR::new(csr_range.as_mut_ptr() as *mut u32);
|
let csr = CSR::new(csr_range.as_mut_ptr() as *mut u32);
|
||||||
|
|
||||||
let clk_div = sys_clk_freq / spi_clk_freq;
|
let clk_div = sys_clk_freq / (2 * spi_clk_freq);
|
||||||
// make this a hard panic -- you'll find out at runtime that you f'd up
|
// make this a hard panic -- you'll find out at runtime that you f'd up
|
||||||
// but at least you find out.
|
// but at least you find out.
|
||||||
assert!(clk_div < 256, "SPI clock divider is out of range");
|
assert!(clk_div < 256, "SPI clock divider is out of range");
|
||||||
|
|
@ -902,7 +902,7 @@ impl Spim {
|
||||||
#[cfg(not(target_os = "xous"))]
|
#[cfg(not(target_os = "xous"))]
|
||||||
let csr = CSR::new(base_addr as *mut u32);
|
let csr = CSR::new(base_addr as *mut u32);
|
||||||
|
|
||||||
let clk_div = sys_clk_freq / spi_clk_freq;
|
let clk_div = sys_clk_freq / (2 * spi_clk_freq);
|
||||||
// make this a hard panic -- you'll find out at runtime that you f'd up
|
// make this a hard panic -- you'll find out at runtime that you f'd up
|
||||||
// but at least you find out.
|
// but at least you find out.
|
||||||
assert!(clk_div < 256, "SPI clock divider is out of range");
|
assert!(clk_div < 256, "SPI clock divider is out of range");
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,7 @@ pub fn early_init() {
|
||||||
let mut flash_spim = unsafe {
|
let mut flash_spim = unsafe {
|
||||||
Spim::new_with_ifram(
|
Spim::new_with_ifram(
|
||||||
channel,
|
channel,
|
||||||
50_000_000,
|
25_000_000,
|
||||||
50_000_000,
|
50_000_000,
|
||||||
SpimClkPol::LeadingEdgeRise,
|
SpimClkPol::LeadingEdgeRise,
|
||||||
SpimClkPha::CaptureOnLeading,
|
SpimClkPha::CaptureOnLeading,
|
||||||
|
|
@ -445,7 +445,7 @@ pub fn early_init() {
|
||||||
let mut ram_spim = unsafe {
|
let mut ram_spim = unsafe {
|
||||||
Spim::new_with_ifram(
|
Spim::new_with_ifram(
|
||||||
channel,
|
channel,
|
||||||
50_000_000,
|
25_000_000,
|
||||||
50_000_000,
|
50_000_000,
|
||||||
SpimClkPol::LeadingEdgeRise,
|
SpimClkPol::LeadingEdgeRise,
|
||||||
SpimClkPha::CaptureOnLeading,
|
SpimClkPha::CaptureOnLeading,
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ impl SwapHal {
|
||||||
let mut flash_spim = unsafe {
|
let mut flash_spim = unsafe {
|
||||||
Spim::new_with_ifram(
|
Spim::new_with_ifram(
|
||||||
channel,
|
channel,
|
||||||
50_000_000,
|
25_000_000,
|
||||||
50_000_000,
|
50_000_000,
|
||||||
SpimClkPol::LeadingEdgeRise,
|
SpimClkPol::LeadingEdgeRise,
|
||||||
SpimClkPha::CaptureOnLeading,
|
SpimClkPha::CaptureOnLeading,
|
||||||
|
|
@ -210,7 +210,7 @@ impl SwapHal {
|
||||||
let mut ram_spim = unsafe {
|
let mut ram_spim = unsafe {
|
||||||
Spim::new_with_ifram(
|
Spim::new_with_ifram(
|
||||||
channel,
|
channel,
|
||||||
50_000_000,
|
25_000_000,
|
||||||
50_000_000,
|
50_000_000,
|
||||||
SpimClkPol::LeadingEdgeRise,
|
SpimClkPol::LeadingEdgeRise,
|
||||||
SpimClkPha::CaptureOnLeading,
|
SpimClkPha::CaptureOnLeading,
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ impl SwapHal {
|
||||||
ram_spim: unsafe {
|
ram_spim: unsafe {
|
||||||
Spim::new_with_ifram(
|
Spim::new_with_ifram(
|
||||||
channel,
|
channel,
|
||||||
50_000_000,
|
25_000_000,
|
||||||
50_000_000,
|
50_000_000,
|
||||||
SpimClkPol::LeadingEdgeRise,
|
SpimClkPol::LeadingEdgeRise,
|
||||||
SpimClkPha::CaptureOnLeading,
|
SpimClkPha::CaptureOnLeading,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue