M0内存溢出情况
在一个中断函数中,调用GetInReport ()函数老是有问题(处理器运行不正常),我怀疑是内存溢出了,大家帮忙看看哪段代码出现这样的情况?为什么?(M0处理器,LPC11U12)
uint8_t FIFO_Out(pFifoStruct pFifo,ElemType *sdat){ if((pFifo->front == pFifo->rear) && (pFifo->count == 0)) { // empty #ifdef _FIFO__DEBUG_ SUartSendString("\r\nQueueEmpty", 12); #endif return 1; } else { // out *sdat = pFifo->dat[pFifo->front]; pFifo->front = (pFifo->front + 1) % QueueSize; pFifo->count = pFifo->count - 1; return 0; }}uint8_t FIFO_Rollback(pFifoStruct pFifo,ElemType *sdat){ if((pFifo->front == pFifo->rear) && (pFifo->count == QueueSize)) { #ifdef _FIFO__DEBUG_ SUartSendString("\r\nRollback_Full", 15); #endif return 1; } else { pFifo->front = (pFifo->front - 1) % QueueSize; pFifo->count = pFifo->count + 1; pFifo->dat[pFifo->front] = *sdat; return 0; }}void GetInReport (void){ uint8_t Index,i; uint8_t Temp; for(Index = 2;Index < 8; Index ++) { if(0 != FIFO_Out(&SoftFifo,&Temp)) { goto Same_exit; } uSendBuf[Index] = Temp; for(i = Index-1;i >= 2; i -- ) { if(Temp == uSendBuf[i]) { FIFO_Rollback(&SoftFifo,&Temp); goto Same_exit; } } } return;Same_exit: for(i = Index ; i < 8; i++) { uSendBuf[i] = 0; } return;}