mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-08-07 14:12:34 -04:00
Deny access to the SPI master in app mode
Co-authored-by: Mikael Ågren <mikael@tillitis.se>
This commit is contained in:
parent
8c6ab6902d
commit
9062b49804
1 changed files with 17 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue