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_tx_data_vld = 1'h0;
spi_enable = write_data[0];
spi_tx_data = write_data[7 : 0];
spi_enable = write_data[0] & ~system_mode_reg;
spi_tx_data = write_data[7 : 0] & ~{8{system_mode_reg}};
if (cs) begin
tmp_ready = 1'h1;
@ -552,15 +552,21 @@ module tk1 #(
end
if (address == ADDR_SPI_EN) begin
spi_enable_vld = 1'h1;
if (!system_mode_reg) begin
spi_enable_vld = 1'h1;
end
end
if (address == ADDR_SPI_XFER) begin
spi_start = 1'h1;
if (!system_mode_reg) begin
spi_start = 1'h1;
end
end
if (address == ADDR_SPI_DATA) begin
spi_tx_data_vld = 1'h1;
if (!system_mode_reg) begin
spi_tx_data_vld = 1'h1;
end
end
end
@ -616,11 +622,15 @@ module tk1 #(
end
if (address == ADDR_SPI_XFER) begin
tmp_read_data[0] = spi_ready;
if (!system_mode_reg) begin
tmp_read_data[0] = spi_ready;
end
end
if (address == ADDR_SPI_DATA) begin
tmp_read_data[7 : 0] = spi_rx_data;
if (!system_mode_reg) begin
tmp_read_data[7 : 0] = spi_rx_data;
end
end
end