From 869d6b8d572f00229db23a13a6ac86301e440fe5 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 24 May 2009 20:40:11 +0000 Subject: [PATCH] Debug microSD CS git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1824 42af7a65-404d-4744-a932-0658087f49c3 --- arch/arm/src/lm3s/lm3s_dumpgpio.c | 2 +- arch/arm/src/lm3s/lm3s_ssi.c | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/arch/arm/src/lm3s/lm3s_dumpgpio.c b/arch/arm/src/lm3s/lm3s_dumpgpio.c index 766ad911b5..aed9d00e4b 100644 --- a/arch/arm/src/lm3s/lm3s_dumpgpio.c +++ b/arch/arm/src/lm3s/lm3s_dumpgpio.c @@ -141,7 +141,7 @@ int lm3s_dumpgpio(uint32 pinset, const char *msg) lldbg(" AFSEL: %02x DEN: %02x DIR: %02x DATA: %02x\n", getreg32(base + LM3S_GPIO_AFSEL_OFFSET), getreg32(base + LM3S_GPIO_DEN_OFFSET), getreg32(base + LM3S_GPIO_DIR_OFFSET), getreg32(base + LM3S_GPIO_DATA_OFFSET + 0x3fc)); - lldbg(" IS: %02x IBE: %02x IEV: %02x IM: %02x RIS: %02x MIS: %02x\n", + lldbg(" IS: %02x IBE: %02x IEV: %02x IM: %02x RIS: %08x MIS: %08x\n", getreg32(base + LM3S_GPIO_IEV_OFFSET), getreg32(base + LM3S_GPIO_IM_OFFSET), getreg32(base + LM3S_GPIO_RIS_OFFSET), getreg32(base + LM3S_GPIO_MIS_OFFSET)); lldbg(" 2MA: %02x 4MA: %02x 8MA: %02x ODR: %02x PUR %02x PDR: %02x SLR: %02x\n", diff --git a/arch/arm/src/lm3s/lm3s_ssi.c b/arch/arm/src/lm3s/lm3s_ssi.c index 7c91a07094..4b9386c8a3 100755 --- a/arch/arm/src/lm3s/lm3s_ssi.c +++ b/arch/arm/src/lm3s/lm3s_ssi.c @@ -64,7 +64,7 @@ * CONFIG_DEBUG_VERBOSE too) */ -#undef SSI_DEBUG /* Define to enable debug */ +#undef SSI_DEBUG /* Define to enable debug */ #ifdef SSI_DEBUG # define ssidbg lldbg @@ -426,12 +426,14 @@ static void ssi_semtake(sem_t *sem) static void ssi_txnull(struct lm32_ssidev_s *priv) { + ssivdbg("TX: ones\n"); ssi_putreg(priv, LM3S_SSI_DR_OFFSET, 0xffff); } static void ssi_txuint16(struct lm32_ssidev_s *priv) { uint16 *ptr = (uint16*)priv->txbuffer; + ssivdbg("TX: %p->%04x\n", ptr, *ptr); ssi_putreg(priv, LM3S_SSI_DR_OFFSET, (uint32)(*ptr++)); priv->txbuffer = (void*)ptr; } @@ -439,6 +441,7 @@ static void ssi_txuint16(struct lm32_ssidev_s *priv) static void ssi_txubyte(struct lm32_ssidev_s *priv) { ubyte *ptr = (ubyte*)priv->txbuffer; + ssivdbg("TX: %p->%02x\n", ptr, *ptr); ssi_putreg(priv, LM3S_SSI_DR_OFFSET, (uint32)(*ptr++)); priv->txbuffer = (void*)ptr; } @@ -462,21 +465,28 @@ static void ssi_txubyte(struct lm32_ssidev_s *priv) static void ssi_rxnull(struct lm32_ssidev_s *priv) { +#if defined(SSI_DEBUG) && defined(CONFIG_DEBUG_VERBOSE) + uint32 regval = ssi_getreg(priv, LM3S_SSI_DR_OFFSET); + ssivdbg("RX: discard %04x\n", regval); +#else (void)ssi_getreg(priv, LM3S_SSI_DR_OFFSET); +#endif } static void ssi_rxuint16(struct lm32_ssidev_s *priv) { uint16 *ptr = (uint16*)priv->rxbuffer; - *ptr++ = (uint16)ssi_getreg(priv, LM3S_SSI_DR_OFFSET); - priv->rxbuffer = (void*)ptr; + *ptr = (uint16)ssi_getreg(priv, LM3S_SSI_DR_OFFSET); + ssivdbg("RX: %p<-%04x\n", ptr, *ptr); + priv->rxbuffer = (void*)(++ptr); } static void ssi_rxubyte(struct lm32_ssidev_s *priv) { ubyte *ptr = (ubyte*)priv->rxbuffer; - *ptr++ = (ubyte)ssi_getreg(priv, LM3S_SSI_DR_OFFSET); - priv->rxbuffer = (void*)ptr; + *ptr = (ubyte)ssi_getreg(priv, LM3S_SSI_DR_OFFSET); + ssivdbg("RX: %p<-%02x\n", ptr, *ptr); + priv->rxbuffer = (void*)(++ptr); } /****************************************************************************