ban4jp -
/
uIP-1-0_webserver
uIP 1.0 based webserver for LPC1114 + ENC28J60
Diff: uip/psock.h
- Revision:
- 3:a2715e9c7737
- Parent:
- 0:685224d2f66d
--- a/uip/psock.h Sat Jun 21 11:54:24 2014 +0000 +++ b/uip/psock.h Mon Jun 30 16:00:08 2014 +0000 @@ -234,7 +234,7 @@ */ #define PSOCK_CLOSE(psock) uip_close() -PT_THREAD(psock_readbuf(struct psock *psock)); +PT_THREAD(psock_readbuf_len(struct psock *psock, u16_t len)); /** * Read data until the buffer is full. * @@ -247,8 +247,27 @@ * * \hideinitializer */ +/* #define PSOCK_READBUF(psock) \ - PT_WAIT_THREAD(&((psock)->pt), psock_readbuf(psock)) + PT_WAIT_THREAD(&((psock)->pt), psock_readbuf_len(psock, 1)) +*/ + + +/** + * Read data until at least len bytes have been read. + * + * This macro will block waiting for data and read the data into the + * input buffer specified with the call to PSOCK_INIT(). Data is read + * until the buffer is full or len bytes have been read. + * + * \param psock (struct psock *) A pointer to the protosocket from which + * data should be read. + * \param len (uint16_t) The minimum number of bytes to read. + * + * \hideinitializer + */ +#define PSOCK_READBUF_LEN(psock, len) \ + PT_WAIT_THREAD(&((psock)->pt), psock_readbuf_len(psock, len)) PT_THREAD(psock_readto(struct psock *psock, unsigned char c)); /** @@ -256,7 +275,7 @@ * * This macro will block waiting for data and read the data into the * input buffer specified with the call to PSOCK_INIT(). Data is only - * read until the specifieed character appears in the data stream. + * read until the specified character appears in the data stream. * * \param psock (struct psock *) A pointer to the protosocket from which * data should be read. @@ -352,7 +371,7 @@ { PSOCK_BEGIN(s); - PSOCK_WAIT_UNTIL(s, PSOCK_NEWADATA(s) || timer_expired(t)); + PSOCK_WAIT_UNTIL(s, PSOCK_NEWDATA(s) || timer_expired(t)); if(PSOCK_NEWDATA(s)) { PSOCK_READTO(s, '\n');