[En-Nut-Discussion] Bit banging drivers broken?
Harald Kipp
harald.kipp at egnite.de
Thu Oct 4 13:48:46 CEST 2012
Hello Uwe,
r4683 changed
#undef GPIO_ID
#define GPIO_ID MMC_CLK_PIO_ID
#include <cfg/arch/porttran.h>
static INLINE void MMC_CLK_LO(void) { GPIO_SET_LO(MMC_CLK_PIO_BIT); }
to
static INLINE void MMC_CLK_LO(void) { GpioPinSetLow
(MMC_CLK_PIO_ID, MMC_CLK_PIO_BIT); }
That doesn't look correct to me, because according to conf/dev/dev.nut
MMC_CLK_PIO_ID is
"Port ID of the clock line."
not the port address. I think this had been done to support
SbiMmcIfcInit()
which requires the ID to enable the PIO clock in PMC_PCER.
I think the same problem exists for dev/jtag_gpio0.c, where
#define JTAG0_TDO_PIO_ID PIO_ID
is defined in include/arch/arm/board/ethernut3.h and then used in
dev/jtag_gpio0.c
static INLINE int JTAG0_TDO_IS_ON(void) { return
GpioPinGet(JTAG0_TDO_PIO_ID, JTAG0_TDO_PIO_BIT); }
finally translated to
inr(PIO_ID + PIO_PDSR_OFF) & _BV(bit) ? 1 : 0
in include/dev/gpio_at91.h. For the AT91X40
#define PIO_ID 8
#define PIO_PDSR_OFF 0x0000003C
I'm not sure about the AVR32 and the Freescale branch.
Regards,
Harald
More information about the En-Nut-Discussion
mailing list