From 7d1e12c870450f3570803b062ef9f099150525e3 Mon Sep 17 00:00:00 2001 From: Gabriel Somlo Date: Tue, 20 Jun 2023 13:26:30 -0400 Subject: [PATCH] software/liblitesata: update to multi-sector read, write The LiteSATA gateware now supports multi-sector transfers, and expects a sector count register to be populated by the software before a DMA transfer is initiated. This patch also fixes checks for `done` and `error` during writes by using the correct `mem2sector` read function (instead of `sector2mem`, which is for use during read operations). Signed-off-by: Gabriel Somlo --- litex/soc/software/liblitesata/sata.c | 43 +++++++++++---------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/litex/soc/software/liblitesata/sata.c b/litex/soc/software/liblitesata/sata.c index 9650593b5..fd3fd67de 100644 --- a/litex/soc/software/liblitesata/sata.c +++ b/litex/soc/software/liblitesata/sata.c @@ -100,20 +100,16 @@ int sata_init(int show) { void sata_read(uint32_t sector, uint32_t count, uint8_t* buf) { - uint32_t i; + uint8_t done = 0; - /* Write sectors */ - for (i=0; i