aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/zpu
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-03-07 19:15:10 -0800
committerJosh Blum <josh@joshknows.com>2012-03-23 14:36:56 -0700
commitf3f64abc49e20723dd00f0ecc5201f015d4744c3 (patch)
tree07df5e783e15392e213fac28ada840beafddac14 /firmware/zpu
parent672a77767faf0070e94de0c8acd74328a301cae5 (diff)
downloaduhd-f3f64abc49e20723dd00f0ecc5201f015d4744c3.tar.gz
uhd-f3f64abc49e20723dd00f0ecc5201f015d4744c3.tar.bz2
uhd-f3f64abc49e20723dd00f0ecc5201f015d4744c3.zip
fifo ctrl: various tweaks
Diffstat (limited to 'firmware/zpu')
-rw-r--r--firmware/zpu/lib/spi.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/zpu/lib/spi.c b/firmware/zpu/lib/spi.c
index 190658d61..6f2f74899 100644
--- a/firmware/zpu/lib/spi.c
+++ b/firmware/zpu/lib/spi.c
@@ -42,11 +42,14 @@ uint32_t spi_transact(bool readback, int slave, uint32_t data, int length, uint3
if ((flags & SPI_LATCH_RISE) != 0) control_word |= (1 << SPI_CORE_DATA_IN_EDGE_SHIFT);
if ((flags & SPI_LATCH_FALL) != 0) control_word |= (0 << SPI_CORE_DATA_IN_EDGE_SHIFT);
+ const uint32_t data_out = data << (32 - length);
+
spi_wait();
spi_core->control = control_word;
- spi_core->data = (data << (32 - length));
+ spi_core->data = data_out;
- if (readback) spi_wait();
+ if (!readback) return 0;
+ spi_wait();
return readback_mux->spi;
}