diff options
author | Piotr Esden-Tempski <piotr@esden.net> | 2018-12-24 09:36:37 +0100 |
---|---|---|
committer | Piotr Esden-Tempski <piotr@esden.net> | 2018-12-24 09:36:37 +0100 |
commit | 8d9fa0fc778a1194dd527e63245f3002aca9a666 (patch) | |
tree | 6e111456cc208f5d0be739fadad6ab70e71f3eab /iceprog/mpsse.c | |
parent | 61bc31bbdc359571e4315e197dbee9b00d739aac (diff) | |
download | icestorm-8d9fa0fc778a1194dd527e63245f3002aca9a666.tar.gz icestorm-8d9fa0fc778a1194dd527e63245f3002aca9a666.tar.bz2 icestorm-8d9fa0fc778a1194dd527e63245f3002aca9a666.zip |
Split the hardware specific gpio functions.
Diffstat (limited to 'iceprog/mpsse.c')
-rw-r--r-- | iceprog/mpsse.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/iceprog/mpsse.c b/iceprog/mpsse.c index c26fce3..80d462f 100644 --- a/iceprog/mpsse.c +++ b/iceprog/mpsse.c @@ -231,34 +231,28 @@ uint8_t mpsse_xfer_spi_bits(uint8_t data, int n) return mpsse_recv_byte(); } -void mpsse_set_gpio(int slavesel_b, int creset_b) +void mpsse_set_gpio(uint8_t gpio, uint8_t direction) { - uint8_t gpio = 0; - - if (slavesel_b) { - // ADBUS4 (GPIOL0) - gpio |= 0x10; - } - - if (creset_b) { - // ADBUS7 (GPIOL3) - gpio |= 0x80; - } - mpsse_send_byte(MC_SETB_LOW); mpsse_send_byte(gpio); /* Value */ - mpsse_send_byte(0x93); /* Direction */ + mpsse_send_byte(direction); /* Direction */ } -int mpsse_get_cdone() +int mpsse_readb_low(void) { uint8_t data; mpsse_send_byte(MC_READB_LOW); data = mpsse_recv_byte(); - // ADBUS6 (GPIOL2) - return (data & 0x40) != 0; + return data; } +int mpsse_readb_high(void) +{ + uint8_t data; + mpsse_send_byte(MC_READB_HIGH); + data = mpsse_recv_byte(); + return data; +} void mpsse_send_dummy_bytes(uint8_t n) { |