需要上传94k的数据,怎么处理?
static err_t My_http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
{
int i, j;
char *data;
float adc_data = 0;
char fname[40];
struct fs_file file = {0, 0};
struct http_state *hs;
hs = arg;
if (err == ERR_OK && p != NULL)
{
/* Inform TCP that we have taken the data. tot_len最大值由lwipopts。h中PBUF_POOL_BUFSIZE决定*/
tcp_recved(pcb, p->tot_len);
printf("\r\n p->tot_len is 0x%X\r\n", p->tot_len);
printf("\r\n p->tot_len数据为:%s \r\n", p->payload);
if (hs->file == NULL)
{
data = p->payload;
if (strncmp(data, "GET /jquery.js", 14) == 0)
{
hs->left = 0x0176c0;
for(i = 0; i < 0x18; i++)
{
pbuf_free(p);
SPI_FLASH_BufferRead(USART_Buffer_Tx, (0x0ff000+(i<<12)), 0x1000);
hs->file = USART_Buffer_Tx;
hs->left = 0x1000;
send_data(pcb, hs);
tcp_write(pcb,USART_Buffer_Tx,0x1000,TCP_WRITE_FLAG_COPY); // TCP_WRITE_FLAG_COPY
tcp_output(pcb);
}
// tcp_sent(pcb, http_sent);
}
else close_conn(pcb, hs);
}
else pbuf_free(p);
}
if (err == ERR_OK && p == NULL)close_conn(pcb, hs);
return ERR_OK;
}
上面程序只能上传5K左右的数据 |