SAMA5: A few early, easy bug fixes. The rest will all be difficult

This commit is contained in:
Gregory Nutt 2013-08-06 11:29:53 -06:00
parent e8a34ea3ac
commit dfe42d0254

View File

@ -494,38 +494,37 @@ static void sam_callback(void *arg);
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
struct sam_dev_s g_sdiodev = /* Callbacks */
static const struct sdio_dev_s g_callbacks =
{ {
.dev = .reset = sam_reset,
{ .status = sam_status,
.reset = sam_reset, .widebus = sam_widebus,
.status = sam_status, .clock = sam_clock,
.widebus = sam_widebus, .attach = sam_attach,
.clock = sam_clock, .sendcmd = sam_sendcmd,
.attach = sam_attach, .blocksetup = sam_blocksetup,
.sendcmd = sam_sendcmd, .recvsetup = sam_dmarecvsetup,
.blocksetup = sam_blocksetup, .sendsetup = sam_dmasendsetup,
.recvsetup = sam_dmarecvsetup, .cancel = sam_cancel,
.sendsetup = sam_dmasendsetup, .waitresponse = sam_waitresponse,
.cancel = sam_cancel, .recvR1 = sam_recvshort,
.waitresponse = sam_waitresponse, .recvR2 = sam_recvlong,
.recvR1 = sam_recvshort, .recvR3 = sam_recvshort,
.recvR2 = sam_recvlong, .recvR4 = sam_recvnotimpl,
.recvR3 = sam_recvshort, .recvR5 = sam_recvnotimpl,
.recvR4 = sam_recvnotimpl, .recvR6 = sam_recvshort,
.recvR5 = sam_recvnotimpl, .recvR7 = sam_recvshort,
.recvR6 = sam_recvshort, .waitenable = sam_waitenable,
.recvR7 = sam_recvshort, .eventwait = sam_eventwait,
.waitenable = sam_waitenable, .callbackenable = sam_callbackenable,
.eventwait = sam_eventwait, .registercallback = sam_registercallback,
.callbackenable = sam_callbackenable,
.registercallback = sam_registercallback,
#ifdef CONFIG_SDIO_DMA #ifdef CONFIG_SDIO_DMA
.dmasupported = sam_dmasupported, .dmasupported = sam_dmasupported,
.dmarecvsetup = sam_dmarecvsetup, .dmarecvsetup = sam_dmarecvsetup,
.dmasendsetup = sam_dmasendsetup, .dmasendsetup = sam_dmasendsetup,
#endif #endif
},
}; };
/* Pre-allocate memory for each HSMCI device */ /* Pre-allocate memory for each HSMCI device */
@ -2809,12 +2808,19 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
return NULL; return NULL;
} }
fvdbg("priv: %p base: %08x hsmci: %d dmac: %d pid: %d\n",
priv, priv->base, priv->hsmci, dmac, pid);
/* Initialize the HSMCI slot structure */ /* Initialize the HSMCI slot structure */
sem_init(&priv->waitsem, 0, 0); sem_init(&priv->waitsem, 0, 0);
priv->waitwdog = wd_create(); priv->waitwdog = wd_create();
DEBUGASSERT(priv->waitwdog); DEBUGASSERT(priv->waitwdog);
/* Initialize the callbacks */
memcpy(&priv->dev, &g_callbacks, sizeof(struct sdio_dev_s ));
/* Allocate a DMA channel */ /* Allocate a DMA channel */
priv->dma = sam_dmachannel(dmac, DMA_FLAGS(pid)); priv->dma = sam_dmachannel(dmac, DMA_FLAGS(pid));
@ -2825,7 +2831,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
*/ */
sam_reset(&priv->dev); sam_reset(&priv->dev);
return &g_sdiodev.dev; return &priv->dev;
} }
/**************************************************************************** /****************************************************************************