|
../MCU_Common_source/Utils/ringbuffer.c:86: error: (1089) recursive function call to "_rbRead"
这个递归函数,PIC18,Hi-TECH单片机上堆栈不够,有知道怎么解的不?
int32_t ICACHE_FLASH_ATTR rbRead(rb_t *rb, void *data, size_t count)
{
int32_t copySz = 0;
if(NULL == rb)
{
return -1;
}
if(NULL == data)
{
return -1;
}
if (rb->rbHead < rb->rbTail)
{
copySz = min(count, rbCanRead(rb));
memcpy(data, rb->rbHead, copySz);
rb->rbHead += copySz;
return copySz;
}
else
{
if (count < rbCapacity(rb)-(rb->rbHead - rb->rbBuff))
{
copySz = count;
memcpy(data, rb->rbHead, copySz);
rb->rbHead += copySz;
return copySz;
}
else
{
copySz = rbCapacity(rb) - (rb->rbHead - rb->rbBuff);
memcpy(data, rb->rbHead, copySz);
rb->rbHead = rb->rbBuff;
copySz += rbRead(rb, (char*)data+copySz, count-copySz);
return copySz;
}
}
}
|
|