/** * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. * * SPDX-License-Identifier: BSD-3-Clause */ #include #include "pico/stdlib.h" #include "SPIBone/SPIBone.h" #include "helpers.h" #include "rust_hal_types.h" periph_status_states PERIPHERALS_STATUS = PERIPH_STATUS_STATES_UNKNOWN; int main() { stdio_init_all(); // stellar_spi * handle; ext_clock * clk; int clk_ret = si_init(&clk); // Must come after Rust code, because Rust code will reinit SIO. gpio_init(GPIO_FPGA_SPI_CS); gpio_put(GPIO_FPGA_SPI_CS, 1); gpio_set_dir(GPIO_FPGA_SPI_CS, GPIO_OUT); sleep_ms(1000); if(clk_ret == EXT_CLOCK_ERROR_SUCCESS) { printf("Hardware init okay.\n"); } clk_ret = si_start(clk, 33333333); printf("si_start ret: %d\n", clk_ret); char buf[81] = { '\0' }; for(int i = 0; i < 80; i++) { uint32_t data; spi_bone_read32_blocking(0x00000800 + i*4, &data, 1); buf[i] = (char) data; } printf("Read data: %s", buf); while(true) { } return 0; }