Compare commits
No commits in common. "500472b2a8404f9dc2c2c9f23578cf5194db80ce" and "0e8354faa1e2f9e41cb7bd9bb64b2b8b5db150bd" have entirely different histories.
500472b2a8
...
0e8354faa1
|
@ -36,7 +36,7 @@ let
|
||||||
"${target}-experiments" = build-crate "${target}-experiments" "experiments" "target_${target}" cargoSha256Experiments;
|
"${target}-experiments" = build-crate "${target}-experiments" "experiments" "target_${target}" cargoSha256Experiments;
|
||||||
"${target}-szl" = build-crate "${target}-szl" "szl" "target_${target}" cargoSha256SZL;
|
"${target}-szl" = build-crate "${target}-szl" "szl" "target_${target}" cargoSha256SZL;
|
||||||
};
|
};
|
||||||
targets = ["zc706" "coraz7" "redpitaya" "kasli_soc"];
|
targets = ["zc706" "coraz7" "redpitaya"];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit cargo-xbuild;
|
inherit cargo-xbuild;
|
||||||
|
|
|
@ -9,7 +9,6 @@ edition = "2018"
|
||||||
target_zc706 = ["libboard_zynq/target_zc706", "libsupport_zynq/target_zc706"]
|
target_zc706 = ["libboard_zynq/target_zc706", "libsupport_zynq/target_zc706"]
|
||||||
target_coraz7 = ["libboard_zynq/target_coraz7", "libsupport_zynq/target_coraz7"]
|
target_coraz7 = ["libboard_zynq/target_coraz7", "libsupport_zynq/target_coraz7"]
|
||||||
target_redpitaya = ["libboard_zynq/target_redpitaya", "libsupport_zynq/target_redpitaya"]
|
target_redpitaya = ["libboard_zynq/target_redpitaya", "libsupport_zynq/target_redpitaya"]
|
||||||
target_kasli_soc = ["libboard_zynq/target_kasli_soc", "libsupport_zynq/target_kasli_soc"]
|
|
||||||
default = ["target_zc706"]
|
default = ["target_zc706"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
@ -105,20 +105,31 @@ pub fn main_core0() {
|
||||||
.boot_mode_pins()
|
.boot_mode_pins()
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(feature = "target_zc706")]
|
||||||
feature = "target_zc706",
|
|
||||||
feature = "target_redpitaya",
|
|
||||||
feature = "target_kasli_soc",
|
|
||||||
))]
|
|
||||||
const CPU_FREQ: u32 = 800_000_000;
|
const CPU_FREQ: u32 = 800_000_000;
|
||||||
#[cfg(feature = "target_coraz7")]
|
#[cfg(feature = "target_coraz7")]
|
||||||
const CPU_FREQ: u32 = 650_000_000;
|
const CPU_FREQ: u32 = 650_000_000;
|
||||||
|
#[cfg(feature = "target_redpitaya")]
|
||||||
|
const CPU_FREQ: u32 = 800_000_000;
|
||||||
|
|
||||||
info!("Setup clock sources...");
|
info!("Setup clock sources...");
|
||||||
ArmPll::setup(2 * CPU_FREQ);
|
ArmPll::setup(2 * CPU_FREQ);
|
||||||
Clocks::set_cpu_freq(CPU_FREQ);
|
Clocks::set_cpu_freq(CPU_FREQ);
|
||||||
|
#[cfg(feature = "target_zc706")]
|
||||||
|
{
|
||||||
IoPll::setup(1_000_000_000);
|
IoPll::setup(1_000_000_000);
|
||||||
libboard_zynq::stdio::drop_uart();
|
libboard_zynq::stdio::drop_uart();
|
||||||
|
}
|
||||||
|
#[cfg(feature = "target_coraz7")]
|
||||||
|
{
|
||||||
|
IoPll::setup(1_000_000_000);
|
||||||
|
libboard_zynq::stdio::drop_uart();
|
||||||
|
}
|
||||||
|
#[cfg(feature = "target_redpitaya")]
|
||||||
|
{
|
||||||
|
IoPll::setup(1_000_000_000);
|
||||||
|
libboard_zynq::stdio::drop_uart();
|
||||||
|
}
|
||||||
info!("PLLs set up");
|
info!("PLLs set up");
|
||||||
let clocks = zynq::clocks::Clocks::get();
|
let clocks = zynq::clocks::Clocks::get();
|
||||||
info!(
|
info!(
|
||||||
|
|
|
@ -9,7 +9,6 @@ edition = "2018"
|
||||||
target_zc706 = []
|
target_zc706 = []
|
||||||
target_coraz7 = []
|
target_coraz7 = []
|
||||||
target_redpitaya = []
|
target_redpitaya = []
|
||||||
target_kasli_soc = []
|
|
||||||
ipv6 = [ "smoltcp/proto-ipv6" ]
|
ipv6 = [ "smoltcp/proto-ipv6" ]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
@ -8,8 +8,6 @@ pub const PS_CLK: u32 = 33_333_333;
|
||||||
pub const PS_CLK: u32 = 50_000_000;
|
pub const PS_CLK: u32 = 50_000_000;
|
||||||
#[cfg(feature = "target_redpitaya")]
|
#[cfg(feature = "target_redpitaya")]
|
||||||
pub const PS_CLK: u32 = 33_333_333;
|
pub const PS_CLK: u32 = 33_333_333;
|
||||||
#[cfg(feature = "target_kasli_soc")]
|
|
||||||
pub const PS_CLK: u32 = 33_333_333;
|
|
||||||
|
|
||||||
/// (pll_fdiv_max, (pll_cp, pll_res, lock_cnt))
|
/// (pll_fdiv_max, (pll_cp, pll_res, lock_cnt))
|
||||||
const PLL_FDIV_LOCK_PARAM: &[(u16, (u8, u8, u16))] = &[
|
const PLL_FDIV_LOCK_PARAM: &[(u16, (u8, u8, u16))] = &[
|
||||||
|
|
|
@ -20,11 +20,8 @@ const DDR_FREQ: u32 = 525_000_000;
|
||||||
/// Alliance Memory AS4C256M16D3B: 800 MHz DDR3 at 533 MHz
|
/// Alliance Memory AS4C256M16D3B: 800 MHz DDR3 at 533 MHz
|
||||||
const DDR_FREQ: u32 = 533_333_333;
|
const DDR_FREQ: u32 = 533_333_333;
|
||||||
|
|
||||||
#[cfg(feature = "target_kasli_soc")]
|
/// MT41K256M16HA-125
|
||||||
/// MT41K256M16HA-125:E: 800 MHz DDR3L at 533 MHz
|
const DCI_FREQ: u32 = 10_000_000;
|
||||||
const DDR_FREQ: u32 = 533_333_333;
|
|
||||||
|
|
||||||
const DCI_MAX_FREQ: u32 = 10_000_000;
|
|
||||||
|
|
||||||
pub struct DdrRam {
|
pub struct DdrRam {
|
||||||
regs: &'static mut regs::RegisterBlock,
|
regs: &'static mut regs::RegisterBlock,
|
||||||
|
@ -64,7 +61,7 @@ impl DdrRam {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn calculate_dci_divisors(clocks: &Clocks) -> (u8, u8) {
|
fn calculate_dci_divisors(clocks: &Clocks) -> (u8, u8) {
|
||||||
let target = (DCI_MAX_FREQ - 1 + clocks.ddr) / DCI_MAX_FREQ;
|
let target = (DCI_FREQ - 1 + clocks.ddr) / DCI_FREQ;
|
||||||
|
|
||||||
let mut best = None;
|
let mut best = None;
|
||||||
let mut best_error = 0;
|
let mut best_error = 0;
|
||||||
|
@ -147,13 +144,13 @@ impl DdrRam {
|
||||||
.output_en(slcr::DdriobOutputEn::Obuf);
|
.output_en(slcr::DdriobOutputEn::Obuf);
|
||||||
#[cfg(feature = "target_zc706")]
|
#[cfg(feature = "target_zc706")]
|
||||||
let data1_config = data0_config.clone();
|
let data1_config = data0_config.clone();
|
||||||
#[cfg(any(feature = "target_coraz7", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_coraz7")]
|
||||||
let data0_config = slcr::DdriobConfig::zeroed()
|
let data0_config = slcr::DdriobConfig::zeroed()
|
||||||
.inp_type(slcr::DdriobInputType::VrefDifferential)
|
.inp_type(slcr::DdriobInputType::VrefDifferential)
|
||||||
.term_en(true)
|
.term_en(true)
|
||||||
.dci_type(slcr::DdriobDciType::Termination)
|
.dci_type(slcr::DdriobDciType::Termination)
|
||||||
.output_en(slcr::DdriobOutputEn::Obuf);
|
.output_en(slcr::DdriobOutputEn::Obuf);
|
||||||
#[cfg(any(feature = "target_coraz7", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_coraz7")]
|
||||||
let data1_config = slcr::DdriobConfig::zeroed()
|
let data1_config = slcr::DdriobConfig::zeroed()
|
||||||
.pullup_en(true);
|
.pullup_en(true);
|
||||||
#[cfg(feature = "target_redpitaya")]
|
#[cfg(feature = "target_redpitaya")]
|
||||||
|
@ -176,13 +173,13 @@ impl DdrRam {
|
||||||
.output_en(slcr::DdriobOutputEn::Obuf);
|
.output_en(slcr::DdriobOutputEn::Obuf);
|
||||||
#[cfg(feature = "target_zc706")]
|
#[cfg(feature = "target_zc706")]
|
||||||
let diff1_config = diff0_config.clone();
|
let diff1_config = diff0_config.clone();
|
||||||
#[cfg(any(feature = "target_coraz7", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_coraz7")]
|
||||||
let diff0_config = slcr::DdriobConfig::zeroed()
|
let diff0_config = slcr::DdriobConfig::zeroed()
|
||||||
.inp_type(slcr::DdriobInputType::Differential)
|
.inp_type(slcr::DdriobInputType::Differential)
|
||||||
.term_en(true)
|
.term_en(true)
|
||||||
.dci_type(slcr::DdriobDciType::Termination)
|
.dci_type(slcr::DdriobDciType::Termination)
|
||||||
.output_en(slcr::DdriobOutputEn::Obuf);
|
.output_en(slcr::DdriobOutputEn::Obuf);
|
||||||
#[cfg(any(feature = "target_coraz7", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_coraz7")]
|
||||||
let diff1_config = slcr::DdriobConfig::zeroed()
|
let diff1_config = slcr::DdriobConfig::zeroed()
|
||||||
.pullup_en(true);
|
.pullup_en(true);
|
||||||
#[cfg(feature = "target_redpitaya")]
|
#[cfg(feature = "target_redpitaya")]
|
||||||
|
@ -210,7 +207,7 @@ impl DdrRam {
|
||||||
slcr.ddriob_drive_slew_clock.write(0x00F9861C);
|
slcr.ddriob_drive_slew_clock.write(0x00F9861C);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "target_coraz7", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_coraz7")]
|
||||||
slcr.ddriob_ddr_ctrl.modify(|_, w| w
|
slcr.ddriob_ddr_ctrl.modify(|_, w| w
|
||||||
.vref_int_en(false)
|
.vref_int_en(false)
|
||||||
.vref_ext_en_lower(true)
|
.vref_ext_en_lower(true)
|
||||||
|
@ -235,7 +232,7 @@ impl DdrRam {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self) {
|
fn configure(&mut self) {
|
||||||
#[cfg(any(feature = "target_coraz7", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_coraz7")]
|
||||||
self.regs.dram_param0.write(
|
self.regs.dram_param0.write(
|
||||||
regs::DramParam0::zeroed()
|
regs::DramParam0::zeroed()
|
||||||
.t_rc(0x1a)
|
.t_rc(0x1a)
|
||||||
|
@ -298,11 +295,11 @@ impl DdrRam {
|
||||||
.emr(0x4)
|
.emr(0x4)
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(any(feature = "target_coraz7", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_coraz7")]
|
||||||
self.regs.phy_configs[2].modify(
|
self.regs.phy_configs[2].modify(
|
||||||
|_, w| w.data_slice_in_use(false)
|
|_, w| w.data_slice_in_use(false)
|
||||||
);
|
);
|
||||||
#[cfg(any(feature = "target_coraz7", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_coraz7")]
|
||||||
self.regs.phy_configs[3].modify(
|
self.regs.phy_configs[3].modify(
|
||||||
|_, w| w.data_slice_in_use(false)
|
|_, w| w.data_slice_in_use(false)
|
||||||
);
|
);
|
||||||
|
@ -354,7 +351,7 @@ impl DdrRam {
|
||||||
.gatelvl_init_ratio(0xee)
|
.gatelvl_init_ratio(0xee)
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(any(feature = "target_coraz7", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_coraz7")]
|
||||||
self.regs.reg_64.modify(
|
self.regs.reg_64.modify(
|
||||||
|_, w| w
|
|_, w| w
|
||||||
.phy_ctrl_slave_ratio(0x100)
|
.phy_ctrl_slave_ratio(0x100)
|
||||||
|
@ -390,7 +387,7 @@ impl DdrRam {
|
||||||
fn reset_ddrc<F: FnMut(&mut Self)>(&mut self, mut f: F) {
|
fn reset_ddrc<F: FnMut(&mut Self)>(&mut self, mut f: F) {
|
||||||
#[cfg(feature = "target_zc706")]
|
#[cfg(feature = "target_zc706")]
|
||||||
let width = regs::DataBusWidth::Width32bit;
|
let width = regs::DataBusWidth::Width32bit;
|
||||||
#[cfg(any(feature = "target_coraz7", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_coraz7")]
|
||||||
let width = regs::DataBusWidth::Width16bit;
|
let width = regs::DataBusWidth::Width16bit;
|
||||||
#[cfg(feature = "target_redpitaya")]
|
#[cfg(feature = "target_redpitaya")]
|
||||||
let width = regs::DataBusWidth::Width16bit;
|
let width = regs::DataBusWidth::Width16bit;
|
||||||
|
@ -408,11 +405,7 @@ impl DdrRam {
|
||||||
self.regs.dram_addr_map_col.write(0xFFF00000);
|
self.regs.dram_addr_map_col.write(0xFFF00000);
|
||||||
self.regs.dram_addr_map_row.write(0x0F666666);
|
self.regs.dram_addr_map_row.write(0x0F666666);
|
||||||
}
|
}
|
||||||
#[cfg(any(
|
#[cfg(any(feature = "target_coraz7", feature = "target_redpitaya"))]
|
||||||
feature = "target_coraz7",
|
|
||||||
feature = "target_redpitaya",
|
|
||||||
feature = "target_kasli_soc",
|
|
||||||
))]
|
|
||||||
unsafe {
|
unsafe {
|
||||||
// row/column address bits
|
// row/column address bits
|
||||||
self.regs.dram_addr_map_bank.write(0x00000666);
|
self.regs.dram_addr_map_bank.write(0x00000666);
|
||||||
|
@ -444,11 +437,9 @@ impl DdrRam {
|
||||||
// filtering address map
|
// filtering address map
|
||||||
#[cfg(feature = "target_zc706")]
|
#[cfg(feature = "target_zc706")]
|
||||||
let megabytes = 1023;
|
let megabytes = 1023;
|
||||||
#[cfg(any(
|
#[cfg(feature = "target_coraz7")]
|
||||||
feature = "target_coraz7",
|
let megabytes = 512;
|
||||||
feature = "target_redpitaya",
|
#[cfg(feature = "target_redpitaya")]
|
||||||
feature = "target_kasli_soc",
|
|
||||||
))]
|
|
||||||
let megabytes = 512;
|
let megabytes = 512;
|
||||||
|
|
||||||
megabytes * 1024 * 1024
|
megabytes * 1024 * 1024
|
||||||
|
|
|
@ -117,7 +117,7 @@ impl Sdio {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// redpitaya card detect pin
|
// redpitaya card detect pin
|
||||||
#[cfg(any(feature = "target_redpitaya", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_redpitaya")]
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
slcr.sd0_wp_cd_sel.write(46 << 16);
|
slcr.sd0_wp_cd_sel.write(46 << 16);
|
||||||
|
|
|
@ -47,7 +47,7 @@ impl DerefMut for LazyUart {
|
||||||
LazyUart::Uninitialized => {
|
LazyUart::Uninitialized => {
|
||||||
#[cfg(any(feature = "target_coraz7", feature = "target_redpitaya"))]
|
#[cfg(any(feature = "target_coraz7", feature = "target_redpitaya"))]
|
||||||
let uart = Uart::uart0(UART_RATE);
|
let uart = Uart::uart0(UART_RATE);
|
||||||
#[cfg(any(feature = "target_zc706", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_zc706")]
|
||||||
let uart = Uart::uart1(UART_RATE);
|
let uart = Uart::uart1(UART_RATE);
|
||||||
*self = LazyUart::Initialized(uart);
|
*self = LazyUart::Initialized(uart);
|
||||||
self
|
self
|
||||||
|
|
|
@ -46,7 +46,7 @@ impl Uart {
|
||||||
self_
|
self_
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "target_zc706", feature = "target_kasli_soc"))]
|
#[cfg(feature = "target_zc706")]
|
||||||
pub fn uart1(baudrate: u32) -> Self {
|
pub fn uart1(baudrate: u32) -> Self {
|
||||||
slcr::RegisterBlock::unlocked(|slcr| {
|
slcr::RegisterBlock::unlocked(|slcr| {
|
||||||
// Route UART 1 RxD/TxD Signals to MIO Pins
|
// Route UART 1 RxD/TxD Signals to MIO Pins
|
||||||
|
|
|
@ -14,5 +14,4 @@ log = "0.4"
|
||||||
target_zc706 = []
|
target_zc706 = []
|
||||||
target_coraz7 = []
|
target_coraz7 = []
|
||||||
target_redpitaya = []
|
target_redpitaya = []
|
||||||
target_kasli_soc = []
|
|
||||||
ipv6 = []
|
ipv6 = []
|
||||||
|
|
|
@ -43,10 +43,6 @@ pub fn get_adresses(cfg: &Config) -> NetAddresses {
|
||||||
let mut hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x55]);
|
let mut hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x55]);
|
||||||
#[cfg(feature = "target_redpitaya")]
|
#[cfg(feature = "target_redpitaya")]
|
||||||
let mut ipv4_addr = IpAddress::v4(192, 168, 1, 55);
|
let mut ipv4_addr = IpAddress::v4(192, 168, 1, 55);
|
||||||
#[cfg(feature = "target_kasli_soc")]
|
|
||||||
let mut hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x56]);
|
|
||||||
#[cfg(feature = "target_kasli_soc")]
|
|
||||||
let mut ipv4_addr = IpAddress::v4(192, 168, 1, 56);
|
|
||||||
|
|
||||||
if let Ok(Ok(addr)) = cfg.read_str("mac").map(|s| s.parse()) {
|
if let Ok(Ok(addr)) = cfg.read_str("mac").map(|s| s.parse()) {
|
||||||
hardware_addr = addr;
|
hardware_addr = addr;
|
||||||
|
|
|
@ -5,8 +5,11 @@ authors = ["M-Labs"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
target_zc706 = []
|
||||||
|
target_coraz7 = []
|
||||||
|
target_redpitaya = []
|
||||||
power_saving = []
|
power_saving = []
|
||||||
default = []
|
default = ["target_zc706"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bit_field = "0.10"
|
bit_field = "0.10"
|
||||||
|
|
|
@ -9,7 +9,6 @@ edition = "2018"
|
||||||
target_zc706 = ["libboard_zynq/target_zc706"]
|
target_zc706 = ["libboard_zynq/target_zc706"]
|
||||||
target_coraz7 = ["libboard_zynq/target_coraz7"]
|
target_coraz7 = ["libboard_zynq/target_coraz7"]
|
||||||
target_redpitaya = ["libboard_zynq/target_redpitaya"]
|
target_redpitaya = ["libboard_zynq/target_redpitaya"]
|
||||||
target_kasli_soc = ["libboard_zynq/target_kasli_soc"]
|
|
||||||
panic_handler = []
|
panic_handler = []
|
||||||
dummy_irq_handler = []
|
dummy_irq_handler = []
|
||||||
alloc_core = []
|
alloc_core = []
|
||||||
|
|
|
@ -9,7 +9,6 @@ edition = "2018"
|
||||||
target_zc706 = ["libboard_zynq/target_zc706", "libsupport_zynq/target_zc706", "libconfig/target_zc706"]
|
target_zc706 = ["libboard_zynq/target_zc706", "libsupport_zynq/target_zc706", "libconfig/target_zc706"]
|
||||||
target_coraz7 = ["libboard_zynq/target_coraz7", "libsupport_zynq/target_coraz7", "libconfig/target_coraz7"]
|
target_coraz7 = ["libboard_zynq/target_coraz7", "libsupport_zynq/target_coraz7", "libconfig/target_coraz7"]
|
||||||
target_redpitaya = ["libboard_zynq/target_redpitaya", "libsupport_zynq/target_redpitaya", "libconfig/target_redpitaya"]
|
target_redpitaya = ["libboard_zynq/target_redpitaya", "libsupport_zynq/target_redpitaya", "libconfig/target_redpitaya"]
|
||||||
target_kasli_soc = ["libboard_zynq/target_kasli_soc", "libsupport_zynq/target_kasli_soc", "libconfig/target_kasli_soc"]
|
|
||||||
default = ["target_zc706"]
|
default = ["target_zc706"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
Loading…
Reference in New Issue