Slightly improved debug output

This commit is contained in:
Gregory Nutt 2013-09-24 13:47:03 -06:00
parent f0ca9c2a8d
commit 245f5ad32d
2 changed files with 17 additions and 5 deletions

View File

@ -200,6 +200,13 @@ static void up_dumpstate(void)
* stack?
*/
if (sp > istackbase || sp <= istackbase - istacksize)
{
if (up_interrupt_context())
{
lldbg("ERROR: Stack pointer is not within interrupt stack\n");
}
}
if (sp <= istackbase && sp > istackbase - istacksize)
{
/* Yes.. dump the interrupt stack */
@ -231,9 +238,12 @@ static void up_dumpstate(void)
if (sp > ustackbase || sp <= ustackbase - ustacksize)
{
#if !defined(CONFIG_ARCH_INTERRUPTSTACK) || CONFIG_ARCH_INTERRUPTSTACK < 4
lldbg("ERROR: Stack pointer is not within allocated stack\n");
#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
if (!up_interrupt_context())
#endif
{
lldbg("ERROR: Stack pointer is not within allocated stack\n");
}
}
else
{

View File

@ -956,7 +956,8 @@ static void sam_dma_wrsetup(struct sam_usbdev_s *priv, struct sam_ep_s *privep,
/* How many bytes remain to be transferred in the request? */
remaining = privreq->req.len - privreq->req.xfrd;
remaining = (int)privreq->req.len - (int)privreq->req.xfrd;
DEBUGASSERT(remaining >= 0 && remaining <= (int)privreq->req.len);
/* If there are no bytes to send, then send a zero length packet */
@ -1020,8 +1021,9 @@ static void sam_dma_rdsetup(struct sam_usbdev_s *priv,
/* How many more bytes can we append to the request buffer? */
remaining = privreq->req.len - privreq->req.xfrd;
DEBUGASSERT(remaining > 0 && privep->epstate == UDPHS_EPSTATE_RECEIVING);
remaining = (int)privreq->req.len - (int)privreq->req.xfrd;
DEBUGASSERT(remaining > 0 && remaining <= (int)privreq->req.len &&
privep->epstate == UDPHS_EPSTATE_RECEIVING);
/* Clip the DMA transfer size to the size available in the user buffer */