From cb1badb173b24a3fb8b8e53059fa219120a0889b Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 30 Oct 2020 15:38:17 +0100 Subject: [PATCH] software/liblitesata: add sata_write and update #ifdefs. --- litex/soc/software/liblitesata/sata.c | 45 ++++++++++++++++++++++----- litex/soc/software/liblitesata/sata.h | 17 ++++++++-- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/litex/soc/software/liblitesata/sata.c b/litex/soc/software/liblitesata/sata.c index e57052389..43ff0b22c 100644 --- a/litex/soc/software/liblitesata/sata.c +++ b/litex/soc/software/liblitesata/sata.c @@ -13,12 +13,12 @@ #include #include "sata.h" -#ifdef CSR_SATA_SECTOR2MEM_BASE - /*-----------------------------------------------------------------------*/ /* SATA user functions */ /*-----------------------------------------------------------------------*/ +#ifdef CSR_SATA_PHY_BASE + int sata_init(void) { uint16_t timeout; @@ -38,16 +38,20 @@ int sata_init(void) { return 0; } -void sata_read(uint32_t block, uint32_t count, uint8_t* buf) +#endif + +#ifdef CSR_SATA_SECTOR2MEM_BASE + +void sata_read(uint32_t sector, uint32_t count, uint8_t* buf) { uint32_t i; - /* Read blocks */ + /* Write sectors */ for (i=0; i -#ifdef CSR_SATA_SECTOR2MEM_BASE - /*-----------------------------------------------------------------------*/ /* SATA user functions */ /*-----------------------------------------------------------------------*/ +#ifdef CSR_SATA_PHY_BASE + int sata_init(void); + +#endif + +#ifdef CSR_SATA_SECTOR2MEM_BASE + void sata_read(uint32_t sector, uint32_t count, uint8_t* buf); -#endif /* CSR_SATA_BASE */ +#endif + +#ifdef CSR_SATA_MEM2SECTOR_BASE + +void sata_write(uint32_t sector, uint32_t count, uint8_t* buf); + +#endif #endif /* __SATA_H */