mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
SAMA5: A few early, easy bug fixes. The rest will all be difficult
This commit is contained in:
@@ -494,10 +494,10 @@ 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,
|
.reset = sam_reset,
|
||||||
.status = sam_status,
|
.status = sam_status,
|
||||||
.widebus = sam_widebus,
|
.widebus = sam_widebus,
|
||||||
@@ -525,7 +525,6 @@ struct sam_dev_s g_sdiodev =
|
|||||||
.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -136,10 +136,10 @@
|
|||||||
|
|
||||||
struct sam_hsmci_info_s
|
struct sam_hsmci_info_s
|
||||||
{
|
{
|
||||||
pio_pinset_t pincfg;
|
pio_pinset_t pincfg; /* Card detect PIO pin configuratin */
|
||||||
uint8_t irq;
|
uint8_t irq; /* Interrupt number (same as pid) */
|
||||||
xcpt_t handler;
|
xcpt_t handler; /* Interrupt handler */
|
||||||
struct sdio_dev_s **hsmci;
|
struct sdio_dev_s **hsmci; /* R/W device handle */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -264,9 +264,9 @@ int sam_hsmci_initialize(int slotno, int minor)
|
|||||||
/* Get the HSMI description */
|
/* Get the HSMI description */
|
||||||
|
|
||||||
info = sam_hsmci_info(slotno);
|
info = sam_hsmci_info(slotno);
|
||||||
if (info)
|
if (!info)
|
||||||
{
|
{
|
||||||
fdbg("No info for slotno &d\n", slotno);
|
fdbg("No info for slotno %d\n", slotno);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,16 +325,16 @@ bool sam_cardinserted(int slotno)
|
|||||||
/* Get the HSMI description */
|
/* Get the HSMI description */
|
||||||
|
|
||||||
info = sam_hsmci_info(slotno);
|
info = sam_hsmci_info(slotno);
|
||||||
if (info)
|
if (!info)
|
||||||
{
|
{
|
||||||
fdbg("No info for slotno &d\n", slotno);
|
fdbg("No info for slotno %d\n", slotno);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the state of the PIO pin */
|
/* Get the state of the PIO pin */
|
||||||
|
|
||||||
inserted = sam_pioread(PIO_MCI0_CD);
|
inserted = sam_pioread(info->pincfg);
|
||||||
fvdbg("Slot 0 inserted: %s\n", slotno, inserted ? "NO" : "YES");
|
fvdbg("Slot %d inserted: %s\n", slotno, inserted ? "NO" : "YES");
|
||||||
return !inserted;
|
return !inserted;
|
||||||
|
|
||||||
#else /* HAVE_MMCSD */
|
#else /* HAVE_MMCSD */
|
||||||
|
|||||||
@@ -2982,6 +2982,7 @@ static int mmcsd_hwinitialize(FAR struct mmcsd_state_s *priv)
|
|||||||
mmcsd_givesem(priv);
|
mmcsd_givesem(priv);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
fvdbg("Attached MMC/SD interrupts\n");
|
fvdbg("Attached MMC/SD interrupts\n");
|
||||||
|
|
||||||
/* Register a callback so that we get informed if media is inserted or
|
/* Register a callback so that we get informed if media is inserted or
|
||||||
|
|||||||
Reference in New Issue
Block a user