Fix 2 more bitbang drivers.
Change-Id: Ib7257d1d113871a9f57ba3b899cb029bb595035a
This commit is contained in:
parent
26fadc7ef7
commit
fe8a1f8c58
|
@ -33,14 +33,14 @@ static int clock_count; /* count clocks in any stable state, only stable states
|
|||
|
||||
static uint32_t dummy_data;
|
||||
|
||||
static int dummy_read(void)
|
||||
static bb_value_t dummy_read(void)
|
||||
{
|
||||
int data = 1 & dummy_data;
|
||||
dummy_data = (dummy_data >> 1) | (1 << 31);
|
||||
return data;
|
||||
return data ? BB_HIGH : BB_LOW;
|
||||
}
|
||||
|
||||
static void dummy_write(int tck, int tms, int tdi)
|
||||
static int dummy_write(int tck, int tms, int tdi)
|
||||
{
|
||||
/* TAP standard: "state transitions occur on rising edge of clock" */
|
||||
if (tck != dummy_clock) {
|
||||
|
@ -69,9 +69,10 @@ static void dummy_write(int tck, int tms, int tdi)
|
|||
}
|
||||
dummy_clock = tck;
|
||||
}
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static void dummy_reset(int trst, int srst)
|
||||
static int dummy_reset(int trst, int srst)
|
||||
{
|
||||
dummy_clock = 0;
|
||||
|
||||
|
@ -79,10 +80,12 @@ static void dummy_reset(int trst, int srst)
|
|||
dummy_state = TAP_RESET;
|
||||
|
||||
LOG_DEBUG("reset to: %s", tap_state_name(dummy_state));
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static void dummy_led(int on)
|
||||
static int dummy_led(int on)
|
||||
{
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static struct bitbang_interface dummy_bitbang = {
|
||||
|
|
|
@ -244,7 +244,7 @@ static void sysfsgpio_swdio_write(int swclk, int swdio)
|
|||
* The sysfs value will read back either '0' or '1'. The trick here is to call
|
||||
* lseek to bypass buffering in the sysfs kernel driver.
|
||||
*/
|
||||
static int sysfsgpio_read(void)
|
||||
static bb_value_t sysfsgpio_read(void)
|
||||
{
|
||||
char buf[1];
|
||||
|
||||
|
@ -257,7 +257,7 @@ static int sysfsgpio_read(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
return buf[0] != '0';
|
||||
return buf[0] == '0' ? BB_LOW : BB_HIGH;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -266,11 +266,11 @@ static int sysfsgpio_read(void)
|
|||
* Seeing as this is the only function where the outputs are changed,
|
||||
* we can cache the old value to avoid needlessly writing it.
|
||||
*/
|
||||
static void sysfsgpio_write(int tck, int tms, int tdi)
|
||||
static int sysfsgpio_write(int tck, int tms, int tdi)
|
||||
{
|
||||
if (swd_mode) {
|
||||
sysfsgpio_swdio_write(tck, tdi);
|
||||
return;
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
const char one[] = "1";
|
||||
|
@ -312,6 +312,8 @@ static void sysfsgpio_write(int tck, int tms, int tdi)
|
|||
last_tdi = tdi;
|
||||
last_tms = tms;
|
||||
last_tck = tck;
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -319,7 +321,7 @@ static void sysfsgpio_write(int tck, int tms, int tdi)
|
|||
*
|
||||
* (1) assert or (0) deassert reset lines
|
||||
*/
|
||||
static void sysfsgpio_reset(int trst, int srst)
|
||||
static int sysfsgpio_reset(int trst, int srst)
|
||||
{
|
||||
LOG_DEBUG("sysfsgpio_reset");
|
||||
const char one[] = "1";
|
||||
|
@ -339,6 +341,8 @@ static void sysfsgpio_reset(int trst, int srst)
|
|||
if (bytes_written != 1)
|
||||
LOG_WARNING("writing trst failed");
|
||||
}
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(sysfsgpio_handle_jtag_gpionums)
|
||||
|
|
Loading…
Reference in New Issue