fpga: Deny access to the SPI master in app mode

Co-authored-by: Mikael Ågren <mikael@tillitis.se>
This commit is contained in:
Daniel Jobson 2024-11-13 16:13:16 +01:00 committed by Mikael Ågren
parent 4363637afa
commit d1abaad5da
No known key found for this signature in database
GPG Key ID: E02DA3D397792C46

View File

@ -521,8 +521,8 @@ module tk1 #(
spi_start = 1'h0;
spi_tx_data_vld = 1'h0;
spi_enable = write_data[0];
spi_tx_data = write_data[7 : 0];
spi_enable = write_data[0] & !app_mode;
spi_tx_data = write_data[7 : 0] & {8{!app_mode}};
if (cs) begin
tmp_ready = 1'h1;
@ -587,16 +587,22 @@ module tk1 #(
end
if (address == ADDR_SPI_EN) begin
if (!app_mode) begin
spi_enable_vld = 1'h1;
end
end
if (address == ADDR_SPI_XFER) begin
if (!app_mode) begin
spi_start = 1'h1;
end
end
if (address == ADDR_SPI_DATA) begin
if (!app_mode) begin
spi_tx_data_vld = 1'h1;
end
end
end
else begin
@ -643,12 +649,16 @@ module tk1 #(
end
if (address == ADDR_SPI_XFER) begin
if (!app_mode) begin
tmp_read_data[0] = spi_ready;
end
end
if (address == ADDR_SPI_DATA) begin
if (!app_mode) begin
tmp_read_data[7 : 0] = spi_rx_data;
end
end
end
end