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
parent 8c6ab6902d
commit 9062b49804
No known key found for this signature in database
GPG key ID: 3707A9DBF4BB8F1A

View file

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