mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-03-12 18:16:55 -04:00
fpga: Deny access to the SPI master in app mode
Co-authored-by: Mikael Ågren <mikael@tillitis.se>
This commit is contained in:
parent
4363637afa
commit
d1abaad5da
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user