trailing spaces cleanup (#2659)

This commit is contained in:
sergio 2019-02-17 21:26:29 +03:00 committed by Terry Ellison
parent d75830407e
commit d77666c0e8
380 changed files with 37115 additions and 37115 deletions

View File

@ -1,9 +1,9 @@
# #
# This is very much a work in progress to show how we can use macros to make the # This is very much a work in progress to show how we can use macros to make the
# GDB interface a lot more useable. For example the next / step commands only # GDB interface a lot more useable. For example the next / step commands only
# work if the stepper doesn't leave the current scope. Beyond that you have a # work if the stepper doesn't leave the current scope. Beyond that you have a
# single hardware breakpoint which can be used as an hb or a wa. You have to # single hardware breakpoint which can be used as an hb or a wa. You have to
# remember to delete the previous one, so the br macro does this for you. # remember to delete the previous one, so the br macro does this for you.
# #
file app/.output/eagle/debug/image/eagle.app.v6.out file app/.output/eagle/debug/image/eagle.app.v6.out
#set remotedebug 1 #set remotedebug 1
@ -16,12 +16,12 @@ target remote /dev/ttyUSB0
set confirm off set confirm off
set print null-stop set print null-stop
define br define br
d d
hb $arg0 hb $arg0
end end
define upto define upto
d d
hb $arg0 hb $arg0
c c

View File

@ -15,7 +15,7 @@ Provide a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/h
Which branch are you on? If you know the Git revision then add it here as well. Which branch are you on? If you know the Git revision then add it here as well.
### Hardware ### Hardware
Describe which ESP8266 device you use and document any special hardware setup Describe which ESP8266 device you use and document any special hardware setup
required to reproduce the problem. required to reproduce the problem.
8<------------------------ END BUG REPORT ------------------------------------- 8<------------------------ END BUG REPORT -------------------------------------

View File

@ -65,7 +65,7 @@ Avoid intermediate merge commits. [Rebase](https://www.atlassian.com/git/tutoria
This is just one way of doing things. If you're proficient in Git matters you're free to choose your own. If you want to read more then the [GitHub chapter in the Git book](http://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project#The-GitHub-Flow) is a way to start. [GitHub's own documentation](https://help.github.com/categories/collaborating-with-issues-and-pull-requests/) contains a wealth of information as well. This is just one way of doing things. If you're proficient in Git matters you're free to choose your own. If you want to read more then the [GitHub chapter in the Git book](http://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project#The-GitHub-Flow) is a way to start. [GitHub's own documentation](https://help.github.com/categories/collaborating-with-issues-and-pull-requests/) contains a wealth of information as well.
As a Windows or Mac user you could also resort to [GitHub Desktop](https://desktop.github.com/). It's a mature GUI application that supports most of the tasks outlined above. As a Windows or Mac user you could also resort to [GitHub Desktop](https://desktop.github.com/). It's a mature GUI application that supports most of the tasks outlined above.
### Keeping your fork in sync ### Keeping your fork in sync
You need to sync your fork with the NodeMCU upstream repository from time to time, latest before you rebase (see flow above). You need to sync your fork with the NodeMCU upstream repository from time to time, latest before you rebase (see flow above).

View File

@ -46,7 +46,7 @@ wifi.sta.config{ssid="SSID", pwd="password"}
# Documentation # Documentation
The entire [NodeMCU documentation](https://nodemcu.readthedocs.io) is maintained right in this repository at [/docs](docs). The fact that the API documentation is maintained in the same repository as the code that *provides* the API ensures consistency between the two. With every commit the documentation is rebuilt by Read the Docs and thus transformed from terse Markdown into a nicely browsable HTML site at [https://nodemcu.readthedocs.io](https://nodemcu.readthedocs.io). The entire [NodeMCU documentation](https://nodemcu.readthedocs.io) is maintained right in this repository at [/docs](docs). The fact that the API documentation is maintained in the same repository as the code that *provides* the API ensures consistency between the two. With every commit the documentation is rebuilt by Read the Docs and thus transformed from terse Markdown into a nicely browsable HTML site at [https://nodemcu.readthedocs.io](https://nodemcu.readthedocs.io).
- How to [build the firmware](https://nodemcu.readthedocs.io/en/master/en/build/) - How to [build the firmware](https://nodemcu.readthedocs.io/en/master/en/build/)
- How to [flash the firmware](https://nodemcu.readthedocs.io/en/master/en/flash/) - How to [flash the firmware](https://nodemcu.readthedocs.io/en/master/en/flash/)

View File

@ -22,7 +22,7 @@ endif
# makefile at its root level - these are then overridden # makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein # for a subtree within the makefile rooted therein
# #
#DEFINES += #DEFINES +=
############################################################# #############################################################
# Recursion Magic - Don't touch this!! # Recursion Magic - Don't touch this!!

View File

@ -24,8 +24,8 @@ typedef struct
uint8_t ver; /* CoAP version number */ uint8_t ver; /* CoAP version number */
uint8_t t; /* CoAP Message Type */ uint8_t t; /* CoAP Message Type */
uint8_t tkl; /* Token length: indicates length of the Token field */ uint8_t tkl; /* Token length: indicates length of the Token field */
uint8_t code; /* CoAP status code. Can be request (0.xx), success reponse (2.xx), uint8_t code; /* CoAP status code. Can be request (0.xx), success reponse (2.xx),
* client error response (4.xx), or rever error response (5.xx) * client error response (4.xx), or rever error response (5.xx)
* For possible values, see http://tools.ietf.org/html/rfc7252#section-12.1 */ * For possible values, see http://tools.ietf.org/html/rfc7252#section-12.1 */
uint8_t id[2]; uint8_t id[2];
} coap_header_t; } coap_header_t;
@ -164,14 +164,14 @@ struct coap_luser_entry{
struct coap_endpoint_t{ struct coap_endpoint_t{
coap_method_t method; /* (i.e. POST, PUT or GET) */ coap_method_t method; /* (i.e. POST, PUT or GET) */
coap_endpoint_func handler; /* callback function which handles this coap_endpoint_func handler; /* callback function which handles this
* type of endpoint (and calls * type of endpoint (and calls
* coap_make_response() at some point) */ * coap_make_response() at some point) */
const coap_endpoint_path_t *path; /* path towards a resource (i.e. foo/bar/) */ const coap_endpoint_path_t *path; /* path towards a resource (i.e. foo/bar/) */
const char *core_attr; /* the 'ct' attribute, as defined in RFC7252, section 7.2.1.: const char *core_attr; /* the 'ct' attribute, as defined in RFC7252, section 7.2.1.:
* "The Content-Format code "ct" attribute * "The Content-Format code "ct" attribute
* provides a hint about the * provides a hint about the
* Content-Formats this resource returns." * Content-Formats this resource returns."
* (Section 12.3. lists possible ct values.) */ * (Section 12.3. lists possible ct values.) */
coap_luser_entry *user_entry; coap_luser_entry *user_entry;
}; };

View File

@ -64,7 +64,7 @@ coap_tid_t coap_send_confirmed(struct espconn *pesp_conn, coap_pdu_t *pdu) {
*/ */
coap_timer_stop(); coap_timer_stop();
coap_timer_update(&gQueue); coap_timer_update(&gQueue);
node->t = node->timeout; node->t = node->timeout;
coap_insert_node(&gQueue, node); coap_insert_node(&gQueue, node);
coap_timer_start(&gQueue); coap_timer_start(&gQueue);
return node->id; return node->id;

View File

@ -10,7 +10,7 @@ extern "C" {
#include "espconn.h" #include "espconn.h"
#include "pdu.h" #include "pdu.h"
#include "hash.h" #include "hash.h"
coap_tid_t coap_send(struct espconn *pesp_conn, coap_pdu_t *pdu); coap_tid_t coap_send(struct espconn *pesp_conn, coap_pdu_t *pdu);
coap_tid_t coap_send_confirmed(struct espconn *pesp_conn, coap_pdu_t *pdu); coap_tid_t coap_send_confirmed(struct espconn *pesp_conn, coap_pdu_t *pdu);

View File

@ -29,14 +29,14 @@ void coap_timer_tick(void *arg){
node->retransmit_cnt++; node->retransmit_cnt++;
node->t = node->timeout << node->retransmit_cnt; node->t = node->timeout << node->retransmit_cnt;
NODE_DBG("** retransmission #%d of transaction %d\n", NODE_DBG("** retransmission #%d of transaction %d\n",
node->retransmit_cnt, (((uint16_t)(node->pdu->pkt->hdr.id[0]))<<8)+node->pdu->pkt->hdr.id[1]); node->retransmit_cnt, (((uint16_t)(node->pdu->pkt->hdr.id[0]))<<8)+node->pdu->pkt->hdr.id[1]);
node->id = coap_send(node->pconn, node->pdu); node->id = coap_send(node->pconn, node->pdu);
if (COAP_INVALID_TID == node->id) { if (COAP_INVALID_TID == node->id) {
NODE_DBG("retransmission: error sending pdu\n"); NODE_DBG("retransmission: error sending pdu\n");
coap_delete_node(node); coap_delete_node(node);
} else { } else {
coap_insert_node(queue, node); coap_insert_node(queue, node);
} }
} else { } else {
/* And finally delete the node */ /* And finally delete the node */

View File

@ -141,7 +141,7 @@ static int handle_post_function(const coap_endpoint_t *ep, coap_rw_buffer_t *scr
NODE_DBG("\n"); NODE_DBG("\n");
lua_settop(L, n); lua_settop(L, n);
return coap_make_response(scratch, outpkt, ret, len, id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_CONTENT, COAP_CONTENTTYPE_TEXT_PLAIN); return coap_make_response(scratch, outpkt, ret, len, id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_CONTENT, COAP_CONTENTTYPE_TEXT_PLAIN);
} }
} else { } else {
lua_settop(L, n); lua_settop(L, n);
return coap_make_response(scratch, outpkt, NULL, 0, id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_CONTENT, COAP_CONTENTTYPE_TEXT_PLAIN); return coap_make_response(scratch, outpkt, NULL, 0, id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_CONTENT, COAP_CONTENTTYPE_TEXT_PLAIN);
@ -157,7 +157,7 @@ static int handle_post_function(const coap_endpoint_t *ep, coap_rw_buffer_t *scr
goto end; goto end;
} }
} }
NODE_DBG("none match.\n"); NODE_DBG("none match.\n");
end: end:
return coap_make_response(scratch, outpkt, NULL, 0, id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_NOT_FOUND, COAP_CONTENTTYPE_NONE); return coap_make_response(scratch, outpkt, NULL, 0, id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_NOT_FOUND, COAP_CONTENTTYPE_NONE);
} }
@ -226,7 +226,7 @@ void build_well_known_rsp(char *rsp, uint16_t rsplen)
c_strncat(rsp, ",", len); c_strncat(rsp, ",", len);
len--; len--;
} }
c_strncat(rsp, "<", len); c_strncat(rsp, "<", len);
len--; len--;
@ -250,7 +250,7 @@ void build_well_known_rsp(char *rsp, uint16_t rsplen)
c_strncat(rsp, ",", len); c_strncat(rsp, ",", len);
len--; len--;
} }
c_strncat(rsp, "<", len); c_strncat(rsp, "<", len);
len--; len--;
@ -272,7 +272,7 @@ void build_well_known_rsp(char *rsp, uint16_t rsplen)
len -= 2; len -= 2;
c_strncat(rsp, ep->core_attr, len); c_strncat(rsp, ep->core_attr, len);
len -= c_strlen(ep->core_attr); len -= c_strlen(ep->core_attr);
h = h->next; h = h->next;
} }

View File

@ -8,7 +8,7 @@ void coap_hash(const unsigned char *s, unsigned int len, coap_key_t h) {
while (len--) { while (len--) {
j = sizeof(coap_key_t)-1; j = sizeof(coap_key_t)-1;
while (j) { while (j) {
h[j] = ((h[j] << 7) | (h[j-1] >> 1)) + h[j]; h[j] = ((h[j] << 7) | (h[j-1] >> 1)) + h[j];
--j; --j;
@ -23,8 +23,8 @@ void coap_transaction_id(const uint32_t ip, const uint32_t port, const coap_pack
c_memset(h, 0, sizeof(coap_key_t)); c_memset(h, 0, sizeof(coap_key_t));
/* Compare the transport address. */ /* Compare the transport address. */
coap_hash((const unsigned char *)&(port), sizeof(port), h); coap_hash((const unsigned char *)&(port), sizeof(port), h);
coap_hash((const unsigned char *)&(ip), sizeof(ip), h); coap_hash((const unsigned char *)&(ip), sizeof(ip), h);
coap_hash((const unsigned char *)(pkt->hdr.id), sizeof(pkt->hdr.id), h); coap_hash((const unsigned char *)(pkt->hdr.id), sizeof(pkt->hdr.id), h);
*id = ((h[0] << 8) | h[1]) ^ ((h[2] << 8) | h[3]); *id = ((h[0] << 8) | h[1]) ^ ((h[2] << 8) | h[3]);
} }

View File

@ -101,7 +101,7 @@ coap_queue_t * coap_pop_next( coap_queue_t **queue ) { // this function is call
int coap_remove_node( coap_queue_t **queue, const coap_tid_t id){ int coap_remove_node( coap_queue_t **queue, const coap_tid_t id){
coap_queue_t *p, *q, *node; coap_queue_t *p, *q, *node;
if ( !queue ) if ( !queue )
return 0; return 0;
if ( !*queue ) // if empty if ( !*queue ) // if empty
return 0; return 0;

View File

@ -16,7 +16,7 @@ coap_pdu_t * coap_new_pdu(void) {
return NULL; return NULL;
} }
pdu->scratch.len = MAX_REQ_SCRATCH_SIZE; pdu->scratch.len = MAX_REQ_SCRATCH_SIZE;
pdu->pkt = (coap_packet_t *)c_zalloc(sizeof(coap_packet_t)); pdu->pkt = (coap_packet_t *)c_zalloc(sizeof(coap_packet_t));
if(!pdu->pkt){ if(!pdu->pkt){
NODE_DBG("coap_new_pdu malloc error.\n"); NODE_DBG("coap_new_pdu malloc error.\n");

View File

@ -3,12 +3,12 @@
* Copyright (C) 2010,2011 Olaf Bergmann <bergmann@tzi.org> * Copyright (C) 2010,2011 Olaf Bergmann <bergmann@tzi.org>
* *
* This file is part of the CoAP library libcoap. Please see * This file is part of the CoAP library libcoap. Please see
* README for terms of use. * README for terms of use.
*/ */
#include "c_stdlib.h" #include "c_stdlib.h"
#include "c_types.h" #include "c_types.h"
#include "str.h" #include "str.h"
str * coap_new_string(size_t size) { str * coap_new_string(size_t size) {

View File

@ -3,7 +3,7 @@
* Copyright (C) 2010,2011 Olaf Bergmann <bergmann@tzi.org> * Copyright (C) 2010,2011 Olaf Bergmann <bergmann@tzi.org>
* *
* This file is part of the CoAP library libcoap. Please see * This file is part of the CoAP library libcoap. Please see
* README for terms of use. * README for terms of use.
*/ */
#ifndef _COAP_STR_H_ #ifndef _COAP_STR_H_

View File

@ -17,22 +17,22 @@
#endif #endif
/** /**
* A length-safe version of strchr(). This function returns a pointer * A length-safe version of strchr(). This function returns a pointer
* to the first occurrence of @p c in @p s, or @c NULL if not found. * to the first occurrence of @p c in @p s, or @c NULL if not found.
* *
* @param s The string to search for @p c. * @param s The string to search for @p c.
* @param len The length of @p s. * @param len The length of @p s.
* @param c The character to search. * @param c The character to search.
* *
* @return A pointer to the first occurence of @p c, or @c NULL * @return A pointer to the first occurence of @p c, or @c NULL
* if not found. * if not found.
*/ */
static inline unsigned char * static inline unsigned char *
strnchr(unsigned char *s, size_t len, unsigned char c) { strnchr(unsigned char *s, size_t len, unsigned char c) {
while (len && *s++ != c) while (len && *s++ != c)
--len; --len;
return len ? s : NULL; return len ? s : NULL;
} }
@ -57,7 +57,7 @@ int coap_split_uri(unsigned char *str_var, size_t len, coap_uri_t *uri) {
while (len && *q && tolower(*p) == *q) { while (len && *q && tolower(*p) == *q) {
++p; ++q; --len; ++p; ++q; --len;
} }
/* If q does not point to the string end marker '\0', the schema /* If q does not point to the string end marker '\0', the schema
* identifier is wrong. */ * identifier is wrong. */
if (*q) { if (*q) {
@ -84,7 +84,7 @@ int coap_split_uri(unsigned char *str_var, size_t len, coap_uri_t *uri) {
q = p; q = p;
if (len && *p == '[') { /* IPv6 address reference */ if (len && *p == '[') { /* IPv6 address reference */
++p; ++p;
while (len && *q != ']') { while (len && *q != ']') {
++q; --len; ++q; --len;
} }
@ -92,7 +92,7 @@ int coap_split_uri(unsigned char *str_var, size_t len, coap_uri_t *uri) {
if (!len || *q != ']' || p == q) { if (!len || *q != ']' || p == q) {
res = -3; res = -3;
goto error; goto error;
} }
COAP_SET_STR(&uri->host, q - p, p); COAP_SET_STR(&uri->host, q - p, p);
++q; --len; ++q; --len;
@ -115,7 +115,7 @@ int coap_split_uri(unsigned char *str_var, size_t len, coap_uri_t *uri) {
if (len && *q == ':') { if (len && *q == ':') {
p = ++q; p = ++q;
--len; --len;
while (len && isdigit(*q)) { while (len && isdigit(*q)) {
++q; ++q;
--len; --len;
@ -123,19 +123,19 @@ int coap_split_uri(unsigned char *str_var, size_t len, coap_uri_t *uri) {
if (p < q) { /* explicit port number given */ if (p < q) { /* explicit port number given */
int uri_port = 0; int uri_port = 0;
while (p < q) while (p < q)
uri_port = uri_port * 10 + (*p++ - '0'); uri_port = uri_port * 10 + (*p++ - '0');
uri->port = uri_port; uri->port = uri_port;
} }
} }
path: /* at this point, p must point to an absolute path */ path: /* at this point, p must point to an absolute path */
if (!len) if (!len)
goto end; goto end;
if (*q == '/') { if (*q == '/') {
p = ++q; p = ++q;
--len; --len;
@ -144,7 +144,7 @@ int coap_split_uri(unsigned char *str_var, size_t len, coap_uri_t *uri) {
++q; ++q;
--len; --len;
} }
if (p < q) { if (p < q) {
COAP_SET_STR(&uri->path, q - p, p); COAP_SET_STR(&uri->path, q - p, p);
p = q; p = q;
@ -161,28 +161,28 @@ int coap_split_uri(unsigned char *str_var, size_t len, coap_uri_t *uri) {
end: end:
return len ? -1 : 0; return len ? -1 : 0;
error: error:
return res; return res;
} }
/** /**
* Calculates decimal value from hexadecimal ASCII character given in * Calculates decimal value from hexadecimal ASCII character given in
* @p c. The caller must ensure that @p c actually represents a valid * @p c. The caller must ensure that @p c actually represents a valid
* heaxdecimal character, e.g. with isxdigit(3). * heaxdecimal character, e.g. with isxdigit(3).
* *
* @hideinitializer * @hideinitializer
*/ */
#define hexchar_to_dec(c) ((c) & 0x40 ? ((c) & 0x0F) + 9 : ((c) & 0x0F)) #define hexchar_to_dec(c) ((c) & 0x40 ? ((c) & 0x0F) + 9 : ((c) & 0x0F))
/** /**
* Decodes percent-encoded characters while copying the string @p seg * Decodes percent-encoded characters while copying the string @p seg
* of size @p length to @p buf. The caller of this function must * of size @p length to @p buf. The caller of this function must
* ensure that the percent-encodings are correct (i.e. the character * ensure that the percent-encodings are correct (i.e. the character
* '%' is always followed by two hex digits. and that @p buf provides * '%' is always followed by two hex digits. and that @p buf provides
* sufficient space to hold the result. This function is supposed to * sufficient space to hold the result. This function is supposed to
* be called by make_decoded_option() only. * be called by make_decoded_option() only.
* *
* @param seg The segment to decode and copy. * @param seg The segment to decode and copy.
* @param length Length of @p seg. * @param length Length of @p seg.
* @param buf The result buffer. * @param buf The result buffer.
@ -193,12 +193,12 @@ void decode_segment(const unsigned char *seg, size_t length, unsigned char *buf)
if (*seg == '%') { if (*seg == '%') {
*buf = (hexchar_to_dec(seg[1]) << 4) + hexchar_to_dec(seg[2]); *buf = (hexchar_to_dec(seg[1]) << 4) + hexchar_to_dec(seg[2]);
seg += 2; length -= 2; seg += 2; length -= 2;
} else { } else {
*buf = *seg; *buf = *seg;
} }
++buf; ++seg; ++buf; ++seg;
} }
} }
@ -216,18 +216,18 @@ int check_segment(const unsigned char *s, size_t length) {
if (*s == '%') { if (*s == '%') {
if (length < 2 || !(isxdigit(s[1]) && isxdigit(s[2]))) if (length < 2 || !(isxdigit(s[1]) && isxdigit(s[2])))
return -1; return -1;
s += 2; s += 2;
length -= 2; length -= 2;
} }
++s; ++n; --length; ++s; ++n; --length;
} }
return n; return n;
} }
/** /**
* Writes a coap option from given string @p s to @p buf. @p s should * Writes a coap option from given string @p s to @p buf. @p s should
* point to a (percent-encoded) path or query segment of a coap_uri_t * point to a (percent-encoded) path or query segment of a coap_uri_t
* object. The created option will have type @c 0, and the length * object. The created option will have type @c 0, and the length
@ -235,18 +235,18 @@ int check_segment(const unsigned char *s, size_t length) {
* On success, this function returns the option's size, or a value * On success, this function returns the option's size, or a value
* less than zero on error. This function must be called from * less than zero on error. This function must be called from
* coap_split_path_impl() only. * coap_split_path_impl() only.
* *
* @param s The string to decode. * @param s The string to decode.
* @param length The size of the percent-encoded string @p s. * @param length The size of the percent-encoded string @p s.
* @param buf The buffer to store the new coap option. * @param buf The buffer to store the new coap option.
* @param buflen The maximum size of @p buf. * @param buflen The maximum size of @p buf.
* *
* @return The option's size, or @c -1 on error. * @return The option's size, or @c -1 on error.
* *
* @bug This function does not split segments that are bigger than 270 * @bug This function does not split segments that are bigger than 270
* bytes. * bytes.
*/ */
int make_decoded_option(const unsigned char *s, size_t length, int make_decoded_option(const unsigned char *s, size_t length,
unsigned char *buf, size_t buflen) { unsigned char *buf, size_t buflen) {
int res; int res;
size_t written; size_t written;
@ -289,32 +289,32 @@ int make_decoded_option(const unsigned char *s, size_t length,
typedef void (*segment_handler_t)(unsigned char *, size_t, void *); typedef void (*segment_handler_t)(unsigned char *, size_t, void *);
/** /**
* Splits the given string into segments. You should call one of the * Splits the given string into segments. You should call one of the
* macros coap_split_path() or coap_split_query() instead. * macros coap_split_path() or coap_split_query() instead.
* *
* @param parse_iter The iterator used for tokenizing. * @param parse_iter The iterator used for tokenizing.
* @param h A handler that is called with every token. * @param h A handler that is called with every token.
* @param data Opaque data that is passed to @p h when called. * @param data Opaque data that is passed to @p h when called.
* *
* @return The number of characters that have been parsed from @p s. * @return The number of characters that have been parsed from @p s.
*/ */
size_t coap_split_path_impl(coap_parse_iterator_t *parse_iter, size_t coap_split_path_impl(coap_parse_iterator_t *parse_iter,
segment_handler_t h, void *data) { segment_handler_t h, void *data) {
unsigned char *seg; unsigned char *seg;
size_t length; size_t length;
assert(parse_iter); assert(parse_iter);
assert(h); assert(h);
length = parse_iter->n; length = parse_iter->n;
while ( (seg = coap_parse_next(parse_iter)) ) { while ( (seg = coap_parse_next(parse_iter)) ) {
/* any valid path segment is handled here: */ /* any valid path segment is handled here: */
h(seg, parse_iter->segment_length, data); h(seg, parse_iter->segment_length, data);
} }
return length - (parse_iter->n - parse_iter->segment_length); return length - (parse_iter->n - parse_iter->segment_length);
} }
@ -332,7 +332,7 @@ void write_option(unsigned char *s, size_t len, void *data) {
/* skip empty segments and those that consist of only one or two dots */ /* skip empty segments and those that consist of only one or two dots */
if (memcmp(s, "..", min(len,2)) == 0) if (memcmp(s, "..", min(len,2)) == 0)
return; return;
res = check_segment(s, len); res = check_segment(s, len);
if (res < 0){ if (res < 0){
NODE_DBG("not a valid segment\n"); NODE_DBG("not a valid segment\n");
@ -360,7 +360,7 @@ int coap_split_path(coap_rw_buffer_t *scratch, coap_packet_t *pkt, const unsigne
struct pkt_scr tmp = { pkt, scratch, 0 }; struct pkt_scr tmp = { pkt, scratch, 0 };
coap_parse_iterator_t pi; coap_parse_iterator_t pi;
coap_parse_iterator_init((unsigned char *)s, length, coap_parse_iterator_init((unsigned char *)s, length,
'/', (unsigned char *)"?#", 2, &pi); '/', (unsigned char *)"?#", 2, &pi);
coap_split_path_impl(&pi, write_option, &tmp); coap_split_path_impl(&pi, write_option, &tmp);
@ -376,7 +376,7 @@ int coap_split_query(coap_rw_buffer_t *scratch, coap_packet_t *pkt, const unsign
struct pkt_scr tmp = { pkt, scratch, 0 }; struct pkt_scr tmp = { pkt, scratch, 0 };
coap_parse_iterator_t pi; coap_parse_iterator_t pi;
coap_parse_iterator_init((unsigned char *)s, length, coap_parse_iterator_init((unsigned char *)s, length,
'&', (unsigned char *)"#", 1, &pi); '&', (unsigned char *)"#", 1, &pi);
coap_split_path_impl(&pi, write_option, &tmp); coap_split_path_impl(&pi, write_option, &tmp);
@ -411,7 +411,7 @@ coap_uri_t * coap_new_uri(const unsigned char *uri, unsigned int length) {
/* iterator functions */ /* iterator functions */
coap_parse_iterator_t * coap_parse_iterator_init(unsigned char *s, size_t n, coap_parse_iterator_t * coap_parse_iterator_init(unsigned char *s, size_t n,
unsigned char separator, unsigned char separator,
unsigned char *delim, size_t dlen, unsigned char *delim, size_t dlen,
coap_parse_iterator_t *pi) { coap_parse_iterator_t *pi) {

View File

@ -3,7 +3,7 @@
* Copyright (C) 2010,2011 Olaf Bergmann <bergmann@tzi.org> * Copyright (C) 2010,2011 Olaf Bergmann <bergmann@tzi.org>
* *
* This file is part of the CoAP library libcoap. Please see * This file is part of the CoAP library libcoap. Please see
* README for terms of use. * README for terms of use.
*/ */
#ifndef _COAP_URI_H_ #ifndef _COAP_URI_H_
@ -20,7 +20,7 @@
typedef struct { typedef struct {
str host; /**< host part of the URI */ str host; /**< host part of the URI */
unsigned short port; /**< The port in host byte order */ unsigned short port; /**< The port in host byte order */
str path; /**< Beginning of the first path segment. str path; /**< Beginning of the first path segment.
Use coap_split_path() to create Uri-Path options */ Use coap_split_path() to create Uri-Path options */
str query; /**< The query part if present */ str query; /**< The query part if present */
} coap_uri_t; } coap_uri_t;
@ -44,7 +44,7 @@ coap_uri_t *coap_new_uri(const unsigned char *uri, unsigned int length);
* @{ * @{
*/ */
/** /**
* Iterator to for tokenizing a URI path or query. This structure must * Iterator to for tokenizing a URI path or query. This structure must
* be initialized with coap_parse_iterator_init(). Call * be initialized with coap_parse_iterator_init(). Call
* coap_parse_next() to walk through the tokens. * coap_parse_next() to walk through the tokens.
@ -68,45 +68,45 @@ typedef struct {
size_t segment_length; /**< length of current segment */ size_t segment_length; /**< length of current segment */
} coap_parse_iterator_t; } coap_parse_iterator_t;
/** /**
* Initializes the given iterator @p pi. * Initializes the given iterator @p pi.
* *
* @param s The string to tokenize. * @param s The string to tokenize.
* @param n The length of @p s. * @param n The length of @p s.
* @param separator The separator character that delimits tokens. * @param separator The separator character that delimits tokens.
* @param delim A set of characters that delimit @s. * @param delim A set of characters that delimit @s.
* @param dlen The length of @p delim. * @param dlen The length of @p delim.
* @param pi The iterator object to initialize. * @param pi The iterator object to initialize.
* *
* @return The initialized iterator object @p pi. * @return The initialized iterator object @p pi.
*/ */
coap_parse_iterator_t * coap_parse_iterator_t *
coap_parse_iterator_init(unsigned char *s, size_t n, coap_parse_iterator_init(unsigned char *s, size_t n,
unsigned char separator, unsigned char separator,
unsigned char *delim, size_t dlen, unsigned char *delim, size_t dlen,
coap_parse_iterator_t *pi); coap_parse_iterator_t *pi);
/** /**
* Updates the iterator @p pi to point to the next token. This * Updates the iterator @p pi to point to the next token. This
* function returns a pointer to that token or @c NULL if no more * function returns a pointer to that token or @c NULL if no more
* tokens exist. The contents of @p pi will be updated. In particular, * tokens exist. The contents of @p pi will be updated. In particular,
* @c pi->segment_length specifies the length of the current token, @c * @c pi->segment_length specifies the length of the current token, @c
* pi->pos points to its beginning. * pi->pos points to its beginning.
* *
* @param pi The iterator to update. * @param pi The iterator to update.
* *
* @return The next token or @c NULL if no more tokens exist. * @return The next token or @c NULL if no more tokens exist.
*/ */
unsigned char *coap_parse_next(coap_parse_iterator_t *pi); unsigned char *coap_parse_next(coap_parse_iterator_t *pi);
/** /**
* Parses a given string into URI components. The identified syntactic * Parses a given string into URI components. The identified syntactic
* components are stored in the result parameter @p uri. Optional URI * components are stored in the result parameter @p uri. Optional URI
* components that are not specified will be set to { 0, 0 }, except * components that are not specified will be set to { 0, 0 }, except
* for the port which is set to @c COAP_DEFAULT_PORT. This function * for the port which is set to @c COAP_DEFAULT_PORT. This function
* returns @p 0 if parsing succeeded, a value less than zero * returns @p 0 if parsing succeeded, a value less than zero
* otherwise. * otherwise.
* *
* @param str_var The string to split up. * @param str_var The string to split up.
* @param len The actual length of @p str_var * @param len The actual length of @p str_var
* @param uri The coap_uri_t object to store the result. * @param uri The coap_uri_t object to store the result.
@ -118,47 +118,47 @@ unsigned char *coap_parse_next(coap_parse_iterator_t *pi);
int int
coap_split_uri(unsigned char *str_var, size_t len, coap_uri_t *uri); coap_split_uri(unsigned char *str_var, size_t len, coap_uri_t *uri);
/** /**
* Splits the given URI path into segments. Each segment is preceded * Splits the given URI path into segments. Each segment is preceded
* by an option pseudo-header with delta-value 0 and the actual length * by an option pseudo-header with delta-value 0 and the actual length
* of the respective segment after percent-decoding. * of the respective segment after percent-decoding.
* *
* @param s The path string to split. * @param s The path string to split.
* @param length The actual length of @p s. * @param length The actual length of @p s.
* @param buf Result buffer for parsed segments. * @param buf Result buffer for parsed segments.
* @param buflen Maximum length of @p buf. Will be set to the actual number * @param buflen Maximum length of @p buf. Will be set to the actual number
* of bytes written into buf on success. * of bytes written into buf on success.
* *
* @return The number of segments created or @c -1 on error. * @return The number of segments created or @c -1 on error.
*/ */
#if 0 #if 0
int coap_split_path(const unsigned char *s, size_t length, int coap_split_path(const unsigned char *s, size_t length,
unsigned char *buf, size_t *buflen); unsigned char *buf, size_t *buflen);
#else #else
int int
coap_split_path(coap_rw_buffer_t *scratch, coap_packet_t *pkt, coap_split_path(coap_rw_buffer_t *scratch, coap_packet_t *pkt,
const unsigned char *s, size_t length); const unsigned char *s, size_t length);
#endif #endif
/** /**
* Splits the given URI query into segments. Each segment is preceded * Splits the given URI query into segments. Each segment is preceded
* by an option pseudo-header with delta-value 0 and the actual length * by an option pseudo-header with delta-value 0 and the actual length
* of the respective query term. * of the respective query term.
* *
* @param s The query string to split. * @param s The query string to split.
* @param length The actual length of @p s. * @param length The actual length of @p s.
* @param buf Result buffer for parsed segments. * @param buf Result buffer for parsed segments.
* @param buflen Maximum length of @p buf. Will be set to the actual number * @param buflen Maximum length of @p buf. Will be set to the actual number
* of bytes written into buf on success. * of bytes written into buf on success.
* *
* @return The number of segments created or @c -1 on error. * @return The number of segments created or @c -1 on error.
* *
* @bug This function does not reserve additional space for delta > 12. * @bug This function does not reserve additional space for delta > 12.
*/ */
#if 0 #if 0
int coap_split_query(const unsigned char *s, size_t length, int coap_split_query(const unsigned char *s, size_t length,
unsigned char *buf, size_t *buflen); unsigned char *buf, size_t *buflen);
#else #else
int coap_split_query(coap_rw_buffer_t *scratch, coap_packet_t *pkt, int coap_split_query(coap_rw_buffer_t *scratch, coap_packet_t *pkt,
const unsigned char *s, size_t length); const unsigned char *s, size_t length);
#endif #endif
/** @} */ /** @} */

View File

@ -140,7 +140,7 @@ int ICACHE_FLASH_ATTR crypto_fhash (const digest_mech_info_t *mi,
uint8_t* buffer = (uint8_t*)os_malloc (mi->block_size); uint8_t* buffer = (uint8_t*)os_malloc (mi->block_size);
if (!buffer) if (!buffer)
return ENOMEM; return ENOMEM;
int read_len = 0; int read_len = 0;
do { do {
read_len = read(readarg, buffer, mi->block_size); read_len = read(readarg, buffer, mi->block_size);

View File

@ -1,7 +1,7 @@
/* /*
* FILE: sha2.c * FILE: sha2.c
* AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/ * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/
* *
* Copyright (c) 2000-2001, Aaron D. Gifford * Copyright (c) 2000-2001, Aaron D. Gifford
* Copyright (c) 2015, DiUS Computing Pty Ltd (jmattsson@dius.com.au) * Copyright (c) 2015, DiUS Computing Pty Ltd (jmattsson@dius.com.au)
* All rights reserved. * All rights reserved.
@ -17,7 +17,7 @@
* 3. Neither the name of the copyright holder nor the names of contributors * 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -424,11 +424,11 @@ void ICACHE_FLASH_ATTR SHA256_Transform(SHA256_CTX* context, const sha2_word32*
/* Part of the message block expansion: */ /* Part of the message block expansion: */
s0 = W256[(j+1)&0x0f]; s0 = W256[(j+1)&0x0f];
s0 = sigma0_256(s0); s0 = sigma0_256(s0);
s1 = W256[(j+14)&0x0f]; s1 = W256[(j+14)&0x0f];
s1 = sigma1_256(s1); s1 = sigma1_256(s1);
/* Apply the SHA-256 compression function to update a..h */ /* Apply the SHA-256 compression function to update a..h */
T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] +
(W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0);
T2 = Sigma0_256(a) + Maj(a, b, c); T2 = Sigma0_256(a) + Maj(a, b, c);
h = g; h = g;

View File

@ -23,7 +23,7 @@ endif
# makefile at its root level - these are then overridden # makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein # for a subtree within the makefile rooted therein
# #
#DEFINES += #DEFINES +=
############################################################# #############################################################
# Recursion Magic - Don't touch this!! # Recursion Magic - Don't touch this!!

View File

@ -1,319 +1,319 @@
// //
// FILE: dht.cpp // FILE: dht.cpp
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// VERSION: 0.1.14 // VERSION: 0.1.14
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino // PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
// URL: http://arduino.cc/playground/Main/DHTLib // URL: http://arduino.cc/playground/Main/DHTLib
// //
// HISTORY: // HISTORY:
// 0.1.14 replace digital read with faster (~3x) code => more robust low MHz machines. // 0.1.14 replace digital read with faster (~3x) code => more robust low MHz machines.
// 0.1.13 fix negative dht_temperature // 0.1.13 fix negative dht_temperature
// 0.1.12 support DHT33 and DHT44 initial version // 0.1.12 support DHT33 and DHT44 initial version
// 0.1.11 renamed DHTLIB_TIMEOUT // 0.1.11 renamed DHTLIB_TIMEOUT
// 0.1.10 optimized faster WAKEUP + TIMEOUT // 0.1.10 optimized faster WAKEUP + TIMEOUT
// 0.1.09 optimize size: timeout check + use of mask // 0.1.09 optimize size: timeout check + use of mask
// 0.1.08 added formula for timeout based upon clockspeed // 0.1.08 added formula for timeout based upon clockspeed
// 0.1.07 added support for DHT21 // 0.1.07 added support for DHT21
// 0.1.06 minimize footprint (2012-12-27) // 0.1.06 minimize footprint (2012-12-27)
// 0.1.05 fixed negative dht_temperature bug (thanks to Roseman) // 0.1.05 fixed negative dht_temperature bug (thanks to Roseman)
// 0.1.04 improved readability of code using DHTLIB_OK in code // 0.1.04 improved readability of code using DHTLIB_OK in code
// 0.1.03 added error values for temp and dht_humidity when read failed // 0.1.03 added error values for temp and dht_humidity when read failed
// 0.1.02 added error codes // 0.1.02 added error codes
// 0.1.01 added support for Arduino 1.0, fixed typos (31/12/2011) // 0.1.01 added support for Arduino 1.0, fixed typos (31/12/2011)
// 0.1.00 by Rob Tillaart (01/04/2011) // 0.1.00 by Rob Tillaart (01/04/2011)
// //
// inspired by DHT11 library // inspired by DHT11 library
// //
// Released to the public domain // Released to the public domain
// //
#include "user_interface.h" #include "user_interface.h"
#include "platform.h" #include "platform.h"
#include "c_stdio.h" #include "c_stdio.h"
#include "dht.h" #include "dht.h"
#ifndef LOW #ifndef LOW
#define LOW 0 #define LOW 0
#endif /* ifndef LOW */ #endif /* ifndef LOW */
#ifndef HIGH #ifndef HIGH
#define HIGH 1 #define HIGH 1
#endif /* ifndef HIGH */ #endif /* ifndef HIGH */
#define COMBINE_HIGH_AND_LOW_BYTE(byte_high, byte_low) (((byte_high) << 8) | (byte_low)) #define COMBINE_HIGH_AND_LOW_BYTE(byte_high, byte_low) (((byte_high) << 8) | (byte_low))
static double dht_humidity; static double dht_humidity;
static double dht_temperature; static double dht_temperature;
static uint8_t dht_bytes[5]; // buffer to receive data static uint8_t dht_bytes[5]; // buffer to receive data
static int dht_readSensor(uint8_t pin, uint8_t wakeupDelay); static int dht_readSensor(uint8_t pin, uint8_t wakeupDelay);
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
// //
// PUBLIC // PUBLIC
// //
// return values: // return values:
// Humidity // Humidity
double dht_getHumidity(void) double dht_getHumidity(void)
{ {
return dht_humidity; return dht_humidity;
} }
// return values: // return values:
// Temperature // Temperature
double dht_getTemperature(void) double dht_getTemperature(void)
{ {
return dht_temperature; return dht_temperature;
} }
// return values: // return values:
// DHTLIB_OK // DHTLIB_OK
// DHTLIB_ERROR_CHECKSUM // DHTLIB_ERROR_CHECKSUM
// DHTLIB_ERROR_TIMEOUT // DHTLIB_ERROR_TIMEOUT
int dht_read_universal(uint8_t pin) int dht_read_universal(uint8_t pin)
{ {
// READ VALUES // READ VALUES
int rv = dht_readSensor(pin, DHTLIB_DHT_UNI_WAKEUP); int rv = dht_readSensor(pin, DHTLIB_DHT_UNI_WAKEUP);
if (rv != DHTLIB_OK) if (rv != DHTLIB_OK)
{ {
dht_humidity = DHTLIB_INVALID_VALUE; // invalid value, or is NaN prefered? dht_humidity = DHTLIB_INVALID_VALUE; // invalid value, or is NaN prefered?
dht_temperature = DHTLIB_INVALID_VALUE; // invalid value dht_temperature = DHTLIB_INVALID_VALUE; // invalid value
return rv; // propagate error value return rv; // propagate error value
} }
#if defined(DHT_DEBUG_BYTES) #if defined(DHT_DEBUG_BYTES)
int i; int i;
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
{ {
DHT_DEBUG("%02X\n", dht_bytes[i]); DHT_DEBUG("%02X\n", dht_bytes[i]);
} }
#endif // defined(DHT_DEBUG_BYTES) #endif // defined(DHT_DEBUG_BYTES)
// Assume it is DHT11 // Assume it is DHT11
// If it is DHT11, both bit[1] and bit[3] is 0 // If it is DHT11, both bit[1] and bit[3] is 0
if ((dht_bytes[1] == 0) && (dht_bytes[3] == 0)) if ((dht_bytes[1] == 0) && (dht_bytes[3] == 0))
{ {
// It may DHT11 // It may DHT11
// CONVERT AND STORE // CONVERT AND STORE
DHT_DEBUG("DHT11 method\n"); DHT_DEBUG("DHT11 method\n");
dht_humidity = dht_bytes[0]; // dht_bytes[1] == 0; dht_humidity = dht_bytes[0]; // dht_bytes[1] == 0;
dht_temperature = dht_bytes[2]; // dht_bytes[3] == 0; dht_temperature = dht_bytes[2]; // dht_bytes[3] == 0;
// TEST CHECKSUM // TEST CHECKSUM
// dht_bytes[1] && dht_bytes[3] both 0 // dht_bytes[1] && dht_bytes[3] both 0
uint8_t sum = dht_bytes[0] + dht_bytes[2]; uint8_t sum = dht_bytes[0] + dht_bytes[2];
if (dht_bytes[4] != sum) if (dht_bytes[4] != sum)
{ {
// It may not DHT11 // It may not DHT11
dht_humidity = DHTLIB_INVALID_VALUE; // invalid value, or is NaN prefered? dht_humidity = DHTLIB_INVALID_VALUE; // invalid value, or is NaN prefered?
dht_temperature = DHTLIB_INVALID_VALUE; // invalid value dht_temperature = DHTLIB_INVALID_VALUE; // invalid value
// Do nothing // Do nothing
} }
else else
{ {
return DHTLIB_OK; return DHTLIB_OK;
} }
} }
// Assume it is not DHT11 // Assume it is not DHT11
// CONVERT AND STORE // CONVERT AND STORE
DHT_DEBUG("DHTxx method\n"); DHT_DEBUG("DHTxx method\n");
dht_humidity = (double)COMBINE_HIGH_AND_LOW_BYTE(dht_bytes[0], dht_bytes[1]) * 0.1; dht_humidity = (double)COMBINE_HIGH_AND_LOW_BYTE(dht_bytes[0], dht_bytes[1]) * 0.1;
dht_temperature = (double)COMBINE_HIGH_AND_LOW_BYTE(dht_bytes[2] & 0x7F, dht_bytes[3]) * 0.1; dht_temperature = (double)COMBINE_HIGH_AND_LOW_BYTE(dht_bytes[2] & 0x7F, dht_bytes[3]) * 0.1;
if (dht_bytes[2] & 0x80) // negative dht_temperature if (dht_bytes[2] & 0x80) // negative dht_temperature
{ {
dht_temperature = -dht_temperature; dht_temperature = -dht_temperature;
} }
// TEST CHECKSUM // TEST CHECKSUM
uint8_t sum = dht_bytes[0] + dht_bytes[1] + dht_bytes[2] + dht_bytes[3]; uint8_t sum = dht_bytes[0] + dht_bytes[1] + dht_bytes[2] + dht_bytes[3];
if (dht_bytes[4] != sum) if (dht_bytes[4] != sum)
{ {
return DHTLIB_ERROR_CHECKSUM; return DHTLIB_ERROR_CHECKSUM;
} }
return DHTLIB_OK; return DHTLIB_OK;
} }
// return values: // return values:
// DHTLIB_OK // DHTLIB_OK
// DHTLIB_ERROR_CHECKSUM // DHTLIB_ERROR_CHECKSUM
// DHTLIB_ERROR_TIMEOUT // DHTLIB_ERROR_TIMEOUT
int dht_read11(uint8_t pin) int dht_read11(uint8_t pin)
{ {
// READ VALUES // READ VALUES
int rv = dht_readSensor(pin, DHTLIB_DHT11_WAKEUP); int rv = dht_readSensor(pin, DHTLIB_DHT11_WAKEUP);
if (rv != DHTLIB_OK) if (rv != DHTLIB_OK)
{ {
dht_humidity = DHTLIB_INVALID_VALUE; // invalid value, or is NaN prefered? dht_humidity = DHTLIB_INVALID_VALUE; // invalid value, or is NaN prefered?
dht_temperature = DHTLIB_INVALID_VALUE; // invalid value dht_temperature = DHTLIB_INVALID_VALUE; // invalid value
return rv; return rv;
} }
// CONVERT AND STORE // CONVERT AND STORE
dht_humidity = dht_bytes[0]; // dht_bytes[1] == 0; dht_humidity = dht_bytes[0]; // dht_bytes[1] == 0;
dht_temperature = dht_bytes[2]; // dht_bytes[3] == 0; dht_temperature = dht_bytes[2]; // dht_bytes[3] == 0;
// TEST CHECKSUM // TEST CHECKSUM
// dht_bytes[1] && dht_bytes[3] both 0 // dht_bytes[1] && dht_bytes[3] both 0
uint8_t sum = dht_bytes[0] + dht_bytes[2]; uint8_t sum = dht_bytes[0] + dht_bytes[2];
if (dht_bytes[4] != sum) return DHTLIB_ERROR_CHECKSUM; if (dht_bytes[4] != sum) return DHTLIB_ERROR_CHECKSUM;
return DHTLIB_OK; return DHTLIB_OK;
} }
// return values: // return values:
// DHTLIB_OK // DHTLIB_OK
// DHTLIB_ERROR_CHECKSUM // DHTLIB_ERROR_CHECKSUM
// DHTLIB_ERROR_TIMEOUT // DHTLIB_ERROR_TIMEOUT
int dht_read(uint8_t pin) int dht_read(uint8_t pin)
{ {
// READ VALUES // READ VALUES
int rv = dht_readSensor(pin, DHTLIB_DHT_WAKEUP); int rv = dht_readSensor(pin, DHTLIB_DHT_WAKEUP);
if (rv != DHTLIB_OK) if (rv != DHTLIB_OK)
{ {
dht_humidity = DHTLIB_INVALID_VALUE; // invalid value, or is NaN prefered? dht_humidity = DHTLIB_INVALID_VALUE; // invalid value, or is NaN prefered?
dht_temperature = DHTLIB_INVALID_VALUE; // invalid value dht_temperature = DHTLIB_INVALID_VALUE; // invalid value
return rv; // propagate error value return rv; // propagate error value
} }
// CONVERT AND STORE // CONVERT AND STORE
dht_humidity = (double)COMBINE_HIGH_AND_LOW_BYTE(dht_bytes[0], dht_bytes[1]) * 0.1; dht_humidity = (double)COMBINE_HIGH_AND_LOW_BYTE(dht_bytes[0], dht_bytes[1]) * 0.1;
dht_temperature = (double)COMBINE_HIGH_AND_LOW_BYTE(dht_bytes[2] & 0x7F, dht_bytes[3]) * 0.1; dht_temperature = (double)COMBINE_HIGH_AND_LOW_BYTE(dht_bytes[2] & 0x7F, dht_bytes[3]) * 0.1;
if (dht_bytes[2] & 0x80) // negative dht_temperature if (dht_bytes[2] & 0x80) // negative dht_temperature
{ {
dht_temperature = -dht_temperature; dht_temperature = -dht_temperature;
} }
// TEST CHECKSUM // TEST CHECKSUM
uint8_t sum = dht_bytes[0] + dht_bytes[1] + dht_bytes[2] + dht_bytes[3]; uint8_t sum = dht_bytes[0] + dht_bytes[1] + dht_bytes[2] + dht_bytes[3];
if (dht_bytes[4] != sum) if (dht_bytes[4] != sum)
{ {
return DHTLIB_ERROR_CHECKSUM; return DHTLIB_ERROR_CHECKSUM;
} }
return DHTLIB_OK; return DHTLIB_OK;
} }
// return values: // return values:
// DHTLIB_OK // DHTLIB_OK
// DHTLIB_ERROR_CHECKSUM // DHTLIB_ERROR_CHECKSUM
// DHTLIB_ERROR_TIMEOUT // DHTLIB_ERROR_TIMEOUT
int dht_read21(uint8_t pin) __attribute__((alias("dht_read"))); int dht_read21(uint8_t pin) __attribute__((alias("dht_read")));
// return values: // return values:
// DHTLIB_OK // DHTLIB_OK
// DHTLIB_ERROR_CHECKSUM // DHTLIB_ERROR_CHECKSUM
// DHTLIB_ERROR_TIMEOUT // DHTLIB_ERROR_TIMEOUT
int dht_read22(uint8_t pin) __attribute__((alias("dht_read"))); int dht_read22(uint8_t pin) __attribute__((alias("dht_read")));
// return values: // return values:
// DHTLIB_OK // DHTLIB_OK
// DHTLIB_ERROR_CHECKSUM // DHTLIB_ERROR_CHECKSUM
// DHTLIB_ERROR_TIMEOUT // DHTLIB_ERROR_TIMEOUT
int dht_read33(uint8_t pin) __attribute__((alias("dht_read"))); int dht_read33(uint8_t pin) __attribute__((alias("dht_read")));
// return values: // return values:
// DHTLIB_OK // DHTLIB_OK
// DHTLIB_ERROR_CHECKSUM // DHTLIB_ERROR_CHECKSUM
// DHTLIB_ERROR_TIMEOUT // DHTLIB_ERROR_TIMEOUT
int dht_read44(uint8_t pin) __attribute__((alias("dht_read"))); int dht_read44(uint8_t pin) __attribute__((alias("dht_read")));
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
// //
// PRIVATE // PRIVATE
// //
// return values: // return values:
// DHTLIB_OK // DHTLIB_OK
// DHTLIB_ERROR_TIMEOUT // DHTLIB_ERROR_TIMEOUT
int dht_readSensor(uint8_t pin, uint8_t wakeupDelay) int dht_readSensor(uint8_t pin, uint8_t wakeupDelay)
{ {
// INIT BUFFERVAR TO RECEIVE DATA // INIT BUFFERVAR TO RECEIVE DATA
uint8_t mask = 128; uint8_t mask = 128;
uint8_t idx = 0; uint8_t idx = 0;
uint8_t i = 0; uint8_t i = 0;
// replace digitalRead() with Direct Port Reads. // replace digitalRead() with Direct Port Reads.
// reduces footprint ~100 bytes => portability issue? // reduces footprint ~100 bytes => portability issue?
// direct port read is about 3x faster // direct port read is about 3x faster
// uint8_t bit = digitalPinToBitMask(pin); // uint8_t bit = digitalPinToBitMask(pin);
// uint8_t port = digitalPinToPort(pin); // uint8_t port = digitalPinToPort(pin);
// volatile uint8_t *PIR = portInputRegister(port); // volatile uint8_t *PIR = portInputRegister(port);
// EMPTY BUFFER // EMPTY BUFFER
for (i = 0; i < 5; i++) dht_bytes[i] = 0; for (i = 0; i < 5; i++) dht_bytes[i] = 0;
// REQUEST SAMPLE // REQUEST SAMPLE
// pinMode(pin, OUTPUT); // pinMode(pin, OUTPUT);
platform_gpio_mode(pin, PLATFORM_GPIO_OUTPUT, PLATFORM_GPIO_PULLUP); platform_gpio_mode(pin, PLATFORM_GPIO_OUTPUT, PLATFORM_GPIO_PULLUP);
DIRECT_MODE_OUTPUT(pin); DIRECT_MODE_OUTPUT(pin);
// digitalWrite(pin, LOW); // T-be // digitalWrite(pin, LOW); // T-be
DIRECT_WRITE_LOW(pin); DIRECT_WRITE_LOW(pin);
// delay(wakeupDelay); // delay(wakeupDelay);
for (i = 0; i < wakeupDelay; i++) os_delay_us(1000); for (i = 0; i < wakeupDelay; i++) os_delay_us(1000);
// Disable interrupts // Disable interrupts
ets_intr_lock(); ets_intr_lock();
// digitalWrite(pin, HIGH); // T-go // digitalWrite(pin, HIGH); // T-go
DIRECT_WRITE_HIGH(pin); DIRECT_WRITE_HIGH(pin);
os_delay_us(40); os_delay_us(40);
// pinMode(pin, INPUT); // pinMode(pin, INPUT);
DIRECT_MODE_INPUT(pin); DIRECT_MODE_INPUT(pin);
// GET ACKNOWLEDGE or TIMEOUT // GET ACKNOWLEDGE or TIMEOUT
uint16_t loopCntLOW = DHTLIB_TIMEOUT; uint16_t loopCntLOW = DHTLIB_TIMEOUT;
while (DIRECT_READ(pin) == LOW ) // T-rel while (DIRECT_READ(pin) == LOW ) // T-rel
{ {
os_delay_us(1); os_delay_us(1);
if (--loopCntLOW == 0) return DHTLIB_ERROR_TIMEOUT; if (--loopCntLOW == 0) return DHTLIB_ERROR_TIMEOUT;
} }
uint16_t loopCntHIGH = DHTLIB_TIMEOUT; uint16_t loopCntHIGH = DHTLIB_TIMEOUT;
while (DIRECT_READ(pin) != LOW ) // T-reh while (DIRECT_READ(pin) != LOW ) // T-reh
{ {
os_delay_us(1); os_delay_us(1);
if (--loopCntHIGH == 0) return DHTLIB_ERROR_TIMEOUT; if (--loopCntHIGH == 0) return DHTLIB_ERROR_TIMEOUT;
} }
// READ THE OUTPUT - 40 BITS => 5 BYTES // READ THE OUTPUT - 40 BITS => 5 BYTES
for (i = 40; i != 0; i--) for (i = 40; i != 0; i--)
{ {
loopCntLOW = DHTLIB_TIMEOUT; loopCntLOW = DHTLIB_TIMEOUT;
while (DIRECT_READ(pin) == LOW ) while (DIRECT_READ(pin) == LOW )
{ {
os_delay_us(1); os_delay_us(1);
if (--loopCntLOW == 0) return DHTLIB_ERROR_TIMEOUT; if (--loopCntLOW == 0) return DHTLIB_ERROR_TIMEOUT;
} }
uint32_t t = system_get_time(); uint32_t t = system_get_time();
loopCntHIGH = DHTLIB_TIMEOUT; loopCntHIGH = DHTLIB_TIMEOUT;
while (DIRECT_READ(pin) != LOW ) while (DIRECT_READ(pin) != LOW )
{ {
os_delay_us(1); os_delay_us(1);
if (--loopCntHIGH == 0) return DHTLIB_ERROR_TIMEOUT; if (--loopCntHIGH == 0) return DHTLIB_ERROR_TIMEOUT;
} }
if ((system_get_time() - t) > 40) if ((system_get_time() - t) > 40)
{ {
dht_bytes[idx] |= mask; dht_bytes[idx] |= mask;
} }
mask >>= 1; mask >>= 1;
if (mask == 0) // next byte? if (mask == 0) // next byte?
{ {
mask = 128; mask = 128;
idx++; idx++;
} }
} }
// Enable interrupts // Enable interrupts
ets_intr_unlock(); ets_intr_unlock();
// pinMode(pin, OUTPUT); // pinMode(pin, OUTPUT);
DIRECT_MODE_OUTPUT(pin); DIRECT_MODE_OUTPUT(pin);
// digitalWrite(pin, HIGH); // digitalWrite(pin, HIGH);
DIRECT_WRITE_HIGH(pin); DIRECT_WRITE_HIGH(pin);
return DHTLIB_OK; return DHTLIB_OK;
} }
// //
// END OF FILE // END OF FILE
// //

View File

@ -1,70 +1,70 @@
// //
// FILE: dht.h // FILE: dht.h
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// VERSION: 0.1.14 // VERSION: 0.1.14
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino // PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
// URL: http://arduino.cc/playground/Main/DHTLib // URL: http://arduino.cc/playground/Main/DHTLib
// //
// HISTORY: // HISTORY:
// see dht.cpp file // see dht.cpp file
// //
#ifndef dht_h #ifndef dht_h
#define dht_h #define dht_h
// #if ARDUINO < 100 // #if ARDUINO < 100
// #include <WProgram.h> // #include <WProgram.h>
// #else // #else
// #include <Arduino.h> // #include <Arduino.h>
// #endif // #endif
#include "c_types.h" #include "c_types.h"
#define DHT_LIB_VERSION "0.1.14" #define DHT_LIB_VERSION "0.1.14"
#define DHTLIB_OK 0 #define DHTLIB_OK 0
#define DHTLIB_ERROR_CHECKSUM -1 #define DHTLIB_ERROR_CHECKSUM -1
#define DHTLIB_ERROR_TIMEOUT -2 #define DHTLIB_ERROR_TIMEOUT -2
#define DHTLIB_INVALID_VALUE -999 #define DHTLIB_INVALID_VALUE -999
#define DHTLIB_DHT11_WAKEUP 18 #define DHTLIB_DHT11_WAKEUP 18
#define DHTLIB_DHT_WAKEUP 1 #define DHTLIB_DHT_WAKEUP 1
#define DHTLIB_DHT_UNI_WAKEUP 18 #define DHTLIB_DHT_UNI_WAKEUP 18
#define DHT_DEBUG #define DHT_DEBUG
// max timeout is 100 usec. // max timeout is 100 usec.
// For a 16 Mhz proc 100 usec is 1600 clock cycles // For a 16 Mhz proc 100 usec is 1600 clock cycles
// loops using DHTLIB_TIMEOUT use at least 4 clock cycli // loops using DHTLIB_TIMEOUT use at least 4 clock cycli
// so 100 us takes max 400 loops // so 100 us takes max 400 loops
// so by dividing F_CPU by 40000 we "fail" as fast as possible // so by dividing F_CPU by 40000 we "fail" as fast as possible
// ESP8266 uses delay_us get 1us time // ESP8266 uses delay_us get 1us time
#define DHTLIB_TIMEOUT (100) #define DHTLIB_TIMEOUT (100)
// Platform specific I/O definitions // Platform specific I/O definitions
#define DIRECT_READ(pin) (0x1 & GPIO_INPUT_GET(GPIO_ID_PIN(pin_num[pin]))) #define DIRECT_READ(pin) (0x1 & GPIO_INPUT_GET(GPIO_ID_PIN(pin_num[pin])))
#define DIRECT_MODE_INPUT(pin) GPIO_DIS_OUTPUT(pin_num[pin]) #define DIRECT_MODE_INPUT(pin) GPIO_DIS_OUTPUT(pin_num[pin])
#define DIRECT_MODE_OUTPUT(pin) #define DIRECT_MODE_OUTPUT(pin)
#define DIRECT_WRITE_LOW(pin) (GPIO_OUTPUT_SET(GPIO_ID_PIN(pin_num[pin]), 0)) #define DIRECT_WRITE_LOW(pin) (GPIO_OUTPUT_SET(GPIO_ID_PIN(pin_num[pin]), 0))
#define DIRECT_WRITE_HIGH(pin) (GPIO_OUTPUT_SET(GPIO_ID_PIN(pin_num[pin]), 1)) #define DIRECT_WRITE_HIGH(pin) (GPIO_OUTPUT_SET(GPIO_ID_PIN(pin_num[pin]), 1))
// return values: // return values:
// DHTLIB_OK // DHTLIB_OK
// DHTLIB_ERROR_CHECKSUM // DHTLIB_ERROR_CHECKSUM
// DHTLIB_ERROR_TIMEOUT // DHTLIB_ERROR_TIMEOUT
int dht_read_universal(uint8_t pin); int dht_read_universal(uint8_t pin);
int dht_read11(uint8_t pin); int dht_read11(uint8_t pin);
int dht_read(uint8_t pin); int dht_read(uint8_t pin);
int dht_read21(uint8_t pin); int dht_read21(uint8_t pin);
int dht_read22(uint8_t pin); int dht_read22(uint8_t pin);
int dht_read33(uint8_t pin); int dht_read33(uint8_t pin);
int dht_read44(uint8_t pin); int dht_read44(uint8_t pin);
double dht_getHumidity(void); double dht_getHumidity(void);
double dht_getTemperature(void); double dht_getTemperature(void);
#endif #endif
// //
// END OF FILE // END OF FILE
// //

View File

@ -24,7 +24,7 @@ STD_CFLAGS=-std=gnu11 -Wimplicit
# makefile at its root level - these are then overridden # makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein # for a subtree within the makefile rooted therein
# #
#DEFINES += #DEFINES +=
############################################################# #############################################################
# Recursion Magic - Don't touch this!! # Recursion Magic - Don't touch this!!

View File

@ -49,7 +49,7 @@ LOCAL uint8 *pwm_channel;
// Toggle flips between 1 and 0 when we make updates so that the interrupt code // Toggle flips between 1 and 0 when we make updates so that the interrupt code
// cn switch cleanly between the two states. The cinterrupt handler uses either // cn switch cleanly between the two states. The cinterrupt handler uses either
// the pwm_single_toggle[0] or pwm_single_toggle[1] // the pwm_single_toggle[0] or pwm_single_toggle[1]
// pwm_toggle indicates which state should be used on the *next* timer interrupt // pwm_toggle indicates which state should be used on the *next* timer interrupt
// freq boundary. // freq boundary.
LOCAL uint8 pwm_toggle = 1; LOCAL uint8 pwm_toggle = 1;
LOCAL volatile uint8 pwm_current_toggle = 1; LOCAL volatile uint8 pwm_current_toggle = 1;
@ -326,7 +326,7 @@ pwm_tim1_intr_handler(os_param_t p)
int offset = 0; int offset = 0;
while (1) { while (1) {
if (pwm_current_channel >= (*pwm_channel - 1)) { if (pwm_current_channel >= (*pwm_channel - 1)) {
pwm_single = pwm_single_toggle[pwm_toggle]; pwm_single = pwm_single_toggle[pwm_toggle];
pwm_channel = &pwm_channel_toggle[pwm_toggle]; pwm_channel = &pwm_channel_toggle[pwm_toggle];
pwm_current_toggle = pwm_toggle; pwm_current_toggle = pwm_toggle;
@ -388,7 +388,7 @@ pwm_init(uint16 freq, uint16 *duty)
// GPIO_OUTPUT_SET(GPIO_ID_PIN(PWM_0_OUT_IO_NUM), 0); // GPIO_OUTPUT_SET(GPIO_ID_PIN(PWM_0_OUT_IO_NUM), 0);
// GPIO_OUTPUT_SET(GPIO_ID_PIN(PWM_1_OUT_IO_NUM), 0); // GPIO_OUTPUT_SET(GPIO_ID_PIN(PWM_1_OUT_IO_NUM), 0);
// GPIO_OUTPUT_SET(GPIO_ID_PIN(PWM_2_OUT_IO_NUM), 0); // GPIO_OUTPUT_SET(GPIO_ID_PIN(PWM_2_OUT_IO_NUM), 0);
for (i = 0; i < PWM_CHANNEL; i++) { for (i = 0; i < PWM_CHANNEL; i++) {
// pwm_gpio |= (1 << pwm_out_io_num[i]); // pwm_gpio |= (1 << pwm_out_io_num[i]);
pwm_gpio = 0; pwm_gpio = 0;

View File

@ -20,7 +20,7 @@ bool uart_getc(char *c){
ETS_INTR_LOCK(); ETS_INTR_LOCK();
*c = (char)*(pRxBuff->pReadPos); *c = (char)*(pRxBuff->pReadPos);
if (pRxBuff->pReadPos == (pRxBuff->pRcvMsgBuff + RX_BUFF_SIZE)) { if (pRxBuff->pReadPos == (pRxBuff->pRcvMsgBuff + RX_BUFF_SIZE)) {
pRxBuff->pReadPos = pRxBuff->pRcvMsgBuff ; pRxBuff->pReadPos = pRxBuff->pRcvMsgBuff ;
} else { } else {
pRxBuff->pReadPos++; pRxBuff->pReadPos++;
} }
@ -73,7 +73,7 @@ start:
else else
continue; continue;
} }
/* end of line */ /* end of line */
if (ch == '\r' || ch == '\n') if (ch == '\r' || ch == '\n')
{ {

View File

@ -20,7 +20,7 @@
#include "ets_sys.h" #include "ets_sys.h"
// //
// Queue is empty if read == write. // Queue is empty if read == write.
// However, we always want to keep the previous value // However, we always want to keep the previous value
// so writing is only allowed if write - read < QUEUE_SIZE - 1 // so writing is only allowed if write - read < QUEUE_SIZE - 1
@ -60,7 +60,7 @@ static uint8_t task_queued;
static void set_gpio_bits(void); static void set_gpio_bits(void);
static void rotary_clear_pin(int pin) static void rotary_clear_pin(int pin)
{ {
if (pin >= 0) { if (pin >= 0) {
gpio_pin_intr_state_set(GPIO_ID_PIN(pin_num[pin]), GPIO_PIN_INTR_DISABLE); gpio_pin_intr_state_set(GPIO_ID_PIN(pin_num[pin]), GPIO_PIN_INTR_DISABLE);
@ -69,7 +69,7 @@ static void rotary_clear_pin(int pin)
} }
// Just takes the channel number. Cleans up the resources used. // Just takes the channel number. Cleans up the resources used.
int rotary_close(uint32_t channel) int rotary_close(uint32_t channel)
{ {
if (channel >= sizeof(data) / sizeof(data[0])) { if (channel >= sizeof(data) / sizeof(data[0])) {
return -1; return -1;
@ -94,7 +94,7 @@ int rotary_close(uint32_t channel)
return 0; return 0;
} }
static uint32_t ICACHE_RAM_ATTR rotary_interrupt(uint32_t ret_gpio_status) static uint32_t ICACHE_RAM_ATTR rotary_interrupt(uint32_t ret_gpio_status)
{ {
// This function really is running at interrupt level with everything // This function really is running at interrupt level with everything
// else masked off. It should take as little time as necessary. // else masked off. It should take as little time as necessary.
@ -168,10 +168,10 @@ static uint32_t ICACHE_RAM_ATTR rotary_interrupt(uint32_t ret_gpio_status)
} }
new_status |= rotary_pos & 0x7fffffff; new_status |= rotary_pos & 0x7fffffff;
if (last_status != new_status) { if (last_status != new_status) {
// Either we overwrite the status or we add a new one // Either we overwrite the status or we add a new one
if (!HAS_QUEUED_DATA(d) if (!HAS_QUEUED_DATA(d)
|| STATUS_IS_PRESSED(last_status ^ new_status) || STATUS_IS_PRESSED(last_status ^ new_status)
|| STATUS_IS_PRESSED(last_status ^ GET_PREV_STATUS(d).pos)) { || STATUS_IS_PRESSED(last_status ^ GET_PREV_STATUS(d).pos)) {
if (HAS_QUEUE_SPACE(d)) { if (HAS_QUEUE_SPACE(d)) {
@ -271,10 +271,10 @@ bool rotary_has_queued_event(uint32_t channel)
} }
// Get the oldest event in the queue and remove it (if possible) // Get the oldest event in the queue and remove it (if possible)
bool rotary_getevent(uint32_t channel, rotary_event_t *resultp) bool rotary_getevent(uint32_t channel, rotary_event_t *resultp)
{ {
rotary_event_t result = { 0 }; rotary_event_t result = { 0 };
if (channel >= sizeof(data) / sizeof(data[0])) { if (channel >= sizeof(data) / sizeof(data[0])) {
return FALSE; return FALSE;
} }

View File

@ -15,33 +15,33 @@ static uint32_t spi_clkdiv[2];
*******************************************************************************/ *******************************************************************************/
void spi_lcd_mode_init(uint8 spi_no) void spi_lcd_mode_init(uint8 spi_no)
{ {
uint32 regvalue; uint32 regvalue;
if(spi_no>1) return; //handle invalid input number if(spi_no>1) return; //handle invalid input number
//bit9 of PERIPHS_IO_MUX should be cleared when HSPI clock doesn't equal CPU clock //bit9 of PERIPHS_IO_MUX should be cleared when HSPI clock doesn't equal CPU clock
//bit8 of PERIPHS_IO_MUX should be cleared when SPI clock doesn't equal CPU clock //bit8 of PERIPHS_IO_MUX should be cleared when SPI clock doesn't equal CPU clock
if(spi_no==SPI_SPI){ if(spi_no==SPI_SPI){
WRITE_PERI_REG(PERIPHS_IO_MUX, 0x005); //clear bit9,and bit8 WRITE_PERI_REG(PERIPHS_IO_MUX, 0x005); //clear bit9,and bit8
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, 1);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, 1);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, 1);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, 1);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, 1);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, 1);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, 1);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, 1);//configure io to spi mode
}else if(spi_no==SPI_HSPI){ }else if(spi_no==SPI_HSPI){
WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105); //clear bit9 WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105); //clear bit9
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2);//configure io to spi mode
} }
SET_PERI_REG_MASK(SPI_USER(spi_no), SPI_CS_SETUP|SPI_CS_HOLD|SPI_USR_COMMAND); SET_PERI_REG_MASK(SPI_USER(spi_no), SPI_CS_SETUP|SPI_CS_HOLD|SPI_USR_COMMAND);
CLEAR_PERI_REG_MASK(SPI_USER(spi_no), SPI_FLASH_MODE); CLEAR_PERI_REG_MASK(SPI_USER(spi_no), SPI_FLASH_MODE);
// SPI clock=CPU clock/8 // SPI clock=CPU clock/8
WRITE_PERI_REG(SPI_CLOCK(spi_no), WRITE_PERI_REG(SPI_CLOCK(spi_no),
((1&SPI_CLKDIV_PRE)<<SPI_CLKDIV_PRE_S)| ((1&SPI_CLKDIV_PRE)<<SPI_CLKDIV_PRE_S)|
((3&SPI_CLKCNT_N)<<SPI_CLKCNT_N_S)| ((3&SPI_CLKCNT_N)<<SPI_CLKCNT_N_S)|
((1&SPI_CLKCNT_H)<<SPI_CLKCNT_H_S)| ((1&SPI_CLKCNT_H)<<SPI_CLKCNT_H_S)|
((3&SPI_CLKCNT_L)<<SPI_CLKCNT_L_S)); //clear bit 31,set SPI clock div ((3&SPI_CLKCNT_L)<<SPI_CLKCNT_L_S)); //clear bit 31,set SPI clock div
} }
/****************************************************************************** /******************************************************************************
* FunctionName : spi_lcd_9bit_write * FunctionName : spi_lcd_9bit_write
@ -55,11 +55,11 @@ void spi_lcd_9bit_write(uint8 spi_no,uint8 high_bit,uint8 low_8bit)
uint32 regvalue; uint32 regvalue;
uint8 bytetemp; uint8 bytetemp;
if(spi_no>1) return; //handle invalid input number if(spi_no>1) return; //handle invalid input number
if(high_bit) bytetemp=(low_8bit>>1)|0x80; if(high_bit) bytetemp=(low_8bit>>1)|0x80;
else bytetemp=(low_8bit>>1)&0x7f; else bytetemp=(low_8bit>>1)&0x7f;
regvalue= ((8&SPI_USR_COMMAND_BITLEN)<<SPI_USR_COMMAND_BITLEN_S)|((uint32)bytetemp); //configure transmission variable,9bit transmission length and first 8 command bit regvalue= ((8&SPI_USR_COMMAND_BITLEN)<<SPI_USR_COMMAND_BITLEN_S)|((uint32)bytetemp); //configure transmission variable,9bit transmission length and first 8 command bit
if(low_8bit&0x01) regvalue|=BIT15; //write the 9th bit if(low_8bit&0x01) regvalue|=BIT15; //write the 9th bit
while(READ_PERI_REG(SPI_CMD(spi_no))&SPI_USR); //waiting for spi module available while(READ_PERI_REG(SPI_CMD(spi_no))&SPI_USR); //waiting for spi module available
WRITE_PERI_REG(SPI_USER2(spi_no), regvalue); //write command and command length into spi reg WRITE_PERI_REG(SPI_USER2(spi_no), regvalue); //write command and command length into spi reg
@ -97,7 +97,7 @@ uint32_t spi_set_clkdiv(uint8 spi_no, uint32_t clock_div)
WRITE_PERI_REG(PERIPHS_IO_MUX, 0x005 | (clock_div <= 1 ? 0x100 : 0)); WRITE_PERI_REG(PERIPHS_IO_MUX, 0x005 | (clock_div <= 1 ? 0x100 : 0));
} }
else if(spi_no==SPI_HSPI){ else if(spi_no==SPI_HSPI){
WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105 | (clock_div <= 1 ? 0x200 : 0)); WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105 | (clock_div <= 1 ? 0x200 : 0));
} }
spi_clkdiv[spi_no] = clock_div; spi_clkdiv[spi_no] = clock_div;
@ -112,7 +112,7 @@ uint32_t spi_set_clkdiv(uint8 spi_no, uint32_t clock_div)
*******************************************************************************/ *******************************************************************************/
void spi_master_init(uint8 spi_no, unsigned cpol, unsigned cpha, uint32_t clock_div) void spi_master_init(uint8 spi_no, unsigned cpol, unsigned cpha, uint32_t clock_div)
{ {
uint32 regvalue; uint32 regvalue;
if(spi_no>1) return; //handle invalid input number if(spi_no>1) return; //handle invalid input number
@ -125,7 +125,7 @@ void spi_master_init(uint8 spi_no, unsigned cpol, unsigned cpha, uint32_t clock_
} else { } else {
CLEAR_PERI_REG_MASK(SPI_PIN(spi_no), SPI_IDLE_EDGE); CLEAR_PERI_REG_MASK(SPI_PIN(spi_no), SPI_IDLE_EDGE);
} }
//set clock phase //set clock phase
if (cpha == cpol) { if (cpha == cpol) {
// Mode 3: MOSI is set on falling edge of clock // Mode 3: MOSI is set on falling edge of clock
@ -133,8 +133,8 @@ void spi_master_init(uint8 spi_no, unsigned cpol, unsigned cpha, uint32_t clock_
CLEAR_PERI_REG_MASK(SPI_USER(spi_no), SPI_CK_OUT_EDGE); CLEAR_PERI_REG_MASK(SPI_USER(spi_no), SPI_CK_OUT_EDGE);
} else { } else {
// Mode 2: MOSI is set on rising edge of clock // Mode 2: MOSI is set on rising edge of clock
// Mode 1: MOSI is set on rising edge of clock // Mode 1: MOSI is set on rising edge of clock
SET_PERI_REG_MASK(SPI_USER(spi_no), SPI_CK_OUT_EDGE); SET_PERI_REG_MASK(SPI_USER(spi_no), SPI_CK_OUT_EDGE);
} }
CLEAR_PERI_REG_MASK(SPI_USER(spi_no), SPI_FLASH_MODE|SPI_USR_MISO|SPI_USR_ADDR|SPI_USR_COMMAND|SPI_USR_DUMMY); CLEAR_PERI_REG_MASK(SPI_USER(spi_no), SPI_FLASH_MODE|SPI_USR_MISO|SPI_USR_ADDR|SPI_USR_COMMAND|SPI_USR_DUMMY);
@ -146,15 +146,15 @@ void spi_master_init(uint8 spi_no, unsigned cpol, unsigned cpha, uint32_t clock_
if(spi_no==SPI_SPI){ if(spi_no==SPI_SPI){
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, 1);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, 1);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, 1);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, 1);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, 1);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, 1);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, 1);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, 1);//configure io to spi mode
} }
else if(spi_no==SPI_HSPI){ else if(spi_no==SPI_HSPI){
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2);//configure io to spi mode
} }
} }
@ -398,7 +398,7 @@ void spi_byte_write_espslave(uint8 spi_no,uint8 data)
//SPI_FLASH_USER2 bit28-31 is cmd length,cmd bit length is value(0-15)+1, //SPI_FLASH_USER2 bit28-31 is cmd length,cmd bit length is value(0-15)+1,
// bit15-0 is cmd value. // bit15-0 is cmd value.
//0x70000000 is for 8bits cmd, 0x04 is eps8266 slave write cmd value //0x70000000 is for 8bits cmd, 0x04 is eps8266 slave write cmd value
WRITE_PERI_REG(SPI_USER2(spi_no), WRITE_PERI_REG(SPI_USER2(spi_no),
((7&SPI_USR_COMMAND_BITLEN)<<SPI_USR_COMMAND_BITLEN_S)|4); ((7&SPI_USR_COMMAND_BITLEN)<<SPI_USR_COMMAND_BITLEN_S)|4);
WRITE_PERI_REG(SPI_W0(spi_no), (uint32)(data)); WRITE_PERI_REG(SPI_W0(spi_no), (uint32)(data));
SET_PERI_REG_MASK(SPI_CMD(spi_no), SPI_USR); SET_PERI_REG_MASK(SPI_CMD(spi_no), SPI_USR);
@ -424,10 +424,10 @@ void spi_byte_write_espslave(uint8 spi_no,uint8 data)
//SPI_FLASH_USER2 bit28-31 is cmd length,cmd bit length is value(0-15)+1, //SPI_FLASH_USER2 bit28-31 is cmd length,cmd bit length is value(0-15)+1,
// bit15-0 is cmd value. // bit15-0 is cmd value.
//0x70000000 is for 8bits cmd, 0x06 is eps8266 slave read cmd value //0x70000000 is for 8bits cmd, 0x06 is eps8266 slave read cmd value
WRITE_PERI_REG(SPI_USER2(spi_no), WRITE_PERI_REG(SPI_USER2(spi_no),
((7&SPI_USR_COMMAND_BITLEN)<<SPI_USR_COMMAND_BITLEN_S)|6); ((7&SPI_USR_COMMAND_BITLEN)<<SPI_USR_COMMAND_BITLEN_S)|6);
SET_PERI_REG_MASK(SPI_CMD(spi_no), SPI_USR); SET_PERI_REG_MASK(SPI_CMD(spi_no), SPI_USR);
while(READ_PERI_REG(SPI_CMD(spi_no))&SPI_USR); while(READ_PERI_REG(SPI_CMD(spi_no))&SPI_USR);
*data=(uint8)(READ_PERI_REG(SPI_W0(spi_no))&0xff); *data=(uint8)(READ_PERI_REG(SPI_W0(spi_no))&0xff);
} }
@ -440,7 +440,7 @@ void spi_byte_write_espslave(uint8 spi_no,uint8 data)
*******************************************************************************/ *******************************************************************************/
void spi_slave_init(uint8 spi_no) void spi_slave_init(uint8 spi_no)
{ {
uint32 regvalue; uint32 regvalue;
if(spi_no>1) if(spi_no>1)
return; //handle invalid input number return; //handle invalid input number
@ -450,29 +450,29 @@ void spi_slave_init(uint8 spi_no)
////WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105); //clear bit9//TEST ////WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105); //clear bit9//TEST
if(spi_no==SPI_SPI){ if(spi_no==SPI_SPI){
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, 1);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, 1);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, 1);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, 1);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, 1);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, 1);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, 1);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, 1);//configure io to spi mode
}else if(spi_no==SPI_HSPI){ }else if(spi_no==SPI_HSPI){
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2);//configure io to spi mode
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2);//configure io to spi mode PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2);//configure io to spi mode
} }
//regvalue=READ_PERI_REG(SPI_FLASH_SLAVE(spi_no)); //regvalue=READ_PERI_REG(SPI_FLASH_SLAVE(spi_no));
//slave mode,slave use buffers which are register "SPI_FLASH_C0~C15", enable trans done isr //slave mode,slave use buffers which are register "SPI_FLASH_C0~C15", enable trans done isr
//set bit 30 bit 29 bit9,bit9 is trans done isr mask //set bit 30 bit 29 bit9,bit9 is trans done isr mask
SET_PERI_REG_MASK( SPI_SLAVE(spi_no), SET_PERI_REG_MASK( SPI_SLAVE(spi_no),
SPI_SLAVE_MODE|SPI_SLV_WR_RD_BUF_EN| SPI_SLAVE_MODE|SPI_SLV_WR_RD_BUF_EN|
SPI_SLV_WR_BUF_DONE_EN|SPI_SLV_RD_BUF_DONE_EN| SPI_SLV_WR_BUF_DONE_EN|SPI_SLV_RD_BUF_DONE_EN|
SPI_SLV_WR_STA_DONE_EN|SPI_SLV_RD_STA_DONE_EN| SPI_SLV_WR_STA_DONE_EN|SPI_SLV_RD_STA_DONE_EN|
SPI_TRANS_DONE_EN); SPI_TRANS_DONE_EN);
//disable general trans intr //disable general trans intr
//CLEAR_PERI_REG_MASK(SPI_SLAVE(spi_no),SPI_TRANS_DONE_EN); //CLEAR_PERI_REG_MASK(SPI_SLAVE(spi_no),SPI_TRANS_DONE_EN);
CLEAR_PERI_REG_MASK(SPI_USER(spi_no), SPI_FLASH_MODE);//disable flash operation mode CLEAR_PERI_REG_MASK(SPI_USER(spi_no), SPI_FLASH_MODE);//disable flash operation mode
SET_PERI_REG_MASK(SPI_USER(spi_no),SPI_USR_MISO_HIGHPART);//SLAVE SEND DATA BUFFER IN C8-C15 SET_PERI_REG_MASK(SPI_USER(spi_no),SPI_USR_MISO_HIGHPART);//SLAVE SEND DATA BUFFER IN C8-C15
//////**************RUN WHEN SLAVE RECIEVE*******************/////// //////**************RUN WHEN SLAVE RECIEVE*******************///////
@ -482,12 +482,12 @@ void spi_slave_init(uint8 spi_no)
WRITE_PERI_REG(SPI_CLOCK(spi_no), 0); WRITE_PERI_REG(SPI_CLOCK(spi_no), 0);
/////***************************************************//////
//set 8 bit slave command length, because slave must have at least one bit addr, /////***************************************************//////
//8 bit slave+8bit addr, so master device first 2 bytes can be regarded as a command
//and the following bytes are datas, //set 8 bit slave command length, because slave must have at least one bit addr,
//8 bit slave+8bit addr, so master device first 2 bytes can be regarded as a command
//and the following bytes are datas,
//32 bytes input wil be stored in SPI_FLASH_C0-C7 //32 bytes input wil be stored in SPI_FLASH_C0-C7
//32 bytes output data should be set to SPI_FLASH_C8-C15 //32 bytes output data should be set to SPI_FLASH_C8-C15
WRITE_PERI_REG(SPI_USER2(spi_no), (0x7&SPI_USR_COMMAND_BITLEN)<<SPI_USR_COMMAND_BITLEN_S); //0x70000000 WRITE_PERI_REG(SPI_USER2(spi_no), (0x7&SPI_USR_COMMAND_BITLEN)<<SPI_USR_COMMAND_BITLEN_S); //0x70000000
@ -498,15 +498,15 @@ void spi_slave_init(uint8 spi_no)
((0x7&SPI_SLV_STATUS_BITLEN)<<SPI_SLV_STATUS_BITLEN_S)| ((0x7&SPI_SLV_STATUS_BITLEN)<<SPI_SLV_STATUS_BITLEN_S)|
((0x7&SPI_SLV_WR_ADDR_BITLEN)<<SPI_SLV_WR_ADDR_BITLEN_S)| ((0x7&SPI_SLV_WR_ADDR_BITLEN)<<SPI_SLV_WR_ADDR_BITLEN_S)|
((0x7&SPI_SLV_RD_ADDR_BITLEN)<<SPI_SLV_RD_ADDR_BITLEN_S)); ((0x7&SPI_SLV_RD_ADDR_BITLEN)<<SPI_SLV_RD_ADDR_BITLEN_S));
SET_PERI_REG_MASK(SPI_PIN(spi_no),BIT19);//BIT19
//maybe enable slave transmission liston SET_PERI_REG_MASK(SPI_PIN(spi_no),BIT19);//BIT19
//maybe enable slave transmission liston
SET_PERI_REG_MASK(SPI_CMD(spi_no),SPI_USR); SET_PERI_REG_MASK(SPI_CMD(spi_no),SPI_USR);
//register level2 isr function, which contains spi, hspi and i2s events //register level2 isr function, which contains spi, hspi and i2s events
ETS_SPI_INTR_ATTACH(spi_slave_isr_handler,NULL); ETS_SPI_INTR_ATTACH(spi_slave_isr_handler,NULL);
//enable level2 isr, which contains spi, hspi and i2s events //enable level2 isr, which contains spi, hspi and i2s events
ETS_SPI_INTR_ENABLE(); ETS_SPI_INTR_ENABLE();
} }
@ -531,7 +531,7 @@ void spi_slave_init(uint8 spi_no)
/****************************************************************************** /******************************************************************************
* FunctionName : hspi_master_readwrite_repeat * FunctionName : hspi_master_readwrite_repeat
* Description : SPI master test function for reading and writing esp8266 slave buffer, * Description : SPI master test function for reading and writing esp8266 slave buffer,
the function uses HSPI module the function uses HSPI module
*******************************************************************************/ *******************************************************************************/
os_timer_t timer2; os_timer_t timer2;
@ -556,7 +556,7 @@ void hspi_master_readwrite_repeat(void)
/****************************************************************************** /******************************************************************************
* FunctionName : spi_slave_isr_handler * FunctionName : spi_slave_isr_handler
* Description : SPI interrupt function, SPI HSPI and I2S interrupt can trig this function * Description : SPI interrupt function, SPI HSPI and I2S interrupt can trig this function
some basic operation like clear isr flag has been done, some basic operation like clear isr flag has been done,
and it is availible for adding user coder in the funtion and it is availible for adding user coder in the funtion
* Parameters : void *para- function parameter address, which has been registered in function spi_slave_init * Parameters : void *para- function parameter address, which has been registered in function spi_slave_init
*******************************************************************************/ *******************************************************************************/
@ -578,7 +578,7 @@ os_event_t * spiQueue;
#define DATA_ERROR 6 #define DATA_ERROR 6
#define STATUS_R_IN_RD 7 #define STATUS_R_IN_RD 7
//init the two intr line of slave //init the two intr line of slave
//gpio0: wr_ready ,and //gpio0: wr_ready ,and
//gpio2: rd_ready , controlled by slave //gpio2: rd_ready , controlled by slave
void ICACHE_FLASH_ATTR void ICACHE_FLASH_ATTR
gpio_init() gpio_init()
@ -600,32 +600,32 @@ void spi_slave_isr_handler(void *para)
static uint8 state =0; static uint8 state =0;
uint32 recv_data,send_data; uint32 recv_data,send_data;
if(READ_PERI_REG(0x3ff00020)&BIT4){ if(READ_PERI_REG(0x3ff00020)&BIT4){
//following 3 lines is to clear isr signal //following 3 lines is to clear isr signal
CLEAR_PERI_REG_MASK(SPI_SLAVE(SPI_SPI), 0x3ff); CLEAR_PERI_REG_MASK(SPI_SLAVE(SPI_SPI), 0x3ff);
}else if(READ_PERI_REG(0x3ff00020)&BIT7){ //bit7 is for hspi isr, }else if(READ_PERI_REG(0x3ff00020)&BIT7){ //bit7 is for hspi isr,
regvalue=READ_PERI_REG(SPI_SLAVE(SPI_HSPI)); regvalue=READ_PERI_REG(SPI_SLAVE(SPI_HSPI));
CLEAR_PERI_REG_MASK(SPI_SLAVE(SPI_HSPI), CLEAR_PERI_REG_MASK(SPI_SLAVE(SPI_HSPI),
SPI_TRANS_DONE_EN| SPI_TRANS_DONE_EN|
SPI_SLV_WR_STA_DONE_EN| SPI_SLV_WR_STA_DONE_EN|
SPI_SLV_RD_STA_DONE_EN| SPI_SLV_RD_STA_DONE_EN|
SPI_SLV_WR_BUF_DONE_EN| SPI_SLV_WR_BUF_DONE_EN|
SPI_SLV_RD_BUF_DONE_EN); SPI_SLV_RD_BUF_DONE_EN);
SET_PERI_REG_MASK(SPI_SLAVE(SPI_HSPI), SPI_SYNC_RESET); SET_PERI_REG_MASK(SPI_SLAVE(SPI_HSPI), SPI_SYNC_RESET);
CLEAR_PERI_REG_MASK(SPI_SLAVE(SPI_HSPI), CLEAR_PERI_REG_MASK(SPI_SLAVE(SPI_HSPI),
SPI_TRANS_DONE| SPI_TRANS_DONE|
SPI_SLV_WR_STA_DONE| SPI_SLV_WR_STA_DONE|
SPI_SLV_RD_STA_DONE| SPI_SLV_RD_STA_DONE|
SPI_SLV_WR_BUF_DONE| SPI_SLV_WR_BUF_DONE|
SPI_SLV_RD_BUF_DONE); SPI_SLV_RD_BUF_DONE);
SET_PERI_REG_MASK(SPI_SLAVE(SPI_HSPI), SET_PERI_REG_MASK(SPI_SLAVE(SPI_HSPI),
SPI_TRANS_DONE_EN| SPI_TRANS_DONE_EN|
SPI_SLV_WR_STA_DONE_EN| SPI_SLV_WR_STA_DONE_EN|
SPI_SLV_RD_STA_DONE_EN| SPI_SLV_RD_STA_DONE_EN|
SPI_SLV_WR_BUF_DONE_EN| SPI_SLV_WR_BUF_DONE_EN|
SPI_SLV_RD_BUF_DONE_EN); SPI_SLV_RD_BUF_DONE_EN);
if(regvalue&SPI_SLV_WR_BUF_DONE){ if(regvalue&SPI_SLV_WR_BUF_DONE){
GPIO_OUTPUT_SET(0, 0); GPIO_OUTPUT_SET(0, 0);
idx=0; idx=0;
while(idx<8){ while(idx<8){
@ -646,7 +646,7 @@ void spi_slave_isr_handler(void *para)
//system_os_post(USER_TASK_PRIO_1,WR_RD,regvalue); //system_os_post(USER_TASK_PRIO_1,WR_RD,regvalue);
} }
}else if(READ_PERI_REG(0x3ff00020)&BIT9){ //bit7 is for i2s isr, }else if(READ_PERI_REG(0x3ff00020)&BIT9){ //bit7 is for i2s isr,
} }
@ -698,19 +698,19 @@ void ICACHE_FLASH_ATTR
break; break;
case STATUS_W: case STATUS_W:
os_printf("SW ERR,Reg:%08x\n",e->par); os_printf("SW ERR,Reg:%08x\n",e->par);
break; break;
case TR_DONE_ALONE: case TR_DONE_ALONE:
os_printf("TD ALO ERR,Reg:%08x\n",e->par); os_printf("TD ALO ERR,Reg:%08x\n",e->par);
break; break;
case WR_RD: case WR_RD:
os_printf("WR&RD ERR,Reg:%08x\n",e->par); os_printf("WR&RD ERR,Reg:%08x\n",e->par);
break; break;
case DATA_ERROR: case DATA_ERROR:
os_printf("Data ERR,Reg:%08x\n",e->par); os_printf("Data ERR,Reg:%08x\n",e->par);
break; break;
case STATUS_R_IN_RD : case STATUS_R_IN_RD :
os_printf("SR ERR in RDPR,Reg:%08x\n",e->par); os_printf("SR ERR in RDPR,Reg:%08x\n",e->par);
break; break;
default: default:
break; break;
} }
@ -738,7 +738,7 @@ void ICACHE_FLASH_ATTR
os_printf("spi miso init\n\r"); os_printf("spi miso init\n\r");
set_miso_data(); set_miso_data();
#endif #endif
//os_timer_disarm(&spi_timer_test); //os_timer_disarm(&spi_timer_test);
//os_timer_setfn(&spi_timer_test, (os_timer_func_t *)set_miso_data, NULL);//wjl //os_timer_setfn(&spi_timer_test, (os_timer_func_t *)set_miso_data, NULL);//wjl
//os_timer_arm(&spi_timer_test,50,1); //os_timer_arm(&spi_timer_test,50,1);

View File

@ -1,6 +1,6 @@
/* /*
* Module for interfacing with Switec instrument steppers (and * Module for interfacing with Switec instrument steppers (and
* similar devices). These are the steppers that are used in automotive * similar devices). These are the steppers that are used in automotive
* instrument panels and the like. Run off 5 volts at low current. * instrument panels and the like. Run off 5 volts at low current.
* *
* Code inspired by: * Code inspired by:
@ -81,7 +81,7 @@ static void ICACHE_RAM_ATTR timer_interrupt(os_param_t);
// Just takes the channel number // Just takes the channel number
int switec_close(uint32_t channel) int switec_close(uint32_t channel)
{ {
if (channel >= sizeof(data) / sizeof(data[0])) { if (channel >= sizeof(data) / sizeof(data[0])) {
return -1; return -1;
@ -118,28 +118,28 @@ int switec_close(uint32_t channel)
return 0; return 0;
} }
static __attribute__((always_inline)) inline void write_io(DATA *d) static __attribute__((always_inline)) inline void write_io(DATA *d)
{ {
uint32_t pin_state = d->pinstate[d->current_state]; uint32_t pin_state = d->pinstate[d->current_state];
gpio_output_set(pin_state, d->mask & ~pin_state, 0, 0); gpio_output_set(pin_state, d->mask & ~pin_state, 0, 0);
} }
static __attribute__((always_inline)) inline void step_up(DATA *d) static __attribute__((always_inline)) inline void step_up(DATA *d)
{ {
d->current_step++; d->current_step++;
d->current_state = (d->current_state + 1) % N_STATES; d->current_state = (d->current_state + 1) % N_STATES;
write_io(d); write_io(d);
} }
static __attribute__((always_inline)) inline void step_down(DATA *d) static __attribute__((always_inline)) inline void step_down(DATA *d)
{ {
d->current_step--; d->current_step--;
d->current_state = (d->current_state + N_STATES - 1) % N_STATES; d->current_state = (d->current_state + N_STATES - 1) % N_STATES;
write_io(d); write_io(d);
} }
static void ICACHE_RAM_ATTR timer_interrupt(os_param_t p) static void ICACHE_RAM_ATTR timer_interrupt(os_param_t p)
{ {
// This function really is running at interrupt level with everything // This function really is running at interrupt level with everything
// else masked off. It should take as little time as necessary. // else masked off. It should take as little time as necessary.
@ -179,9 +179,9 @@ static void ICACHE_RAM_ATTR timer_interrupt(os_param_t p)
if (d->vel == 0) { if (d->vel == 0) {
d->dir = d->current_step < d->target_step ? 1 : -1; d->dir = d->current_step < d->target_step ? 1 : -1;
// do not set to 0 or it could go negative in case 2 below // do not set to 0 or it could go negative in case 2 below
d->vel = 1; d->vel = 1;
} }
// Move the pointer by one step in the correct direction // Move the pointer by one step in the correct direction
if (d->dir > 0) { if (d->dir > 0) {
step_up(d); step_up(d);
@ -192,7 +192,7 @@ static void ICACHE_RAM_ATTR timer_interrupt(os_param_t p)
// determine delta, number of steps in current direction to target. // determine delta, number of steps in current direction to target.
// may be negative if we are headed away from target // may be negative if we are headed away from target
int delta = d->dir > 0 ? d->target_step - d->current_step : d->current_step - d->target_step; int delta = d->dir > 0 ? d->target_step - d->current_step : d->current_step - d->target_step;
if (delta > 0) { if (delta > 0) {
// case 1 : moving towards target (maybe under accel or decel) // case 1 : moving towards target (maybe under accel or decel)
if (delta <= d->vel) { if (delta <= d->vel) {
@ -208,7 +208,7 @@ static void ICACHE_RAM_ATTR timer_interrupt(os_param_t p)
// case 2 : at or moving away from target (slow down!) // case 2 : at or moving away from target (slow down!)
d->vel--; d->vel--;
} }
// vel now defines delay // vel now defines delay
uint8_t row = 0; uint8_t row = 0;
// this is why vel must not be greater than the last vel in the table. // this is why vel must not be greater than the last vel in the table.
@ -232,7 +232,7 @@ static void ICACHE_RAM_ATTR timer_interrupt(os_param_t p)
if (need_to_wait < delay) { if (need_to_wait < delay) {
delay = need_to_wait; delay = need_to_wait;
} }
} }
if (delay < 1000000) { if (delay < 1000000) {
if (delay < 50) { if (delay < 50) {
@ -367,11 +367,11 @@ int switec_moveto(uint32_t channel, int pos)
} }
} }
return 0; return 0;
} }
// Get the current position, direction and target position // Get the current position, direction and target position
int switec_getpos(uint32_t channel, int32_t *pos, int32_t *dir, int32_t *target) int switec_getpos(uint32_t channel, int32_t *pos, int32_t *dir, int32_t *target)
{ {
if (channel >= sizeof(data) / sizeof(data[0])) { if (channel >= sizeof(data) / sizeof(data[0])) {
return -1; return -1;

View File

@ -307,7 +307,7 @@ uart0_rx_intr_handler(void *para)
} }
} }
static void static void
uart_autobaud_timeout(void *timer_arg) uart_autobaud_timeout(void *timer_arg)
{ {
uint32_t uart_no = (uint32_t) timer_arg; uint32_t uart_no = (uint32_t) timer_arg;
@ -325,7 +325,7 @@ uart_autobaud_timeout(void *timer_arg)
} }
#include "pm/swtimer.h" #include "pm/swtimer.h"
static void static void
uart_init_autobaud(uint32_t uart_no) uart_init_autobaud(uint32_t uart_no)
{ {
os_timer_setfn(&autobaud_timer, uart_autobaud_timeout, (void *) uart_no); os_timer_setfn(&autobaud_timer, uart_autobaud_timeout, (void *) uart_no);
@ -334,7 +334,7 @@ uart_init_autobaud(uint32_t uart_no)
os_timer_arm(&autobaud_timer, 100, TRUE); os_timer_arm(&autobaud_timer, 100, TRUE);
} }
static void static void
uart_stop_autobaud() uart_stop_autobaud()
{ {
os_timer_disarm(&autobaud_timer); os_timer_disarm(&autobaud_timer);

View File

@ -23,7 +23,7 @@ endif
# makefile at its root level - these are then overridden # makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein # for a subtree within the makefile rooted therein
# #
#DEFINES += -DGDBSTUB_REDIRECT_CONSOLE_OUTPUT #DEFINES += -DGDBSTUB_REDIRECT_CONSOLE_OUTPUT
############################################################# #############################################################
# Recursion Magic - Don't touch this!! # Recursion Magic - Don't touch this!!

View File

@ -10,9 +10,9 @@ and do some other magic to make everything work and compile under FreeRTOS.
#endif #endif
/* /*
Enable this to make the exception and debugging handlers switch to a private stack. This will use Enable this to make the exception and debugging handlers switch to a private stack. This will use
up 1K of RAM, but may be useful if you're debugging stack or stack pointer corruption problems. It's up 1K of RAM, but may be useful if you're debugging stack or stack pointer corruption problems. It's
normally disabled because not many situations need it. If for some reason the GDB communication normally disabled because not many situations need it. If for some reason the GDB communication
stops when you run into an error in your code, try enabling this. stops when you run into an error in your code, try enabling this.
*/ */
#ifndef GDBSTUB_USE_OWN_STACK #ifndef GDBSTUB_USE_OWN_STACK
@ -30,7 +30,7 @@ the gdbstub_init call.
#endif #endif
/* /*
Enabling this will redirect console output to GDB. This basically means that printf/os_printf output Enabling this will redirect console output to GDB. This basically means that printf/os_printf output
will show up in your gdb session, which is useful if you use gdb to do stuff. It also means that if will show up in your gdb session, which is useful if you use gdb to do stuff. It also means that if
you use a normal terminal, you can't read the printfs anymore. you use a normal terminal, you can't read the printfs anymore.
*/ */
@ -52,7 +52,7 @@ Gdbstub functions are placed in flash or IRAM using attributes, as defined here.
(and related) can always be in flash, because it's called in the normal code flow. The rest of the (and related) can always be in flash, because it's called in the normal code flow. The rest of the
gdbstub functions can be in flash too, but only if there's no chance of them being called when the gdbstub functions can be in flash too, but only if there's no chance of them being called when the
flash somehow is disabled (eg during SPI operations or flash write/erase operations). If the routines flash somehow is disabled (eg during SPI operations or flash write/erase operations). If the routines
are called when the flash is disabled (eg due to a Ctrl-C at the wrong time), the ESP8266 will most are called when the flash is disabled (eg due to a Ctrl-C at the wrong time), the ESP8266 will most
likely crash. likely crash.
*/ */
#define ATTR_GDBINIT ICACHE_FLASH_ATTR #define ATTR_GDBINIT ICACHE_FLASH_ATTR

View File

@ -46,9 +46,9 @@ The savedRegs struct:
*/ */
/* /*
This is the debugging exception routine; it's called by the debugging vector This is the debugging exception routine; it's called by the debugging vector
We arrive here with all regs intact except for a2. The old contents of A2 are saved We arrive here with all regs intact except for a2. The old contents of A2 are saved
into the DEBUG_EXCSAVE special function register. EPC is the original PC. into the DEBUG_EXCSAVE special function register. EPC is the original PC.
*/ */
gdbstub_debug_exception_entry: gdbstub_debug_exception_entry:
@ -170,7 +170,7 @@ DebugExceptionExit:
FreeRTOS exception handling code. For some reason or another, we can't just hook the main exception vector: it FreeRTOS exception handling code. For some reason or another, we can't just hook the main exception vector: it
seems FreeRTOS uses that for something else too (interrupts). FreeRTOS has its own fatal exception handler, and we seems FreeRTOS uses that for something else too (interrupts). FreeRTOS has its own fatal exception handler, and we
hook that. Unfortunately, that one is called from a few different places (eg directly in the DoubleExceptionVector) hook that. Unfortunately, that one is called from a few different places (eg directly in the DoubleExceptionVector)
so the precise location of the original register values are somewhat of a mystery when we arrive here... so the precise location of the original register values are somewhat of a mystery when we arrive here...
As a 'solution', we'll just decode the most common case of the user_fatal_exception_handler being called from As a 'solution', we'll just decode the most common case of the user_fatal_exception_handler being called from
the user exception handler vector: the user exception handler vector:
@ -350,14 +350,14 @@ gdbstub_set_hw_watchpoint:
bany a6, a5, return_w_error bany a6, a5, return_w_error
//Set watchpoint //Set watchpoint
wsr a2, DBREAKA wsr a2, DBREAKA
//Combine type and mask //Combine type and mask
movi a6, 0x3F movi a6, 0x3F
and a3, a3, a6 and a3, a3, a6
slli a4, a4, 30 slli a4, a4, 30
or a3, a3, a4 or a3, a3, a4
wsr a3, DBREAKC wsr a3, DBREAKC
// movi a2, 1 // movi a2, 1
mov a2, a3 mov a2, a3
isync isync

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* Copyright 2015 Espressif Systems * Copyright 2015 Espressif Systems
* *
* Description: A stub to make the ESP8266 debuggable by GDB over the serial * Description: A stub to make the ESP8266 debuggable by GDB over the serial
* port. * port.
* *
* License: ESPRESSIF MIT License * License: ESPRESSIF MIT License
@ -267,7 +267,7 @@ static int ATTR_GDBFN validWrAddr(int p) {
return 0; return 0;
} }
/* /*
Register file in the format lx106 gdb port expects it. Register file in the format lx106 gdb port expects it.
Inspired by gdb/regformats/reg-xtensa.dat from Inspired by gdb/regformats/reg-xtensa.dat from
https://github.com/jcmvbkbc/crosstool-NG/blob/lx106-g%2B%2B/overlays/xtensa_lx106.tar https://github.com/jcmvbkbc/crosstool-NG/blob/lx106-g%2B%2B/overlays/xtensa_lx106.tar
@ -470,7 +470,7 @@ static int ATTR_GDBFN gdbHandleCommand(unsigned char *cmd, int len) {
//Lower layer: grab a command packet and check the checksum //Lower layer: grab a command packet and check the checksum
//Calls gdbHandleCommand on the packet if the checksum is OK //Calls gdbHandleCommand on the packet if the checksum is OK
//Returns ST_OK on success, ST_ERR when checksum fails, a //Returns ST_OK on success, ST_ERR when checksum fails, a
//character if it is received instead of the GDB packet //character if it is received instead of the GDB packet
//start char. //start char.
static int ATTR_GDBFN gdbReadCommand() { static int ATTR_GDBFN gdbReadCommand() {
@ -580,7 +580,7 @@ void ATTR_GDBFN gdbstub_handle_debug_exception() {
while(gdbReadCommand()!=ST_CONT); while(gdbReadCommand()!=ST_CONT);
if ((gdbstub_savedRegs.reason&0x84)==0x4) { if ((gdbstub_savedRegs.reason&0x84)==0x4) {
//We stopped due to a watchpoint. We can't re-execute the current instruction //We stopped due to a watchpoint. We can't re-execute the current instruction
//because it will happily re-trigger the same watchpoint, so we emulate it //because it will happily re-trigger the same watchpoint, so we emulate it
//while we're still in debugger space. //while we're still in debugger space.
emulLdSt(); emulLdSt();
} else if ((gdbstub_savedRegs.reason&0x88)==0x8) { } else if ((gdbstub_savedRegs.reason&0x88)==0x8) {
@ -659,12 +659,12 @@ static void ATTR_GDBFN gdb_semihost_putchar1(char c) {
} }
#if !GDBSTUB_FREERTOS #if !GDBSTUB_FREERTOS
//The OS-less SDK uses the Xtensa HAL to handle exceptions. We can use those functions to catch any //The OS-less SDK uses the Xtensa HAL to handle exceptions. We can use those functions to catch any
//fatal exceptions and invoke the debugger when this happens. //fatal exceptions and invoke the debugger when this happens.
static void ATTR_GDBINIT install_exceptions() { static void ATTR_GDBINIT install_exceptions() {
int i; int i;
int exno[]={EXCCAUSE_ILLEGAL, EXCCAUSE_SYSCALL, EXCCAUSE_INSTR_ERROR, EXCCAUSE_LOAD_STORE_ERROR, int exno[]={EXCCAUSE_ILLEGAL, EXCCAUSE_SYSCALL, EXCCAUSE_INSTR_ERROR, EXCCAUSE_LOAD_STORE_ERROR,
EXCCAUSE_DIVIDE_BY_ZERO, EXCCAUSE_UNALIGNED, EXCCAUSE_INSTR_DATA_ERROR, EXCCAUSE_LOAD_STORE_DATA_ERROR, EXCCAUSE_DIVIDE_BY_ZERO, EXCCAUSE_UNALIGNED, EXCCAUSE_INSTR_DATA_ERROR, EXCCAUSE_LOAD_STORE_DATA_ERROR,
EXCCAUSE_INSTR_ADDR_ERROR, EXCCAUSE_LOAD_STORE_ADDR_ERROR, EXCCAUSE_INSTR_PROHIBITED, EXCCAUSE_INSTR_ADDR_ERROR, EXCCAUSE_LOAD_STORE_ADDR_ERROR, EXCCAUSE_INSTR_PROHIBITED,
EXCCAUSE_LOAD_PROHIBITED, EXCCAUSE_STORE_PROHIBITED}; EXCCAUSE_LOAD_PROHIBITED, EXCCAUSE_STORE_PROHIBITED};
for (i=0; i<(sizeof(exno)/sizeof(exno[0])); i++) { for (i=0; i<(sizeof(exno)/sizeof(exno[0])); i++) {
@ -708,9 +708,9 @@ static void ATTR_GDBFN uart_hdlr(void *arg, void *frame) {
//Copy registers the Xtensa HAL did save to gdbstub_savedRegs //Copy registers the Xtensa HAL did save to gdbstub_savedRegs
os_memcpy(&gdbstub_savedRegs, frame, 19*4); os_memcpy(&gdbstub_savedRegs, frame, 19*4);
gdbstub_savedRegs.a1=(uint32_t)frame+EXCEPTION_GDB_SP_OFFSET; gdbstub_savedRegs.a1=(uint32_t)frame+EXCEPTION_GDB_SP_OFFSET;
gdbstub_savedRegs.reason=0xff; //mark as user break reason gdbstub_savedRegs.reason=0xff; //mark as user break reason
ets_wdt_disable(); ets_wdt_disable();
sendReason(); sendReason();
xthal_set_intenable(0); xthal_set_intenable(0);
@ -749,9 +749,9 @@ void ATTR_GDBFN gdbstub_handle_uart_int(struct XTensa_rtos_int_frame_s *frame) {
for (x=2; x<16; x++) gdbstub_savedRegs.a[x-2]=frame->a[x]; for (x=2; x<16; x++) gdbstub_savedRegs.a[x-2]=frame->a[x];
// gdbstub_savedRegs.a1=(uint32_t)frame+EXCEPTION_GDB_SP_OFFSET; // gdbstub_savedRegs.a1=(uint32_t)frame+EXCEPTION_GDB_SP_OFFSET;
gdbstub_savedRegs.reason=0xff; //mark as user break reason gdbstub_savedRegs.reason=0xff; //mark as user break reason
// ets_wdt_disable(); // ets_wdt_disable();
sendReason(); sendReason();
while(gdbReadCommand()!=ST_CONT); while(gdbReadCommand()!=ST_CONT);

View File

@ -1,52 +1,52 @@
############################################################# #############################################################
# Required variables for each makefile # Required variables for each makefile
# Discard this section from all parent makefiles # Discard this section from all parent makefiles
# Expected variables (with automatic defaults): # Expected variables (with automatic defaults):
# CSRCS (all "C" files in the dir) # CSRCS (all "C" files in the dir)
# SUBDIRS (all subdirs with a Makefile) # SUBDIRS (all subdirs with a Makefile)
# GEN_LIBS - list of libs to be generated () # GEN_LIBS - list of libs to be generated ()
# GEN_IMAGES - list of images to be generated () # GEN_IMAGES - list of images to be generated ()
# COMPONENTS_xxx - a list of libs/objs in the form # COMPONENTS_xxx - a list of libs/objs in the form
# subdir/lib to be extracted and rolled up into # subdir/lib to be extracted and rolled up into
# a generated lib/image xxx.a () # a generated lib/image xxx.a ()
# #
ifndef PDIR ifndef PDIR
GEN_LIBS = libfatfs.a GEN_LIBS = libfatfs.a
endif endif
ifndef FATFS_INC_DIR ifndef FATFS_INC_DIR
FATFS_INC_DIR = ./ FATFS_INC_DIR = ./
endif endif
STD_CFLAGS=-std=gnu11 -Wimplicit -imacros $(FATFS_INC_DIR)fatfs_prefix_lib.h STD_CFLAGS=-std=gnu11 -Wimplicit -imacros $(FATFS_INC_DIR)fatfs_prefix_lib.h
############################################################# #############################################################
# Configuration i.e. compile options etc. # Configuration i.e. compile options etc.
# Target specific stuff (defines etc.) goes in here! # Target specific stuff (defines etc.) goes in here!
# Generally values applying to a tree are captured in the # Generally values applying to a tree are captured in the
# makefile at its root level - these are then overridden # makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein # for a subtree within the makefile rooted therein
# #
#DEFINES += #DEFINES +=
############################################################# #############################################################
# Recursion Magic - Don't touch this!! # Recursion Magic - Don't touch this!!
# #
# Each subtree potentially has an include directory # Each subtree potentially has an include directory
# corresponding to the common APIs applicable to modules # corresponding to the common APIs applicable to modules
# rooted at that subtree. Accordingly, the INCLUDE PATH # rooted at that subtree. Accordingly, the INCLUDE PATH
# of a module can only contain the include directories up # of a module can only contain the include directories up
# its parent path, and not its siblings # its parent path, and not its siblings
# #
# Required for each makefile to inherit from the parent # Required for each makefile to inherit from the parent
# #
INCLUDES := $(INCLUDES) -I $(PDIR)include INCLUDES := $(INCLUDES) -I $(PDIR)include
INCLUDES += -I ./ INCLUDES += -I ./
INCLUDES += -I ../platform INCLUDES += -I ../platform
INCLUDES += -I ../libc INCLUDES += -I ../libc
INCLUDES += -I ../lua INCLUDES += -I ../lua
PDIR := ../$(PDIR) PDIR := ../$(PDIR)
sinclude $(PDIR)Makefile sinclude $(PDIR)Makefile

View File

@ -1,119 +1,119 @@
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2016 */ /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2016 */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* If a working storage control module is available, it should be */ /* If a working storage control module is available, it should be */
/* attached to the FatFs via a glue function rather than modifying it. */ /* attached to the FatFs via a glue function rather than modifying it. */
/* This is an example of glue functions to attach various exsisting */ /* This is an example of glue functions to attach various exsisting */
/* storage control modules to the FatFs module with a defined API. */ /* storage control modules to the FatFs module with a defined API. */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
#include "ff.h" /* Obtains integer types */ #include "ff.h" /* Obtains integer types */
#include "diskio.h" /* FatFs lower layer API */ #include "diskio.h" /* FatFs lower layer API */
#include "sdcard.h" #include "sdcard.h"
static DSTATUS m_status = STA_NOINIT; static DSTATUS m_status = STA_NOINIT;
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* Get Drive Status */ /* Get Drive Status */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
DSTATUS disk_status ( DSTATUS disk_status (
BYTE pdrv /* Physical drive nmuber to identify the drive */ BYTE pdrv /* Physical drive nmuber to identify the drive */
) )
{ {
return m_status; return m_status;
} }
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* Inidialize a Drive */ /* Inidialize a Drive */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
DSTATUS disk_initialize ( DSTATUS disk_initialize (
BYTE pdrv /* Physical drive nmuber to identify the drive */ BYTE pdrv /* Physical drive nmuber to identify the drive */
) )
{ {
int result; int result;
if (platform_sdcard_init( 1, pdrv )) { if (platform_sdcard_init( 1, pdrv )) {
m_status &= ~STA_NOINIT; m_status &= ~STA_NOINIT;
} }
return m_status; return m_status;
} }
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* Read Sector(s) */ /* Read Sector(s) */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
DRESULT disk_read ( DRESULT disk_read (
BYTE pdrv, /* Physical drive nmuber to identify the drive */ BYTE pdrv, /* Physical drive nmuber to identify the drive */
BYTE *buff, /* Data buffer to store read data */ BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Sector address in LBA */ DWORD sector, /* Sector address in LBA */
UINT count /* Number of sectors to read */ UINT count /* Number of sectors to read */
) )
{ {
if (count == 1) { if (count == 1) {
if (! platform_sdcard_read_block( pdrv, sector, buff )) { if (! platform_sdcard_read_block( pdrv, sector, buff )) {
return RES_ERROR; return RES_ERROR;
} }
} else { } else {
if (! platform_sdcard_read_blocks( pdrv, sector, count, buff )) { if (! platform_sdcard_read_blocks( pdrv, sector, count, buff )) {
return RES_ERROR; return RES_ERROR;
} }
} }
return RES_OK; return RES_OK;
} }
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* Write Sector(s) */ /* Write Sector(s) */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
#if FF_FS_READONLY == 0 #if FF_FS_READONLY == 0
DRESULT disk_write ( DRESULT disk_write (
BYTE pdrv, /* Physical drive nmuber to identify the drive */ BYTE pdrv, /* Physical drive nmuber to identify the drive */
const BYTE *buff, /* Data to be written */ const BYTE *buff, /* Data to be written */
DWORD sector, /* Sector address in LBA */ DWORD sector, /* Sector address in LBA */
UINT count /* Number of sectors to write */ UINT count /* Number of sectors to write */
) )
{ {
if (count == 1) { if (count == 1) {
if (! platform_sdcard_write_block( pdrv, sector, buff )) { if (! platform_sdcard_write_block( pdrv, sector, buff )) {
return RES_ERROR; return RES_ERROR;
} }
} else { } else {
if (! platform_sdcard_write_blocks( pdrv, sector, count, buff )) { if (! platform_sdcard_write_blocks( pdrv, sector, count, buff )) {
return RES_ERROR; return RES_ERROR;
} }
} }
return RES_OK; return RES_OK;
} }
#endif #endif
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* Miscellaneous Functions */ /* Miscellaneous Functions */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
DRESULT disk_ioctl ( DRESULT disk_ioctl (
BYTE pdrv, /* Physical drive nmuber (0..) */ BYTE pdrv, /* Physical drive nmuber (0..) */
BYTE cmd, /* Control code */ BYTE cmd, /* Control code */
void *buff /* Buffer to send/receive control data */ void *buff /* Buffer to send/receive control data */
) )
{ {
switch (cmd) { switch (cmd) {
case CTRL_TRIM: /* no-op */ case CTRL_TRIM: /* no-op */
case CTRL_SYNC: /* no-op */ case CTRL_SYNC: /* no-op */
return RES_OK; return RES_OK;
default: /* anything else throws parameter error */ default: /* anything else throws parameter error */
return RES_PARERR; return RES_PARERR;
} }
} }

View File

@ -1,77 +1,77 @@
/*-----------------------------------------------------------------------/ /*-----------------------------------------------------------------------/
/ Low level disk interface modlue include file (C)ChaN, 2014 / / Low level disk interface modlue include file (C)ChaN, 2014 /
/-----------------------------------------------------------------------*/ /-----------------------------------------------------------------------*/
#ifndef _DISKIO_DEFINED #ifndef _DISKIO_DEFINED
#define _DISKIO_DEFINED #define _DISKIO_DEFINED
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Status of Disk Functions */ /* Status of Disk Functions */
typedef BYTE DSTATUS; typedef BYTE DSTATUS;
/* Results of Disk Functions */ /* Results of Disk Functions */
typedef enum { typedef enum {
RES_OK = 0, /* 0: Successful */ RES_OK = 0, /* 0: Successful */
RES_ERROR, /* 1: R/W Error */ RES_ERROR, /* 1: R/W Error */
RES_WRPRT, /* 2: Write Protected */ RES_WRPRT, /* 2: Write Protected */
RES_NOTRDY, /* 3: Not Ready */ RES_NOTRDY, /* 3: Not Ready */
RES_PARERR /* 4: Invalid Parameter */ RES_PARERR /* 4: Invalid Parameter */
} DRESULT; } DRESULT;
/*---------------------------------------*/ /*---------------------------------------*/
/* Prototypes for disk control functions */ /* Prototypes for disk control functions */
DSTATUS disk_initialize (BYTE pdrv); DSTATUS disk_initialize (BYTE pdrv);
DSTATUS disk_status (BYTE pdrv); DSTATUS disk_status (BYTE pdrv);
DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count); DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count); DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff); DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
/* Disk Status Bits (DSTATUS) */ /* Disk Status Bits (DSTATUS) */
#define STA_NOINIT 0x01 /* Drive not initialized */ #define STA_NOINIT 0x01 /* Drive not initialized */
#define STA_NODISK 0x02 /* No medium in the drive */ #define STA_NODISK 0x02 /* No medium in the drive */
#define STA_PROTECT 0x04 /* Write protected */ #define STA_PROTECT 0x04 /* Write protected */
/* Command code for disk_ioctrl fucntion */ /* Command code for disk_ioctrl fucntion */
/* Generic command (Used by FatFs) */ /* Generic command (Used by FatFs) */
#define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */ #define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */
#define GET_SECTOR_COUNT 1 /* Get media size (needed at FF_USE_MKFS == 1) */ #define GET_SECTOR_COUNT 1 /* Get media size (needed at FF_USE_MKFS == 1) */
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */ #define GET_SECTOR_SIZE 2 /* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at FF_USE_MKFS == 1) */ #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at FF_USE_MKFS == 1) */
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */ #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */
/* Generic command (Not used by FatFs) */ /* Generic command (Not used by FatFs) */
#define CTRL_POWER 5 /* Get/Set power status */ #define CTRL_POWER 5 /* Get/Set power status */
#define CTRL_LOCK 6 /* Lock/Unlock media removal */ #define CTRL_LOCK 6 /* Lock/Unlock media removal */
#define CTRL_EJECT 7 /* Eject media */ #define CTRL_EJECT 7 /* Eject media */
#define CTRL_FORMAT 8 /* Create physical format on the media */ #define CTRL_FORMAT 8 /* Create physical format on the media */
/* MMC/SDC specific ioctl command */ /* MMC/SDC specific ioctl command */
#define MMC_GET_TYPE 10 /* Get card type */ #define MMC_GET_TYPE 10 /* Get card type */
#define MMC_GET_CSD 11 /* Get CSD */ #define MMC_GET_CSD 11 /* Get CSD */
#define MMC_GET_CID 12 /* Get CID */ #define MMC_GET_CID 12 /* Get CID */
#define MMC_GET_OCR 13 /* Get OCR */ #define MMC_GET_OCR 13 /* Get OCR */
#define MMC_GET_SDSTAT 14 /* Get SD status */ #define MMC_GET_SDSTAT 14 /* Get SD status */
#define ISDIO_READ 55 /* Read data form SD iSDIO register */ #define ISDIO_READ 55 /* Read data form SD iSDIO register */
#define ISDIO_WRITE 56 /* Write data to SD iSDIO register */ #define ISDIO_WRITE 56 /* Write data to SD iSDIO register */
#define ISDIO_MRITE 57 /* Masked write data to SD iSDIO register */ #define ISDIO_MRITE 57 /* Masked write data to SD iSDIO register */
/* ATA/CF specific ioctl command */ /* ATA/CF specific ioctl command */
#define ATA_GET_REV 20 /* Get F/W revision */ #define ATA_GET_REV 20 /* Get F/W revision */
#define ATA_GET_MODEL 21 /* Get model name */ #define ATA_GET_MODEL 21 /* Get model name */
#define ATA_GET_SN 22 /* Get serial number */ #define ATA_GET_SN 22 /* Get serial number */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,405 +1,405 @@
/*----------------------------------------------------------------------------/ /*----------------------------------------------------------------------------/
/ FatFs - Generic FAT Filesystem module R0.13c / / FatFs - Generic FAT Filesystem module R0.13c /
/-----------------------------------------------------------------------------/ /-----------------------------------------------------------------------------/
/ /
/ Copyright (C) 2018, ChaN, all right reserved. / Copyright (C) 2018, ChaN, all right reserved.
/ /
/ FatFs module is an open source software. Redistribution and use of FatFs in / FatFs module is an open source software. Redistribution and use of FatFs in
/ source and binary forms, with or without modification, are permitted provided / source and binary forms, with or without modification, are permitted provided
/ that the following condition is met: / that the following condition is met:
/ 1. Redistributions of source code must retain the above copyright notice, / 1. Redistributions of source code must retain the above copyright notice,
/ this condition and the following disclaimer. / this condition and the following disclaimer.
/ /
/ This software is provided by the copyright holder and contributors "AS IS" / This software is provided by the copyright holder and contributors "AS IS"
/ and any warranties related to this software are DISCLAIMED. / and any warranties related to this software are DISCLAIMED.
/ The copyright owner or contributors be NOT LIABLE for any damages caused / The copyright owner or contributors be NOT LIABLE for any damages caused
/ by use of this software. / by use of this software.
/ /
/----------------------------------------------------------------------------*/ /----------------------------------------------------------------------------*/
#ifndef FF_DEFINED #ifndef FF_DEFINED
#define FF_DEFINED 86604 /* Revision ID */ #define FF_DEFINED 86604 /* Revision ID */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include "ffconf.h" /* FatFs configuration options */ #include "ffconf.h" /* FatFs configuration options */
#if FF_DEFINED != FFCONF_DEF #if FF_DEFINED != FFCONF_DEF
#error Wrong configuration file (ffconf.h). #error Wrong configuration file (ffconf.h).
#endif #endif
/* Integer types used for FatFs API */ /* Integer types used for FatFs API */
#if defined(_WIN32) /* Main development platform */ #if defined(_WIN32) /* Main development platform */
#define FF_INTDEF 2 #define FF_INTDEF 2
#include <windows.h> #include <windows.h>
typedef unsigned __int64 QWORD; typedef unsigned __int64 QWORD;
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* C99 or later */ #elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* C99 or later */
#define FF_INTDEF 2 #define FF_INTDEF 2
#include <stdint.h> #include <stdint.h>
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */ typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
typedef unsigned char BYTE; /* char must be 8-bit */ typedef unsigned char BYTE; /* char must be 8-bit */
typedef uint16_t WORD; /* 16-bit unsigned integer */ typedef uint16_t WORD; /* 16-bit unsigned integer */
typedef uint16_t WCHAR; /* 16-bit unsigned integer */ typedef uint16_t WCHAR; /* 16-bit unsigned integer */
typedef uint32_t DWORD; /* 32-bit unsigned integer */ typedef uint32_t DWORD; /* 32-bit unsigned integer */
typedef uint64_t QWORD; /* 64-bit unsigned integer */ typedef uint64_t QWORD; /* 64-bit unsigned integer */
#else /* Earlier than C99 */ #else /* Earlier than C99 */
#define FF_INTDEF 1 #define FF_INTDEF 1
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */ typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
typedef unsigned char BYTE; /* char must be 8-bit */ typedef unsigned char BYTE; /* char must be 8-bit */
typedef unsigned short WORD; /* 16-bit unsigned integer */ typedef unsigned short WORD; /* 16-bit unsigned integer */
typedef unsigned short WCHAR; /* 16-bit unsigned integer */ typedef unsigned short WCHAR; /* 16-bit unsigned integer */
typedef unsigned long DWORD; /* 32-bit unsigned integer */ typedef unsigned long DWORD; /* 32-bit unsigned integer */
#endif #endif
/* Definitions of volume management */ /* Definitions of volume management */
#if FF_MULTI_PARTITION /* Multiple partition configuration */ #if FF_MULTI_PARTITION /* Multiple partition configuration */
typedef struct { typedef struct {
BYTE pd; /* Physical drive number */ BYTE pd; /* Physical drive number */
BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */ BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
} PARTITION; } PARTITION;
extern PARTITION VolToPart[]; /* Volume - Partition resolution table */ extern PARTITION VolToPart[]; /* Volume - Partition resolution table */
#endif #endif
#if FF_STR_VOLUME_ID #if FF_STR_VOLUME_ID
#ifndef FF_VOLUME_STRS #ifndef FF_VOLUME_STRS
extern const char* VolumeStr[FF_VOLUMES]; /* User defied volume ID */ extern const char* VolumeStr[FF_VOLUMES]; /* User defied volume ID */
#endif #endif
#endif #endif
/* Type of path name strings on FatFs API */ /* Type of path name strings on FatFs API */
#ifndef _INC_TCHAR #ifndef _INC_TCHAR
#define _INC_TCHAR #define _INC_TCHAR
#if FF_USE_LFN && FF_LFN_UNICODE == 1 /* Unicode in UTF-16 encoding */ #if FF_USE_LFN && FF_LFN_UNICODE == 1 /* Unicode in UTF-16 encoding */
typedef WCHAR TCHAR; typedef WCHAR TCHAR;
#define _T(x) L ## x #define _T(x) L ## x
#define _TEXT(x) L ## x #define _TEXT(x) L ## x
#elif FF_USE_LFN && FF_LFN_UNICODE == 2 /* Unicode in UTF-8 encoding */ #elif FF_USE_LFN && FF_LFN_UNICODE == 2 /* Unicode in UTF-8 encoding */
typedef char TCHAR; typedef char TCHAR;
#define _T(x) u8 ## x #define _T(x) u8 ## x
#define _TEXT(x) u8 ## x #define _TEXT(x) u8 ## x
#elif FF_USE_LFN && FF_LFN_UNICODE == 3 /* Unicode in UTF-32 encoding */ #elif FF_USE_LFN && FF_LFN_UNICODE == 3 /* Unicode in UTF-32 encoding */
typedef DWORD TCHAR; typedef DWORD TCHAR;
#define _T(x) U ## x #define _T(x) U ## x
#define _TEXT(x) U ## x #define _TEXT(x) U ## x
#elif FF_USE_LFN && (FF_LFN_UNICODE < 0 || FF_LFN_UNICODE > 3) #elif FF_USE_LFN && (FF_LFN_UNICODE < 0 || FF_LFN_UNICODE > 3)
#error Wrong FF_LFN_UNICODE setting #error Wrong FF_LFN_UNICODE setting
#else /* ANSI/OEM code in SBCS/DBCS */ #else /* ANSI/OEM code in SBCS/DBCS */
typedef char TCHAR; typedef char TCHAR;
#define _T(x) x #define _T(x) x
#define _TEXT(x) x #define _TEXT(x) x
#endif #endif
#endif #endif
/* Type of file size variables */ /* Type of file size variables */
#if FF_FS_EXFAT #if FF_FS_EXFAT
#if FF_INTDEF != 2 #if FF_INTDEF != 2
#error exFAT feature wants C99 or later #error exFAT feature wants C99 or later
#endif #endif
typedef QWORD FSIZE_t; typedef QWORD FSIZE_t;
#else #else
typedef DWORD FSIZE_t; typedef DWORD FSIZE_t;
#endif #endif
/* Filesystem object structure (FATFS) */ /* Filesystem object structure (FATFS) */
typedef struct { typedef struct {
BYTE fs_type; /* Filesystem type (0:not mounted) */ BYTE fs_type; /* Filesystem type (0:not mounted) */
BYTE pdrv; /* Associated physical drive */ BYTE pdrv; /* Associated physical drive */
BYTE n_fats; /* Number of FATs (1 or 2) */ BYTE n_fats; /* Number of FATs (1 or 2) */
BYTE wflag; /* win[] flag (b0:dirty) */ BYTE wflag; /* win[] flag (b0:dirty) */
BYTE fsi_flag; /* FSINFO flags (b7:disabled, b0:dirty) */ BYTE fsi_flag; /* FSINFO flags (b7:disabled, b0:dirty) */
WORD id; /* Volume mount ID */ WORD id; /* Volume mount ID */
WORD n_rootdir; /* Number of root directory entries (FAT12/16) */ WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
WORD csize; /* Cluster size [sectors] */ WORD csize; /* Cluster size [sectors] */
#if FF_MAX_SS != FF_MIN_SS #if FF_MAX_SS != FF_MIN_SS
WORD ssize; /* Sector size (512, 1024, 2048 or 4096) */ WORD ssize; /* Sector size (512, 1024, 2048 or 4096) */
#endif #endif
#if FF_USE_LFN #if FF_USE_LFN
WCHAR* lfnbuf; /* LFN working buffer */ WCHAR* lfnbuf; /* LFN working buffer */
#endif #endif
#if FF_FS_EXFAT #if FF_FS_EXFAT
BYTE* dirbuf; /* Directory entry block scratchpad buffer for exFAT */ BYTE* dirbuf; /* Directory entry block scratchpad buffer for exFAT */
#endif #endif
#if FF_FS_REENTRANT #if FF_FS_REENTRANT
FF_SYNC_t sobj; /* Identifier of sync object */ FF_SYNC_t sobj; /* Identifier of sync object */
#endif #endif
#if !FF_FS_READONLY #if !FF_FS_READONLY
DWORD last_clst; /* Last allocated cluster */ DWORD last_clst; /* Last allocated cluster */
DWORD free_clst; /* Number of free clusters */ DWORD free_clst; /* Number of free clusters */
#endif #endif
#if FF_FS_RPATH #if FF_FS_RPATH
DWORD cdir; /* Current directory start cluster (0:root) */ DWORD cdir; /* Current directory start cluster (0:root) */
#if FF_FS_EXFAT #if FF_FS_EXFAT
DWORD cdc_scl; /* Containing directory start cluster (invalid when cdir is 0) */ DWORD cdc_scl; /* Containing directory start cluster (invalid when cdir is 0) */
DWORD cdc_size; /* b31-b8:Size of containing directory, b7-b0: Chain status */ DWORD cdc_size; /* b31-b8:Size of containing directory, b7-b0: Chain status */
DWORD cdc_ofs; /* Offset in the containing directory (invalid when cdir is 0) */ DWORD cdc_ofs; /* Offset in the containing directory (invalid when cdir is 0) */
#endif #endif
#endif #endif
DWORD n_fatent; /* Number of FAT entries (number of clusters + 2) */ DWORD n_fatent; /* Number of FAT entries (number of clusters + 2) */
DWORD fsize; /* Size of an FAT [sectors] */ DWORD fsize; /* Size of an FAT [sectors] */
DWORD volbase; /* Volume base sector */ DWORD volbase; /* Volume base sector */
DWORD fatbase; /* FAT base sector */ DWORD fatbase; /* FAT base sector */
DWORD dirbase; /* Root directory base sector/cluster */ DWORD dirbase; /* Root directory base sector/cluster */
DWORD database; /* Data base sector */ DWORD database; /* Data base sector */
#if FF_FS_EXFAT #if FF_FS_EXFAT
DWORD bitbase; /* Allocation bitmap base sector */ DWORD bitbase; /* Allocation bitmap base sector */
#endif #endif
DWORD winsect; /* Current sector appearing in the win[] */ DWORD winsect; /* Current sector appearing in the win[] */
BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */ BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
} FATFS; } FATFS;
/* Object ID and allocation information (FFOBJID) */ /* Object ID and allocation information (FFOBJID) */
typedef struct { typedef struct {
FATFS* fs; /* Pointer to the hosting volume of this object */ FATFS* fs; /* Pointer to the hosting volume of this object */
WORD id; /* Hosting volume mount ID */ WORD id; /* Hosting volume mount ID */
BYTE attr; /* Object attribute */ BYTE attr; /* Object attribute */
BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous, =3:fragmented in this session, b2:sub-directory stretched) */ BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous, =3:fragmented in this session, b2:sub-directory stretched) */
DWORD sclust; /* Object data start cluster (0:no cluster or root directory) */ DWORD sclust; /* Object data start cluster (0:no cluster or root directory) */
FSIZE_t objsize; /* Object size (valid when sclust != 0) */ FSIZE_t objsize; /* Object size (valid when sclust != 0) */
#if FF_FS_EXFAT #if FF_FS_EXFAT
DWORD n_cont; /* Size of first fragment - 1 (valid when stat == 3) */ DWORD n_cont; /* Size of first fragment - 1 (valid when stat == 3) */
DWORD n_frag; /* Size of last fragment needs to be written to FAT (valid when not zero) */ DWORD n_frag; /* Size of last fragment needs to be written to FAT (valid when not zero) */
DWORD c_scl; /* Containing directory start cluster (valid when sclust != 0) */ DWORD c_scl; /* Containing directory start cluster (valid when sclust != 0) */
DWORD c_size; /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */ DWORD c_size; /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */
DWORD c_ofs; /* Offset in the containing directory (valid when file object and sclust != 0) */ DWORD c_ofs; /* Offset in the containing directory (valid when file object and sclust != 0) */
#endif #endif
#if FF_FS_LOCK #if FF_FS_LOCK
UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */ UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */
#endif #endif
} FFOBJID; } FFOBJID;
/* File object structure (FIL) */ /* File object structure (FIL) */
typedef struct { typedef struct {
FFOBJID obj; /* Object identifier (must be the 1st member to detect invalid object pointer) */ FFOBJID obj; /* Object identifier (must be the 1st member to detect invalid object pointer) */
BYTE flag; /* File status flags */ BYTE flag; /* File status flags */
BYTE err; /* Abort flag (error code) */ BYTE err; /* Abort flag (error code) */
FSIZE_t fptr; /* File read/write pointer (Zeroed on file open) */ FSIZE_t fptr; /* File read/write pointer (Zeroed on file open) */
DWORD clust; /* Current cluster of fpter (invalid when fptr is 0) */ DWORD clust; /* Current cluster of fpter (invalid when fptr is 0) */
DWORD sect; /* Sector number appearing in buf[] (0:invalid) */ DWORD sect; /* Sector number appearing in buf[] (0:invalid) */
#if !FF_FS_READONLY #if !FF_FS_READONLY
DWORD dir_sect; /* Sector number containing the directory entry (not used at exFAT) */ DWORD dir_sect; /* Sector number containing the directory entry (not used at exFAT) */
BYTE* dir_ptr; /* Pointer to the directory entry in the win[] (not used at exFAT) */ BYTE* dir_ptr; /* Pointer to the directory entry in the win[] (not used at exFAT) */
#endif #endif
#if FF_USE_FASTSEEK #if FF_USE_FASTSEEK
DWORD* cltbl; /* Pointer to the cluster link map table (nulled on open, set by application) */ DWORD* cltbl; /* Pointer to the cluster link map table (nulled on open, set by application) */
#endif #endif
#if !FF_FS_TINY #if !FF_FS_TINY
BYTE buf[FF_MAX_SS]; /* File private data read/write window */ BYTE buf[FF_MAX_SS]; /* File private data read/write window */
#endif #endif
} FIL; } FIL;
/* Directory object structure (DIR) */ /* Directory object structure (DIR) */
typedef struct { typedef struct {
FFOBJID obj; /* Object identifier */ FFOBJID obj; /* Object identifier */
DWORD dptr; /* Current read/write offset */ DWORD dptr; /* Current read/write offset */
DWORD clust; /* Current cluster */ DWORD clust; /* Current cluster */
DWORD sect; /* Current sector (0:Read operation has terminated) */ DWORD sect; /* Current sector (0:Read operation has terminated) */
BYTE* dir; /* Pointer to the directory item in the win[] */ BYTE* dir; /* Pointer to the directory item in the win[] */
BYTE fn[12]; /* SFN (in/out) {body[8],ext[3],status[1]} */ BYTE fn[12]; /* SFN (in/out) {body[8],ext[3],status[1]} */
#if FF_USE_LFN #if FF_USE_LFN
DWORD blk_ofs; /* Offset of current entry block being processed (0xFFFFFFFF:Invalid) */ DWORD blk_ofs; /* Offset of current entry block being processed (0xFFFFFFFF:Invalid) */
#endif #endif
#if FF_USE_FIND #if FF_USE_FIND
const TCHAR* pat; /* Pointer to the name matching pattern */ const TCHAR* pat; /* Pointer to the name matching pattern */
#endif #endif
} DIR; } DIR;
/* File information structure (FILINFO) */ /* File information structure (FILINFO) */
typedef struct { typedef struct {
FSIZE_t fsize; /* File size */ FSIZE_t fsize; /* File size */
WORD fdate; /* Modified date */ WORD fdate; /* Modified date */
WORD ftime; /* Modified time */ WORD ftime; /* Modified time */
BYTE fattrib; /* File attribute */ BYTE fattrib; /* File attribute */
#if FF_USE_LFN #if FF_USE_LFN
TCHAR altname[FF_SFN_BUF + 1];/* Altenative file name */ TCHAR altname[FF_SFN_BUF + 1];/* Altenative file name */
TCHAR fname[FF_LFN_BUF + 1]; /* Primary file name */ TCHAR fname[FF_LFN_BUF + 1]; /* Primary file name */
#else #else
TCHAR fname[12 + 1]; /* File name */ TCHAR fname[12 + 1]; /* File name */
#endif #endif
} FILINFO; } FILINFO;
/* File function return code (FRESULT) */ /* File function return code (FRESULT) */
typedef enum { typedef enum {
FR_OK = 0, /* (0) Succeeded */ FR_OK = 0, /* (0) Succeeded */
FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */ FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */
FR_INT_ERR, /* (2) Assertion failed */ FR_INT_ERR, /* (2) Assertion failed */
FR_NOT_READY, /* (3) The physical drive cannot work */ FR_NOT_READY, /* (3) The physical drive cannot work */
FR_NO_FILE, /* (4) Could not find the file */ FR_NO_FILE, /* (4) Could not find the file */
FR_NO_PATH, /* (5) Could not find the path */ FR_NO_PATH, /* (5) Could not find the path */
FR_INVALID_NAME, /* (6) The path name format is invalid */ FR_INVALID_NAME, /* (6) The path name format is invalid */
FR_DENIED, /* (7) Access denied due to prohibited access or directory full */ FR_DENIED, /* (7) Access denied due to prohibited access or directory full */
FR_EXIST, /* (8) Access denied due to prohibited access */ FR_EXIST, /* (8) Access denied due to prohibited access */
FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */ FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */ FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */ FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
FR_NOT_ENABLED, /* (12) The volume has no work area */ FR_NOT_ENABLED, /* (12) The volume has no work area */
FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */ FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any problem */ FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any problem */
FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */ FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */ FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */ FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > FF_FS_LOCK */ FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > FF_FS_LOCK */
FR_INVALID_PARAMETER /* (19) Given parameter is invalid */ FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
} FRESULT; } FRESULT;
/*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/
/* FatFs module application interface */ /* FatFs module application interface */
FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */ FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
FRESULT f_close (FIL* fp); /* Close an open file object */ FRESULT f_close (FIL* fp); /* Close an open file object */
FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from the file */ FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from the file */
FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to the file */ FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to the file */
FRESULT f_lseek (FIL* fp, FSIZE_t ofs); /* Move file pointer of the file object */ FRESULT f_lseek (FIL* fp, FSIZE_t ofs); /* Move file pointer of the file object */
FRESULT f_truncate (FIL* fp); /* Truncate the file */ FRESULT f_truncate (FIL* fp); /* Truncate the file */
FRESULT f_sync (FIL* fp); /* Flush cached data of the writing file */ FRESULT f_sync (FIL* fp); /* Flush cached data of the writing file */
FRESULT f_opendir (DIR* dp, const TCHAR* path); /* Open a directory */ FRESULT f_opendir (DIR* dp, const TCHAR* path); /* Open a directory */
FRESULT f_closedir (DIR* dp); /* Close an open directory */ FRESULT f_closedir (DIR* dp); /* Close an open directory */
FRESULT f_readdir (DIR* dp, FILINFO* fno); /* Read a directory item */ FRESULT f_readdir (DIR* dp, FILINFO* fno); /* Read a directory item */
FRESULT f_findfirst (DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */ FRESULT f_findfirst (DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */
FRESULT f_findnext (DIR* dp, FILINFO* fno); /* Find next file */ FRESULT f_findnext (DIR* dp, FILINFO* fno); /* Find next file */
FRESULT f_mkdir (const TCHAR* path); /* Create a sub directory */ FRESULT f_mkdir (const TCHAR* path); /* Create a sub directory */
FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */ FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */
FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */ FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */
FRESULT f_stat (const TCHAR* path, FILINFO* fno); /* Get file status */ FRESULT f_stat (const TCHAR* path, FILINFO* fno); /* Get file status */
FRESULT f_chmod (const TCHAR* path, BYTE attr, BYTE mask); /* Change attribute of a file/dir */ FRESULT f_chmod (const TCHAR* path, BYTE attr, BYTE mask); /* Change attribute of a file/dir */
FRESULT f_utime (const TCHAR* path, const FILINFO* fno); /* Change timestamp of a file/dir */ FRESULT f_utime (const TCHAR* path, const FILINFO* fno); /* Change timestamp of a file/dir */
FRESULT f_chdir (const TCHAR* path); /* Change current directory */ FRESULT f_chdir (const TCHAR* path); /* Change current directory */
FRESULT f_chdrive (const TCHAR* path); /* Change current drive */ FRESULT f_chdrive (const TCHAR* path); /* Change current drive */
FRESULT f_getcwd (TCHAR* buff, UINT len); /* Get current directory */ FRESULT f_getcwd (TCHAR* buff, UINT len); /* Get current directory */
FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */ FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */
FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* vsn); /* Get volume label */ FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* vsn); /* Get volume label */
FRESULT f_setlabel (const TCHAR* label); /* Set volume label */ FRESULT f_setlabel (const TCHAR* label); /* Set volume label */
FRESULT f_forward (FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */ FRESULT f_forward (FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */
FRESULT f_expand (FIL* fp, FSIZE_t szf, BYTE opt); /* Allocate a contiguous block to the file */ FRESULT f_expand (FIL* fp, FSIZE_t szf, BYTE opt); /* Allocate a contiguous block to the file */
FRESULT f_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */ FRESULT f_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */
FRESULT f_mkfs (const TCHAR* path, BYTE opt, DWORD au, void* work, UINT len); /* Create a FAT volume */ FRESULT f_mkfs (const TCHAR* path, BYTE opt, DWORD au, void* work, UINT len); /* Create a FAT volume */
FRESULT f_fdisk (BYTE pdrv, const DWORD* szt, void* work); /* Divide a physical drive into some partitions */ FRESULT f_fdisk (BYTE pdrv, const DWORD* szt, void* work); /* Divide a physical drive into some partitions */
FRESULT f_setcp (WORD cp); /* Set current code page */ FRESULT f_setcp (WORD cp); /* Set current code page */
int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */ int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */
int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */ int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */
int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */ int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */
TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */ TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */
#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize)) #define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
#define f_error(fp) ((fp)->err) #define f_error(fp) ((fp)->err)
#define f_tell(fp) ((fp)->fptr) #define f_tell(fp) ((fp)->fptr)
#define f_size(fp) ((fp)->obj.objsize) #define f_size(fp) ((fp)->obj.objsize)
#define f_rewind(fp) f_lseek((fp), 0) #define f_rewind(fp) f_lseek((fp), 0)
#define f_rewinddir(dp) f_readdir((dp), 0) #define f_rewinddir(dp) f_readdir((dp), 0)
#define f_rmdir(path) f_unlink(path) #define f_rmdir(path) f_unlink(path)
#define f_unmount(path) f_mount(0, path, 0) #define f_unmount(path) f_mount(0, path, 0)
#ifndef EOF #ifndef EOF
#define EOF (-1) #define EOF (-1)
#endif #endif
/*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/
/* Additional user defined functions */ /* Additional user defined functions */
/* RTC function */ /* RTC function */
#if !FF_FS_READONLY && !FF_FS_NORTC #if !FF_FS_READONLY && !FF_FS_NORTC
DWORD get_fattime (void); DWORD get_fattime (void);
#endif #endif
/* LFN support functions */ /* LFN support functions */
#if FF_USE_LFN >= 1 /* Code conversion (defined in unicode.c) */ #if FF_USE_LFN >= 1 /* Code conversion (defined in unicode.c) */
WCHAR ff_oem2uni (WCHAR oem, WORD cp); /* OEM code to Unicode conversion */ WCHAR ff_oem2uni (WCHAR oem, WORD cp); /* OEM code to Unicode conversion */
WCHAR ff_uni2oem (DWORD uni, WORD cp); /* Unicode to OEM code conversion */ WCHAR ff_uni2oem (DWORD uni, WORD cp); /* Unicode to OEM code conversion */
DWORD ff_wtoupper (DWORD uni); /* Unicode upper-case conversion */ DWORD ff_wtoupper (DWORD uni); /* Unicode upper-case conversion */
#endif #endif
#if FF_USE_LFN == 3 /* Dynamic memory allocation */ #if FF_USE_LFN == 3 /* Dynamic memory allocation */
void* ff_memalloc (UINT msize); /* Allocate memory block */ void* ff_memalloc (UINT msize); /* Allocate memory block */
void ff_memfree (void* mblock); /* Free memory block */ void ff_memfree (void* mblock); /* Free memory block */
#endif #endif
/* Sync functions */ /* Sync functions */
#if FF_FS_REENTRANT #if FF_FS_REENTRANT
int ff_cre_syncobj (BYTE vol, FF_SYNC_t* sobj); /* Create a sync object */ int ff_cre_syncobj (BYTE vol, FF_SYNC_t* sobj); /* Create a sync object */
int ff_req_grant (FF_SYNC_t sobj); /* Lock sync object */ int ff_req_grant (FF_SYNC_t sobj); /* Lock sync object */
void ff_rel_grant (FF_SYNC_t sobj); /* Unlock sync object */ void ff_rel_grant (FF_SYNC_t sobj); /* Unlock sync object */
int ff_del_syncobj (FF_SYNC_t sobj); /* Delete a sync object */ int ff_del_syncobj (FF_SYNC_t sobj); /* Delete a sync object */
#endif #endif
/*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/
/* Flags and offset address */ /* Flags and offset address */
/* File access mode and open method flags (3rd argument of f_open) */ /* File access mode and open method flags (3rd argument of f_open) */
#define FA_READ 0x01 #define FA_READ 0x01
#define FA_WRITE 0x02 #define FA_WRITE 0x02
#define FA_OPEN_EXISTING 0x00 #define FA_OPEN_EXISTING 0x00
#define FA_CREATE_NEW 0x04 #define FA_CREATE_NEW 0x04
#define FA_CREATE_ALWAYS 0x08 #define FA_CREATE_ALWAYS 0x08
#define FA_OPEN_ALWAYS 0x10 #define FA_OPEN_ALWAYS 0x10
#define FA_OPEN_APPEND 0x30 #define FA_OPEN_APPEND 0x30
/* Fast seek controls (2nd argument of f_lseek) */ /* Fast seek controls (2nd argument of f_lseek) */
#define CREATE_LINKMAP ((FSIZE_t)0 - 1) #define CREATE_LINKMAP ((FSIZE_t)0 - 1)
/* Format options (2nd argument of f_mkfs) */ /* Format options (2nd argument of f_mkfs) */
#define FM_FAT 0x01 #define FM_FAT 0x01
#define FM_FAT32 0x02 #define FM_FAT32 0x02
#define FM_EXFAT 0x04 #define FM_EXFAT 0x04
#define FM_ANY 0x07 #define FM_ANY 0x07
#define FM_SFD 0x08 #define FM_SFD 0x08
/* Filesystem type (FATFS.fs_type) */ /* Filesystem type (FATFS.fs_type) */
#define FS_FAT12 1 #define FS_FAT12 1
#define FS_FAT16 2 #define FS_FAT16 2
#define FS_FAT32 3 #define FS_FAT32 3
#define FS_EXFAT 4 #define FS_EXFAT 4
/* File attribute bits for directory entry (FILINFO.fattrib) */ /* File attribute bits for directory entry (FILINFO.fattrib) */
#define AM_RDO 0x01 /* Read only */ #define AM_RDO 0x01 /* Read only */
#define AM_HID 0x02 /* Hidden */ #define AM_HID 0x02 /* Hidden */
#define AM_SYS 0x04 /* System */ #define AM_SYS 0x04 /* System */
#define AM_DIR 0x10 /* Directory */ #define AM_DIR 0x10 /* Directory */
#define AM_ARC 0x20 /* Archive */ #define AM_ARC 0x20 /* Archive */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* FF_DEFINED */ #endif /* FF_DEFINED */

View File

@ -1,290 +1,290 @@
/*---------------------------------------------------------------------------/ /*---------------------------------------------------------------------------/
/ FatFs Functional Configurations / FatFs Functional Configurations
/---------------------------------------------------------------------------*/ /---------------------------------------------------------------------------*/
#define FFCONF_DEF 86604 /* Revision ID */ #define FFCONF_DEF 86604 /* Revision ID */
#include "user_config.h" #include "user_config.h"
/*---------------------------------------------------------------------------/ /*---------------------------------------------------------------------------/
/ Function Configurations / Function Configurations
/---------------------------------------------------------------------------*/ /---------------------------------------------------------------------------*/
#define FF_FS_READONLY 0 #define FF_FS_READONLY 0
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only) /* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
/ Read-only configuration removes writing API functions, f_write(), f_sync(), / Read-only configuration removes writing API functions, f_write(), f_sync(),
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree() / f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
/ and optional writing functions as well. */ / and optional writing functions as well. */
#define FF_FS_MINIMIZE 0 #define FF_FS_MINIMIZE 0
/* This option defines minimization level to remove some basic API functions. /* This option defines minimization level to remove some basic API functions.
/ /
/ 0: Basic functions are fully enabled. / 0: Basic functions are fully enabled.
/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename() / 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename()
/ are removed. / are removed.
/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1. / 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
/ 3: f_lseek() function is removed in addition to 2. */ / 3: f_lseek() function is removed in addition to 2. */
#define FF_USE_STRFUNC 0 #define FF_USE_STRFUNC 0
/* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf(). /* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf().
/ /
/ 0: Disable string functions. / 0: Disable string functions.
/ 1: Enable without LF-CRLF conversion. / 1: Enable without LF-CRLF conversion.
/ 2: Enable with LF-CRLF conversion. */ / 2: Enable with LF-CRLF conversion. */
#define FF_USE_FIND 0 #define FF_USE_FIND 0
/* This option switches filtered directory read functions, f_findfirst() and /* This option switches filtered directory read functions, f_findfirst() and
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */ / f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
#define FF_USE_MKFS 0 #define FF_USE_MKFS 0
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */ /* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
#define FF_USE_FASTSEEK 0 #define FF_USE_FASTSEEK 0
/* This option switches fast seek function. (0:Disable or 1:Enable) */ /* This option switches fast seek function. (0:Disable or 1:Enable) */
#define FF_USE_EXPAND 0 #define FF_USE_EXPAND 0
/* This option switches f_expand function. (0:Disable or 1:Enable) */ /* This option switches f_expand function. (0:Disable or 1:Enable) */
#define FF_USE_CHMOD 1 #define FF_USE_CHMOD 1
/* This option switches attribute manipulation functions, f_chmod() and f_utime(). /* This option switches attribute manipulation functions, f_chmod() and f_utime().
/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */ / (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
#define FF_USE_LABEL 1 #define FF_USE_LABEL 1
/* This option switches volume label functions, f_getlabel() and f_setlabel(). /* This option switches volume label functions, f_getlabel() and f_setlabel().
/ (0:Disable or 1:Enable) */ / (0:Disable or 1:Enable) */
#define FF_USE_FORWARD 0 #define FF_USE_FORWARD 0
/* This option switches f_forward() function. (0:Disable or 1:Enable) */ /* This option switches f_forward() function. (0:Disable or 1:Enable) */
/*---------------------------------------------------------------------------/ /*---------------------------------------------------------------------------/
/ Locale and Namespace Configurations / Locale and Namespace Configurations
/---------------------------------------------------------------------------*/ /---------------------------------------------------------------------------*/
#define FF_CODE_PAGE 932 #define FF_CODE_PAGE 932
/* This option specifies the OEM code page to be used on the target system. /* This option specifies the OEM code page to be used on the target system.
/ Incorrect code page setting can cause a file open failure. / Incorrect code page setting can cause a file open failure.
/ /
/ 437 - U.S. / 437 - U.S.
/ 720 - Arabic / 720 - Arabic
/ 737 - Greek / 737 - Greek
/ 771 - KBL / 771 - KBL
/ 775 - Baltic / 775 - Baltic
/ 850 - Latin 1 / 850 - Latin 1
/ 852 - Latin 2 / 852 - Latin 2
/ 855 - Cyrillic / 855 - Cyrillic
/ 857 - Turkish / 857 - Turkish
/ 860 - Portuguese / 860 - Portuguese
/ 861 - Icelandic / 861 - Icelandic
/ 862 - Hebrew / 862 - Hebrew
/ 863 - Canadian French / 863 - Canadian French
/ 864 - Arabic / 864 - Arabic
/ 865 - Nordic / 865 - Nordic
/ 866 - Russian / 866 - Russian
/ 869 - Greek 2 / 869 - Greek 2
/ 932 - Japanese (DBCS) / 932 - Japanese (DBCS)
/ 936 - Simplified Chinese (DBCS) / 936 - Simplified Chinese (DBCS)
/ 949 - Korean (DBCS) / 949 - Korean (DBCS)
/ 950 - Traditional Chinese (DBCS) / 950 - Traditional Chinese (DBCS)
/ 0 - Include all code pages above and configured by f_setcp() / 0 - Include all code pages above and configured by f_setcp()
*/ */
#define FF_USE_LFN 3 #define FF_USE_LFN 3
#define FF_MAX_LFN (FS_OBJ_NAME_LEN+1+1) #define FF_MAX_LFN (FS_OBJ_NAME_LEN+1+1)
/* The FF_USE_LFN switches the support for LFN (long file name). /* The FF_USE_LFN switches the support for LFN (long file name).
/ /
/ 0: Disable LFN. FF_MAX_LFN has no effect. / 0: Disable LFN. FF_MAX_LFN has no effect.
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe. / 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
/ 2: Enable LFN with dynamic working buffer on the STACK. / 2: Enable LFN with dynamic working buffer on the STACK.
/ 3: Enable LFN with dynamic working buffer on the HEAP. / 3: Enable LFN with dynamic working buffer on the HEAP.
/ /
/ To enable the LFN, ffunicode.c needs to be added to the project. The LFN function / To enable the LFN, ffunicode.c needs to be added to the project. The LFN function
/ requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and / requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and
/ additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled. / additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled.
/ The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can / The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can
/ be in range of 12 to 255. It is recommended to be set 255 to fully support LFN / be in range of 12 to 255. It is recommended to be set 255 to fully support LFN
/ specification. / specification.
/ When use stack for the working buffer, take care on stack overflow. When use heap / When use stack for the working buffer, take care on stack overflow. When use heap
/ memory for the working buffer, memory management functions, ff_memalloc() and / memory for the working buffer, memory management functions, ff_memalloc() and
/ ff_memfree() in ffsystem.c, need to be added to the project. */ / ff_memfree() in ffsystem.c, need to be added to the project. */
#define FF_LFN_UNICODE 0 #define FF_LFN_UNICODE 0
/* This option switches the character encoding on the API when LFN is enabled. /* This option switches the character encoding on the API when LFN is enabled.
/ /
/ 0: ANSI/OEM in current CP (TCHAR = char) / 0: ANSI/OEM in current CP (TCHAR = char)
/ 1: Unicode in UTF-16 (TCHAR = WCHAR) / 1: Unicode in UTF-16 (TCHAR = WCHAR)
/ 2: Unicode in UTF-8 (TCHAR = char) / 2: Unicode in UTF-8 (TCHAR = char)
/ 3: Unicode in UTF-32 (TCHAR = DWORD) / 3: Unicode in UTF-32 (TCHAR = DWORD)
/ /
/ Also behavior of string I/O functions will be affected by this option. / Also behavior of string I/O functions will be affected by this option.
/ When LFN is not enabled, this option has no effect. */ / When LFN is not enabled, this option has no effect. */
#define FF_LFN_BUF 255 #define FF_LFN_BUF 255
#define FF_SFN_BUF 12 #define FF_SFN_BUF 12
/* This set of options defines size of file name members in the FILINFO structure /* This set of options defines size of file name members in the FILINFO structure
/ which is used to read out directory items. These values should be suffcient for / which is used to read out directory items. These values should be suffcient for
/ the file names to read. The maximum possible length of the read file name depends / the file names to read. The maximum possible length of the read file name depends
/ on character encoding. When LFN is not enabled, these options have no effect. */ / on character encoding. When LFN is not enabled, these options have no effect. */
#define FF_STRF_ENCODE 3 #define FF_STRF_ENCODE 3
/* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(), /* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(),
/ f_putc(), f_puts and f_printf() convert the character encoding in it. / f_putc(), f_puts and f_printf() convert the character encoding in it.
/ This option selects assumption of character encoding ON THE FILE to be / This option selects assumption of character encoding ON THE FILE to be
/ read/written via those functions. / read/written via those functions.
/ /
/ 0: ANSI/OEM in current CP / 0: ANSI/OEM in current CP
/ 1: Unicode in UTF-16LE / 1: Unicode in UTF-16LE
/ 2: Unicode in UTF-16BE / 2: Unicode in UTF-16BE
/ 3: Unicode in UTF-8 / 3: Unicode in UTF-8
*/ */
#define FF_FS_RPATH 2 #define FF_FS_RPATH 2
/* This option configures support for relative path. /* This option configures support for relative path.
/ /
/ 0: Disable relative path and remove related functions. / 0: Disable relative path and remove related functions.
/ 1: Enable relative path. f_chdir() and f_chdrive() are available. / 1: Enable relative path. f_chdir() and f_chdrive() are available.
/ 2: f_getcwd() function is available in addition to 1. / 2: f_getcwd() function is available in addition to 1.
*/ */
/*---------------------------------------------------------------------------/ /*---------------------------------------------------------------------------/
/ Drive/Volume Configurations / Drive/Volume Configurations
/---------------------------------------------------------------------------*/ /---------------------------------------------------------------------------*/
#define FF_VOLUMES 4 #define FF_VOLUMES 4
/* Number of volumes (logical drives) to be used. (1-10) */ /* Number of volumes (logical drives) to be used. (1-10) */
#define FF_STR_VOLUME_ID 1 #define FF_STR_VOLUME_ID 1
#define FF_VOLUME_STRS "SD0","SD1","SD2","SD3" #define FF_VOLUME_STRS "SD0","SD1","SD2","SD3"
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings. /* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive / When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each / number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
/ logical drives. Number of items must not be less than FF_VOLUMES. Valid / logical drives. Number of items must not be less than FF_VOLUMES. Valid
/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are / characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is / compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
/ not defined, a user defined volume string table needs to be defined as: / not defined, a user defined volume string table needs to be defined as:
/ /
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",... / const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
*/ */
#define FF_MULTI_PARTITION 1 #define FF_MULTI_PARTITION 1
/* This option switches support for multiple volumes on the physical drive. /* This option switches support for multiple volumes on the physical drive.
/ By default (0), each logical drive number is bound to the same physical drive / By default (0), each logical drive number is bound to the same physical drive
/ number and only an FAT volume found on the physical drive will be mounted. / number and only an FAT volume found on the physical drive will be mounted.
/ When this function is enabled (1), each logical drive number can be bound to / When this function is enabled (1), each logical drive number can be bound to
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk() / arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
/ funciton will be available. */ / funciton will be available. */
#define FF_MIN_SS 512 #define FF_MIN_SS 512
#define FF_MAX_SS 512 #define FF_MAX_SS 512
/* This set of options configures the range of sector size to be supported. (512, /* This set of options configures the range of sector size to be supported. (512,
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and / 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
/ harddisk. But a larger value may be required for on-board flash memory and some / harddisk. But a larger value may be required for on-board flash memory and some
/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured / type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
/ for variable sector size mode and disk_ioctl() function needs to implement / for variable sector size mode and disk_ioctl() function needs to implement
/ GET_SECTOR_SIZE command. */ / GET_SECTOR_SIZE command. */
#define FF_USE_TRIM 0 #define FF_USE_TRIM 0
/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable) /* This option switches support for ATA-TRIM. (0:Disable or 1:Enable)
/ To enable Trim function, also CTRL_TRIM command should be implemented to the / To enable Trim function, also CTRL_TRIM command should be implemented to the
/ disk_ioctl() function. */ / disk_ioctl() function. */
#define FF_FS_NOFSINFO 0 #define FF_FS_NOFSINFO 0
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this /* If you need to know correct free space on the FAT32 volume, set bit 0 of this
/ option, and f_getfree() function at first time after volume mount will force / option, and f_getfree() function at first time after volume mount will force
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number. / a full FAT scan. Bit 1 controls the use of last allocated cluster number.
/ /
/ bit0=0: Use free cluster count in the FSINFO if available. / bit0=0: Use free cluster count in the FSINFO if available.
/ bit0=1: Do not trust free cluster count in the FSINFO. / bit0=1: Do not trust free cluster count in the FSINFO.
/ bit1=0: Use last allocated cluster number in the FSINFO if available. / bit1=0: Use last allocated cluster number in the FSINFO if available.
/ bit1=1: Do not trust last allocated cluster number in the FSINFO. / bit1=1: Do not trust last allocated cluster number in the FSINFO.
*/ */
/*---------------------------------------------------------------------------/ /*---------------------------------------------------------------------------/
/ System Configurations / System Configurations
/---------------------------------------------------------------------------*/ /---------------------------------------------------------------------------*/
#define FF_FS_TINY 0 #define FF_FS_TINY 0
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny) /* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes. / At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes.
/ Instead of private sector buffer eliminated from the file object, common sector / Instead of private sector buffer eliminated from the file object, common sector
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */ / buffer in the filesystem object (FATFS) is used for the file data transfer. */
#define FF_FS_EXFAT 0 #define FF_FS_EXFAT 0
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable) /* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1) / To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */ / Note that enabling exFAT discards ANSI C (C89) compatibility. */
#define FF_FS_NORTC 0 #define FF_FS_NORTC 0
#define FF_NORTC_MON 1 #define FF_NORTC_MON 1
#define FF_NORTC_MDAY 1 #define FF_NORTC_MDAY 1
#define FF_NORTC_YEAR 2018 #define FF_NORTC_YEAR 2018
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have /* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable / any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp / the timestamp function. Every object modified by FatFs will have a fixed timestamp
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time. / defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be / To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
/ added to the project to read current time form real-time clock. FF_NORTC_MON, / added to the project to read current time form real-time clock. FF_NORTC_MON,
/ FF_NORTC_MDAY and FF_NORTC_YEAR have no effect. / FF_NORTC_MDAY and FF_NORTC_YEAR have no effect.
/ These options have no effect at read-only configuration (FF_FS_READONLY = 1). */ / These options have no effect at read-only configuration (FF_FS_READONLY = 1). */
#define FF_FS_LOCK 0 #define FF_FS_LOCK 0
/* The option FF_FS_LOCK switches file lock function to control duplicated file open /* The option FF_FS_LOCK switches file lock function to control duplicated file open
/ and illegal operation to open objects. This option must be 0 when FF_FS_READONLY / and illegal operation to open objects. This option must be 0 when FF_FS_READONLY
/ is 1. / is 1.
/ /
/ 0: Disable file lock function. To avoid volume corruption, application program / 0: Disable file lock function. To avoid volume corruption, application program
/ should avoid illegal open, remove and rename to the open objects. / should avoid illegal open, remove and rename to the open objects.
/ >0: Enable file lock function. The value defines how many files/sub-directories / >0: Enable file lock function. The value defines how many files/sub-directories
/ can be opened simultaneously under file lock control. Note that the file / can be opened simultaneously under file lock control. Note that the file
/ lock control is independent of re-entrancy. */ / lock control is independent of re-entrancy. */
/* #include <somertos.h> // O/S definitions */ /* #include <somertos.h> // O/S definitions */
#define FF_FS_REENTRANT 0 #define FF_FS_REENTRANT 0
#define FF_FS_TIMEOUT 1000 #define FF_FS_TIMEOUT 1000
#define FF_SYNC_t HANDLE #define FF_SYNC_t HANDLE
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs /* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
/ module itself. Note that regardless of this option, file access to different / module itself. Note that regardless of this option, file access to different
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs() / volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
/ and f_fdisk() function, are always not re-entrant. Only file/directory access / and f_fdisk() function, are always not re-entrant. Only file/directory access
/ to the same volume is under control of this function. / to the same volume is under control of this function.
/ /
/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect. / 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect.
/ 1: Enable re-entrancy. Also user provided synchronization handlers, / 1: Enable re-entrancy. Also user provided synchronization handlers,
/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj() / ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
/ function, must be added to the project. Samples are available in / function, must be added to the project. Samples are available in
/ option/syscall.c. / option/syscall.c.
/ /
/ The FF_FS_TIMEOUT defines timeout period in unit of time tick. / The FF_FS_TIMEOUT defines timeout period in unit of time tick.
/ The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*, / The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be / SemaphoreHandle_t and etc. A header file for O/S definitions needs to be
/ included somewhere in the scope of ff.h. */ / included somewhere in the scope of ff.h. */
/*--- End of configuration options ---*/ /*--- End of configuration options ---*/

View File

@ -1,170 +1,170 @@
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* Sample Code of OS Dependent Functions for FatFs */ /* Sample Code of OS Dependent Functions for FatFs */
/* (C)ChaN, 2018 */ /* (C)ChaN, 2018 */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
#include <stdlib.h> #include <stdlib.h>
#include "ff.h" #include "ff.h"
#if FF_USE_LFN == 3 /* Dynamic memory allocation */ #if FF_USE_LFN == 3 /* Dynamic memory allocation */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* Allocate a memory block */ /* Allocate a memory block */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
void* ff_memalloc ( /* Returns pointer to the allocated memory block (null if not enough core) */ void* ff_memalloc ( /* Returns pointer to the allocated memory block (null if not enough core) */
UINT msize /* Number of bytes to allocate */ UINT msize /* Number of bytes to allocate */
) )
{ {
return malloc(msize); /* Allocate a new memory block with POSIX API */ return malloc(msize); /* Allocate a new memory block with POSIX API */
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* Free a memory block */ /* Free a memory block */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
void ff_memfree ( void ff_memfree (
void* mblock /* Pointer to the memory block to free (nothing to do if null) */ void* mblock /* Pointer to the memory block to free (nothing to do if null) */
) )
{ {
free(mblock); /* Free the memory block with POSIX API */ free(mblock); /* Free the memory block with POSIX API */
} }
#endif #endif
#if FF_FS_REENTRANT /* Mutal exclusion */ #if FF_FS_REENTRANT /* Mutal exclusion */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* Create a Synchronization Object */ /* Create a Synchronization Object */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* This function is called in f_mount() function to create a new /* This function is called in f_mount() function to create a new
/ synchronization object for the volume, such as semaphore and mutex. / synchronization object for the volume, such as semaphore and mutex.
/ When a 0 is returned, the f_mount() function fails with FR_INT_ERR. / When a 0 is returned, the f_mount() function fails with FR_INT_ERR.
*/ */
//const osMutexDef_t Mutex[FF_VOLUMES]; /* Table of CMSIS-RTOS mutex */ //const osMutexDef_t Mutex[FF_VOLUMES]; /* Table of CMSIS-RTOS mutex */
int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create the sync object */ int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create the sync object */
BYTE vol, /* Corresponding volume (logical drive number) */ BYTE vol, /* Corresponding volume (logical drive number) */
FF_SYNC_t* sobj /* Pointer to return the created sync object */ FF_SYNC_t* sobj /* Pointer to return the created sync object */
) )
{ {
/* Win32 */ /* Win32 */
*sobj = CreateMutex(NULL, FALSE, NULL); *sobj = CreateMutex(NULL, FALSE, NULL);
return (int)(*sobj != INVALID_HANDLE_VALUE); return (int)(*sobj != INVALID_HANDLE_VALUE);
/* uITRON */ /* uITRON */
// T_CSEM csem = {TA_TPRI,1,1}; // T_CSEM csem = {TA_TPRI,1,1};
// *sobj = acre_sem(&csem); // *sobj = acre_sem(&csem);
// return (int)(*sobj > 0); // return (int)(*sobj > 0);
/* uC/OS-II */ /* uC/OS-II */
// OS_ERR err; // OS_ERR err;
// *sobj = OSMutexCreate(0, &err); // *sobj = OSMutexCreate(0, &err);
// return (int)(err == OS_NO_ERR); // return (int)(err == OS_NO_ERR);
/* FreeRTOS */ /* FreeRTOS */
// *sobj = xSemaphoreCreateMutex(); // *sobj = xSemaphoreCreateMutex();
// return (int)(*sobj != NULL); // return (int)(*sobj != NULL);
/* CMSIS-RTOS */ /* CMSIS-RTOS */
// *sobj = osMutexCreate(&Mutex[vol]); // *sobj = osMutexCreate(&Mutex[vol]);
// return (int)(*sobj != NULL); // return (int)(*sobj != NULL);
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* Delete a Synchronization Object */ /* Delete a Synchronization Object */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* This function is called in f_mount() function to delete a synchronization /* This function is called in f_mount() function to delete a synchronization
/ object that created with ff_cre_syncobj() function. When a 0 is returned, / object that created with ff_cre_syncobj() function. When a 0 is returned,
/ the f_mount() function fails with FR_INT_ERR. / the f_mount() function fails with FR_INT_ERR.
*/ */
int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to an error */ int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to an error */
FF_SYNC_t sobj /* Sync object tied to the logical drive to be deleted */ FF_SYNC_t sobj /* Sync object tied to the logical drive to be deleted */
) )
{ {
/* Win32 */ /* Win32 */
return (int)CloseHandle(sobj); return (int)CloseHandle(sobj);
/* uITRON */ /* uITRON */
// return (int)(del_sem(sobj) == E_OK); // return (int)(del_sem(sobj) == E_OK);
/* uC/OS-II */ /* uC/OS-II */
// OS_ERR err; // OS_ERR err;
// OSMutexDel(sobj, OS_DEL_ALWAYS, &err); // OSMutexDel(sobj, OS_DEL_ALWAYS, &err);
// return (int)(err == OS_NO_ERR); // return (int)(err == OS_NO_ERR);
/* FreeRTOS */ /* FreeRTOS */
// vSemaphoreDelete(sobj); // vSemaphoreDelete(sobj);
// return 1; // return 1;
/* CMSIS-RTOS */ /* CMSIS-RTOS */
// return (int)(osMutexDelete(sobj) == osOK); // return (int)(osMutexDelete(sobj) == osOK);
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* Request Grant to Access the Volume */ /* Request Grant to Access the Volume */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* This function is called on entering file functions to lock the volume. /* This function is called on entering file functions to lock the volume.
/ When a 0 is returned, the file function fails with FR_TIMEOUT. / When a 0 is returned, the file function fails with FR_TIMEOUT.
*/ */
int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */ int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */
FF_SYNC_t sobj /* Sync object to wait */ FF_SYNC_t sobj /* Sync object to wait */
) )
{ {
/* Win32 */ /* Win32 */
return (int)(WaitForSingleObject(sobj, FF_FS_TIMEOUT) == WAIT_OBJECT_0); return (int)(WaitForSingleObject(sobj, FF_FS_TIMEOUT) == WAIT_OBJECT_0);
/* uITRON */ /* uITRON */
// return (int)(wai_sem(sobj) == E_OK); // return (int)(wai_sem(sobj) == E_OK);
/* uC/OS-II */ /* uC/OS-II */
// OS_ERR err; // OS_ERR err;
// OSMutexPend(sobj, FF_FS_TIMEOUT, &err)); // OSMutexPend(sobj, FF_FS_TIMEOUT, &err));
// return (int)(err == OS_NO_ERR); // return (int)(err == OS_NO_ERR);
/* FreeRTOS */ /* FreeRTOS */
// return (int)(xSemaphoreTake(sobj, FF_FS_TIMEOUT) == pdTRUE); // return (int)(xSemaphoreTake(sobj, FF_FS_TIMEOUT) == pdTRUE);
/* CMSIS-RTOS */ /* CMSIS-RTOS */
// return (int)(osMutexWait(sobj, FF_FS_TIMEOUT) == osOK); // return (int)(osMutexWait(sobj, FF_FS_TIMEOUT) == osOK);
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* Release Grant to Access the Volume */ /* Release Grant to Access the Volume */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* This function is called on leaving file functions to unlock the volume. /* This function is called on leaving file functions to unlock the volume.
*/ */
void ff_rel_grant ( void ff_rel_grant (
FF_SYNC_t sobj /* Sync object to be signaled */ FF_SYNC_t sobj /* Sync object to be signaled */
) )
{ {
/* Win32 */ /* Win32 */
ReleaseMutex(sobj); ReleaseMutex(sobj);
/* uITRON */ /* uITRON */
// sig_sem(sobj); // sig_sem(sobj);
/* uC/OS-II */ /* uC/OS-II */
// OSMutexPost(sobj); // OSMutexPost(sobj);
/* FreeRTOS */ /* FreeRTOS */
// xSemaphoreGive(sobj); // xSemaphoreGive(sobj);
/* CMSIS-RTOS */ /* CMSIS-RTOS */
// osMutexRelease(sobj); // osMutexRelease(sobj);
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ STD_CFLAGS=-std=gnu11 -Wimplicit
# makefile at its root level - these are then overridden # makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein # for a subtree within the makefile rooted therein
# #
#DEFINES += #DEFINES +=
############################################################# #############################################################
# Recursion Magic - Don't touch this!! # Recursion Magic - Don't touch this!!

View File

@ -171,7 +171,7 @@ static void ICACHE_FLASH_ATTR http_send_callback( void * arg )
{ {
HTTPCLIENT_DEBUG( "All sent" ); HTTPCLIENT_DEBUG( "All sent" );
} }
else else
{ {
/* The headers were sent, now send the contents. */ /* The headers were sent, now send the contents. */
HTTPCLIENT_DEBUG( "Sending request body" ); HTTPCLIENT_DEBUG( "Sending request body" );
@ -324,7 +324,7 @@ static void ICACHE_FLASH_ATTR http_disconnect_callback( void * arg )
{ {
HTTPCLIENT_ERR( "Invalid version in %s", req->buffer ); HTTPCLIENT_ERR( "Invalid version in %s", req->buffer );
} }
else else
{ {
http_status = atoi( req->buffer + strlen( version_1_0 ) ); http_status = atoi( req->buffer + strlen( version_1_0 ) );
@ -470,7 +470,7 @@ static void ICACHE_FLASH_ATTR http_timeout_callback( void *arg )
else else
#endif #endif
result = espconn_disconnect( conn ); result = espconn_disconnect( conn );
if (result == ESPCONN_OK || result == ESPCONN_INPROGRESS) if (result == ESPCONN_OK || result == ESPCONN_INPROGRESS)
return; return;
else else
@ -478,7 +478,7 @@ static void ICACHE_FLASH_ATTR http_timeout_callback( void *arg )
/* not connected; execute the callback ourselves. */ /* not connected; execute the callback ourselves. */
HTTPCLIENT_DEBUG( "manually Calling disconnect callback due to error %d", result ); HTTPCLIENT_DEBUG( "manually Calling disconnect callback due to error %d", result );
http_disconnect_callback( arg ); http_disconnect_callback( arg );
} }
} }
@ -502,7 +502,7 @@ static void ICACHE_FLASH_ATTR http_dns_callback( const char * hostname, ip_addr_
} }
http_free_req( req ); http_free_req( req );
} }
else else
{ {
HTTPCLIENT_DEBUG( "DNS found %s " IPSTR, hostname, IP2STR( addr ) ); HTTPCLIENT_DEBUG( "DNS found %s " IPSTR, hostname, IP2STR( addr ) );
@ -531,8 +531,8 @@ static void ICACHE_FLASH_ATTR http_dns_callback( const char * hostname, ip_addr_
if ( req->secure ) if ( req->secure )
{ {
espconn_secure_connect( conn ); espconn_secure_connect( conn );
} }
else else
#endif #endif
{ {
espconn_connect( conn ); espconn_connect( conn );
@ -575,7 +575,7 @@ void ICACHE_FLASH_ATTR http_raw_request( const char * hostname, int port, bool s
/* Already in the local names table (or hostname was an IP address), execute the callback ourselves. */ /* Already in the local names table (or hostname was an IP address), execute the callback ourselves. */
http_dns_callback( hostname, &addr, req ); http_dns_callback( hostname, &addr, req );
} }
else else
{ {
if ( error == ESPCONN_ARG ) if ( error == ESPCONN_ARG )
{ {
@ -614,8 +614,8 @@ void ICACHE_FLASH_ATTR http_request( const char * url, const char * method, cons
port = 443; port = 443;
secure = true; secure = true;
url += strlen( "https://" ); /* Get rid of the protocol. */ url += strlen( "https://" ); /* Get rid of the protocol. */
} }
else else
{ {
HTTPCLIENT_ERR( "URL is not HTTP or HTTPS %s", url ); HTTPCLIENT_ERR( "URL is not HTTP or HTTPS %s", url );
return; return;
@ -643,7 +643,7 @@ void ICACHE_FLASH_ATTR http_request( const char * url, const char * method, cons
os_memcpy( hostname, url, path - url ); os_memcpy( hostname, url, path - url );
hostname[path - url] = '\0'; hostname[path - url] = '\0';
} }
else else
{ {
port = atoi( colon + 1 ); port = atoi( colon + 1 );
if ( port == 0 ) if ( port == 0 )

View File

@ -1,33 +1,33 @@
/* /*
* Copyright (c) 2001, Swedish Institute of Computer Science. * Copyright (c) 2001, Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors * 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -1,33 +1,33 @@
/* /*
* Copyright (c) 2001, Swedish Institute of Computer Science. * Copyright (c) 2001, Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors * 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -47,7 +47,7 @@ void spi_byte_read_espslave(uint8 spi_no,uint8 *data);
void spi_slave_init(uint8 spi_no); void spi_slave_init(uint8 spi_no);
//esp8266 slave isr handle funtion,tiggered when any transmission is finished. //esp8266 slave isr handle funtion,tiggered when any transmission is finished.
//the function is registered in spi_slave_init. //the function is registered in spi_slave_init.
void spi_slave_isr_handler(void *para); void spi_slave_isr_handler(void *para);
//hspi test function, used to test esp8266 spi slave //hspi test function, used to test esp8266 spi slave

View File

@ -106,7 +106,7 @@ typedef struct {
UartBautRate baut_rate; UartBautRate baut_rate;
UartBitsNum4Char data_bits; UartBitsNum4Char data_bits;
UartExistParity exist_parity; UartExistParity exist_parity;
UartParityMode parity; UartParityMode parity;
UartStopBitsNum stop_bits; UartStopBitsNum stop_bits;
} UartConfig; } UartConfig;

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -1,117 +1,117 @@
#ifndef __DHCPS_H__ #ifndef __DHCPS_H__
#define __DHCPS_H__ #define __DHCPS_H__
#include "lwipopts.h" #include "lwipopts.h"
#define USE_DNS #define USE_DNS
typedef struct dhcps_state{ typedef struct dhcps_state{
sint16_t state; sint16_t state;
} dhcps_state; } dhcps_state;
// <20><><EFBFBD><EFBFBD>dhcpclient<6E>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>DHCP msg<73><EFBFBD><E1B9B9> // <20><><EFBFBD><EFBFBD>dhcpclient<6E>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>DHCP msg<73><EFBFBD><E1B9B9>
typedef struct dhcps_msg { typedef struct dhcps_msg {
uint8_t op, htype, hlen, hops; uint8_t op, htype, hlen, hops;
uint8_t xid[4]; uint8_t xid[4];
uint16_t secs, flags; uint16_t secs, flags;
uint8_t ciaddr[4]; uint8_t ciaddr[4];
uint8_t yiaddr[4]; uint8_t yiaddr[4];
uint8_t siaddr[4]; uint8_t siaddr[4];
uint8_t giaddr[4]; uint8_t giaddr[4];
uint8_t chaddr[16]; uint8_t chaddr[16];
uint8_t sname[64]; uint8_t sname[64];
uint8_t file[128]; uint8_t file[128];
uint8_t options[312]; uint8_t options[312];
}dhcps_msg; }dhcps_msg;
#ifndef LWIP_OPEN_SRC #ifndef LWIP_OPEN_SRC
struct dhcps_lease { struct dhcps_lease {
bool enable; bool enable;
struct ip_addr start_ip; struct ip_addr start_ip;
struct ip_addr end_ip; struct ip_addr end_ip;
}; };
enum dhcps_offer_option{ enum dhcps_offer_option{
OFFER_START = 0x00, OFFER_START = 0x00,
OFFER_ROUTER = 0x01, OFFER_ROUTER = 0x01,
OFFER_END OFFER_END
}; };
#endif #endif
typedef enum { typedef enum {
DHCPS_TYPE_DYNAMIC, DHCPS_TYPE_DYNAMIC,
DHCPS_TYPE_STATIC DHCPS_TYPE_STATIC
} dhcps_type_t; } dhcps_type_t;
typedef enum { typedef enum {
DHCPS_STATE_ONLINE, DHCPS_STATE_ONLINE,
DHCPS_STATE_OFFLINE DHCPS_STATE_OFFLINE
} dhcps_state_t; } dhcps_state_t;
struct dhcps_pool{ struct dhcps_pool{
struct ip_addr ip; struct ip_addr ip;
uint8 mac[6]; uint8 mac[6];
uint32 lease_timer; uint32 lease_timer;
dhcps_type_t type; dhcps_type_t type;
dhcps_state_t state; dhcps_state_t state;
}; };
typedef struct _list_node{ typedef struct _list_node{
void *pnode; void *pnode;
struct _list_node *pnext; struct _list_node *pnext;
}list_node; }list_node;
extern uint32 dhcps_lease_time; extern uint32 dhcps_lease_time;
#define DHCPS_LEASE_TIMER dhcps_lease_time //0x05A0 #define DHCPS_LEASE_TIMER dhcps_lease_time //0x05A0
#define DHCPS_MAX_LEASE 0x64 #define DHCPS_MAX_LEASE 0x64
#define BOOTP_BROADCAST 0x8000 #define BOOTP_BROADCAST 0x8000
#define DHCP_REQUEST 1 #define DHCP_REQUEST 1
#define DHCP_REPLY 2 #define DHCP_REPLY 2
#define DHCP_HTYPE_ETHERNET 1 #define DHCP_HTYPE_ETHERNET 1
#define DHCP_HLEN_ETHERNET 6 #define DHCP_HLEN_ETHERNET 6
#define DHCP_MSG_LEN 236 #define DHCP_MSG_LEN 236
#define DHCPS_SERVER_PORT 67 #define DHCPS_SERVER_PORT 67
#define DHCPS_CLIENT_PORT 68 #define DHCPS_CLIENT_PORT 68
#define DHCPDISCOVER 1 #define DHCPDISCOVER 1
#define DHCPOFFER 2 #define DHCPOFFER 2
#define DHCPREQUEST 3 #define DHCPREQUEST 3
#define DHCPDECLINE 4 #define DHCPDECLINE 4
#define DHCPACK 5 #define DHCPACK 5
#define DHCPNAK 6 #define DHCPNAK 6
#define DHCPRELEASE 7 #define DHCPRELEASE 7
#define DHCP_OPTION_SUBNET_MASK 1 #define DHCP_OPTION_SUBNET_MASK 1
#define DHCP_OPTION_ROUTER 3 #define DHCP_OPTION_ROUTER 3
#define DHCP_OPTION_DNS_SERVER 6 #define DHCP_OPTION_DNS_SERVER 6
#define DHCP_OPTION_REQ_IPADDR 50 #define DHCP_OPTION_REQ_IPADDR 50
#define DHCP_OPTION_LEASE_TIME 51 #define DHCP_OPTION_LEASE_TIME 51
#define DHCP_OPTION_MSG_TYPE 53 #define DHCP_OPTION_MSG_TYPE 53
#define DHCP_OPTION_SERVER_ID 54 #define DHCP_OPTION_SERVER_ID 54
#define DHCP_OPTION_INTERFACE_MTU 26 #define DHCP_OPTION_INTERFACE_MTU 26
#define DHCP_OPTION_PERFORM_ROUTER_DISCOVERY 31 #define DHCP_OPTION_PERFORM_ROUTER_DISCOVERY 31
#define DHCP_OPTION_BROADCAST_ADDRESS 28 #define DHCP_OPTION_BROADCAST_ADDRESS 28
#define DHCP_OPTION_REQ_LIST 55 #define DHCP_OPTION_REQ_LIST 55
#define DHCP_OPTION_END 255 #define DHCP_OPTION_END 255
//#define USE_CLASS_B_NET 1 //#define USE_CLASS_B_NET 1
#define DHCPS_DEBUG 0 #define DHCPS_DEBUG 0
#define MAX_STATION_NUM 8 #define MAX_STATION_NUM 8
#define DHCPS_STATE_OFFER 1 #define DHCPS_STATE_OFFER 1
#define DHCPS_STATE_DECLINE 2 #define DHCPS_STATE_DECLINE 2
#define DHCPS_STATE_ACK 3 #define DHCPS_STATE_ACK 3
#define DHCPS_STATE_NAK 4 #define DHCPS_STATE_NAK 4
#define DHCPS_STATE_IDLE 5 #define DHCPS_STATE_IDLE 5
#define DHCPS_STATE_RELEASE 6 #define DHCPS_STATE_RELEASE 6
#define dhcps_router_enabled(offer) ((offer & OFFER_ROUTER) != 0) #define dhcps_router_enabled(offer) ((offer & OFFER_ROUTER) != 0)
void dhcps_start(struct ip_info *info); void dhcps_start(struct ip_info *info);
void dhcps_stop(void); void dhcps_stop(void);
#endif #endif

View File

@ -32,7 +32,7 @@
#if 0 #if 0
#define espconn_printf(fmt, args...) os_printf(fmt,## args) #define espconn_printf(fmt, args...) os_printf(fmt,## args)
#else #else
#define espconn_printf(fmt, args...) #define espconn_printf(fmt, args...)
#endif #endif
@ -468,7 +468,7 @@ extern sint8 espconn_regist_time(struct espconn *espconn, uint32 interval, uint8
* Description : Used to specify the function that should be called when data * Description : Used to specify the function that should be called when data
* has been successfully delivered to the remote host. * has been successfully delivered to the remote host.
* Parameters : struct espconn *espconn -- espconn to set the sent callback * Parameters : struct espconn *espconn -- espconn to set the sent callback
* espconn_sent_callback sent_cb -- sent callback function to * espconn_sent_callback sent_cb -- sent callback function to
* call for this espconn when data is successfully sent * call for this espconn when data is successfully sent
* Returns : none * Returns : none
*******************************************************************************/ *******************************************************************************/
@ -510,10 +510,10 @@ extern sint8 espconn_sent(struct espconn *espconn, uint8 *psent, uint16 length);
/****************************************************************************** /******************************************************************************
* FunctionName : espconn_regist_connectcb * FunctionName : espconn_regist_connectcb
* Description : used to specify the function that should be called when * Description : used to specify the function that should be called when
* connects to host. * connects to host.
* Parameters : espconn -- espconn to set the connect callback * Parameters : espconn -- espconn to set the connect callback
* connect_cb -- connected callback function to call when connected * connect_cb -- connected callback function to call when connected
* Returns : none * Returns : none
*******************************************************************************/ *******************************************************************************/
@ -521,9 +521,9 @@ extern sint8 espconn_regist_connectcb(struct espconn *espconn, espconn_connect_c
/****************************************************************************** /******************************************************************************
* FunctionName : espconn_regist_recvcb * FunctionName : espconn_regist_recvcb
* Description : used to specify the function that should be called when recv * Description : used to specify the function that should be called when recv
* data from host. * data from host.
* Parameters : espconn -- espconn to set the recv callback * Parameters : espconn -- espconn to set the recv callback
* recv_cb -- recv callback function to call when recv data * recv_cb -- recv callback function to call when recv data
* Returns : none * Returns : none
*******************************************************************************/ *******************************************************************************/
@ -532,10 +532,10 @@ extern sint8 espconn_regist_recvcb(struct espconn *espconn, espconn_recv_callbac
/****************************************************************************** /******************************************************************************
* FunctionName : espconn_regist_reconcb * FunctionName : espconn_regist_reconcb
* Description : used to specify the function that should be called when connection * Description : used to specify the function that should be called when connection
* because of err disconnect. * because of err disconnect.
* Parameters : espconn -- espconn to set the err callback * Parameters : espconn -- espconn to set the err callback
* recon_cb -- err callback function to call when err * recon_cb -- err callback function to call when err
* Returns : none * Returns : none
*******************************************************************************/ *******************************************************************************/
@ -596,7 +596,7 @@ extern sint8 espconn_get_keepalive(struct espconn *espconn, uint8 level, void *o
* Description : Resolve a hostname (string) into an IP address. * Description : Resolve a hostname (string) into an IP address.
* Parameters : pespconn -- espconn to resolve a hostname * Parameters : pespconn -- espconn to resolve a hostname
* hostname -- the hostname that is to be queried * hostname -- the hostname that is to be queried
* addr -- pointer to a ip_addr_t where to store the address if * addr -- pointer to a ip_addr_t where to store the address if
* it is already cached in the dns_table (only valid if * it is already cached in the dns_table (only valid if
* ESPCONN_OK is returned!) * ESPCONN_OK is returned!)
* found -- a callback function to be called on success, failure * found -- a callback function to be called on success, failure

View File

@ -1,58 +1,58 @@
#ifndef __ESPCONN_TCP_H__ #ifndef __ESPCONN_TCP_H__
#define __ESPCONN_TCP_H__ #define __ESPCONN_TCP_H__
#ifndef ESPCONN_TCP_DEBUG #ifndef ESPCONN_TCP_DEBUG
#define ESPCONN_TCP_DEBUG LWIP_DBG_OFF #define ESPCONN_TCP_DEBUG LWIP_DBG_OFF
#endif #endif
#include "lwip/app/espconn.h" #include "lwip/app/espconn.h"
#ifndef ESPCONN_TCP_TIMER #ifndef ESPCONN_TCP_TIMER
#define ESPCONN_TCP_TIMER 40 #define ESPCONN_TCP_TIMER 40
#endif #endif
#define espconn_keepalive_enable(pcb) ((pcb)->so_options |= SOF_KEEPALIVE) #define espconn_keepalive_enable(pcb) ((pcb)->so_options |= SOF_KEEPALIVE)
#define espconn_keepalive_disable(pcb) ((pcb)->so_options &= ~SOF_KEEPALIVE) #define espconn_keepalive_disable(pcb) ((pcb)->so_options &= ~SOF_KEEPALIVE)
#define espconn_manual_recv_disabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_MANUALRECV) != 0) #define espconn_manual_recv_disabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_MANUALRECV) != 0)
#define espconn_manual_recv_enabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_MANUALRECV) == 0) #define espconn_manual_recv_enabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_MANUALRECV) == 0)
/****************************************************************************** /******************************************************************************
* FunctionName : espconn_kill_oldest_pcb * FunctionName : espconn_kill_oldest_pcb
* Description : A oldest incoming connection has been killed. * Description : A oldest incoming connection has been killed.
* Parameters : none * Parameters : none
* Returns : none * Returns : none
*******************************************************************************/ *******************************************************************************/
extern void espconn_kill_oldest_pcb(void); extern void espconn_kill_oldest_pcb(void);
/****************************************************************************** /******************************************************************************
* FunctionName : espconn_tcp_disconnect * FunctionName : espconn_tcp_disconnect
* Description : A new incoming connection has been disconnected. * Description : A new incoming connection has been disconnected.
* Parameters : espconn -- the espconn used to disconnect with host * Parameters : espconn -- the espconn used to disconnect with host
* Returns : none * Returns : none
*******************************************************************************/ *******************************************************************************/
extern void espconn_tcp_disconnect(espconn_msg *pdiscon,u8 type); extern void espconn_tcp_disconnect(espconn_msg *pdiscon,u8 type);
/****************************************************************************** /******************************************************************************
* FunctionName : espconn_tcp_client * FunctionName : espconn_tcp_client
* Description : Initialize the client: set up a connect PCB and bind it to * Description : Initialize the client: set up a connect PCB and bind it to
* the defined port * the defined port
* Parameters : espconn -- the espconn used to build client * Parameters : espconn -- the espconn used to build client
* Returns : none * Returns : none
*******************************************************************************/ *******************************************************************************/
extern sint8 espconn_tcp_client(struct espconn* espconn); extern sint8 espconn_tcp_client(struct espconn* espconn);
/****************************************************************************** /******************************************************************************
* FunctionName : espconn_tcp_server * FunctionName : espconn_tcp_server
* Description : Initialize the server: set up a listening PCB and bind it to * Description : Initialize the server: set up a listening PCB and bind it to
* the defined port * the defined port
* Parameters : espconn -- the espconn used to build server * Parameters : espconn -- the espconn used to build server
* Returns : none * Returns : none
*******************************************************************************/ *******************************************************************************/
extern sint8 espconn_tcp_server(struct espconn *espconn); extern sint8 espconn_tcp_server(struct espconn *espconn);
#endif /* __CLIENT_TCP_H__ */ #endif /* __CLIENT_TCP_H__ */

View File

@ -1,64 +1,64 @@
#ifndef __ESPCONN_UDP_H__ #ifndef __ESPCONN_UDP_H__
#define __ESPCONN_UDP_H__ #define __ESPCONN_UDP_H__
#ifndef ESPCONN_UDP_DEBUG #ifndef ESPCONN_UDP_DEBUG
#define ESPCONN_UDP_DEBUG LWIP_DBG_OFF #define ESPCONN_UDP_DEBUG LWIP_DBG_OFF
#endif #endif
#include "lwip/app/espconn.h" #include "lwip/app/espconn.h"
/****************************************************************************** /******************************************************************************
* FunctionName : espconn_udp_client * FunctionName : espconn_udp_client
* Description : Initialize the client: set up a PCB and bind it to the port * Description : Initialize the client: set up a PCB and bind it to the port
* Parameters : pespconn -- the espconn used to build client * Parameters : pespconn -- the espconn used to build client
* Returns : none * Returns : none
*******************************************************************************/ *******************************************************************************/
extern sint8 espconn_udp_client(struct espconn *pespconn); extern sint8 espconn_udp_client(struct espconn *pespconn);
/****************************************************************************** /******************************************************************************
* FunctionName : espconn_udp_disconnect * FunctionName : espconn_udp_disconnect
* Description : A new incoming connection has been disconnected. * Description : A new incoming connection has been disconnected.
* Parameters : espconn -- the espconn used to disconnect with host * Parameters : espconn -- the espconn used to disconnect with host
* Returns : none * Returns : none
*******************************************************************************/ *******************************************************************************/
extern void espconn_udp_disconnect(espconn_msg *pdiscon); extern void espconn_udp_disconnect(espconn_msg *pdiscon);
/****************************************************************************** /******************************************************************************
* FunctionName : espconn_udp_server * FunctionName : espconn_udp_server
* Description : Initialize the server: set up a PCB and bind it to the port * Description : Initialize the server: set up a PCB and bind it to the port
* Parameters : pespconn -- the espconn used to build server * Parameters : pespconn -- the espconn used to build server
* Returns : none * Returns : none
*******************************************************************************/ *******************************************************************************/
extern sint8 espconn_udp_server(struct espconn *espconn); extern sint8 espconn_udp_server(struct espconn *espconn);
/****************************************************************************** /******************************************************************************
* FunctionName : espconn_udp_sent * FunctionName : espconn_udp_sent
* Description : sent data for client or server * Description : sent data for client or server
* Parameters : void *arg -- client or server to send * Parameters : void *arg -- client or server to send
* uint8* psent -- Data to send * uint8* psent -- Data to send
* uint16 length -- Length of data to send * uint16 length -- Length of data to send
* Returns : none * Returns : none
*******************************************************************************/ *******************************************************************************/
extern err_t espconn_udp_sent(void *arg, uint8 *psent, uint16 length); extern err_t espconn_udp_sent(void *arg, uint8 *psent, uint16 length);
/****************************************************************************** /******************************************************************************
* FunctionName : espconn_udp_sendto * FunctionName : espconn_udp_sendto
* Description : sent data for UDP * Description : sent data for UDP
* Parameters : void *arg -- UDP to send * Parameters : void *arg -- UDP to send
* uint8* psent -- Data to send * uint8* psent -- Data to send
* uint16 length -- Length of data to send * uint16 length -- Length of data to send
* Returns : return espconn error code. * Returns : return espconn error code.
* - ESPCONN_OK. Successful. No error occured. * - ESPCONN_OK. Successful. No error occured.
* - ESPCONN_MEM. Out of memory. * - ESPCONN_MEM. Out of memory.
* - ESPCONN_RTE. Could not find route to destination address. * - ESPCONN_RTE. Could not find route to destination address.
* - More errors could be returned by lower protocol layers. * - More errors could be returned by lower protocol layers.
*******************************************************************************/ *******************************************************************************/
extern err_t espconn_udp_sendto(void *arg, uint8 *psent, uint16 length); extern err_t espconn_udp_sendto(void *arg, uint8 *psent, uint16 length);
#endif /* __ESPCONN_UDP_H__ */ #endif /* __ESPCONN_UDP_H__ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -71,7 +71,7 @@ extern "C" {
#ifndef LWIP_UNUSED_ARG #ifndef LWIP_UNUSED_ARG
#define LWIP_UNUSED_ARG(x) (void)x #define LWIP_UNUSED_ARG(x) (void)x
#endif /* LWIP_UNUSED_ARG */ #endif /* LWIP_UNUSED_ARG */
#ifdef LWIP_PROVIDE_ERRNO #ifdef LWIP_PROVIDE_ERRNO

View File

@ -40,7 +40,7 @@
* Please coordinate changes and requests with Dominik Spies * Please coordinate changes and requests with Dominik Spies
* <kontakt@dspies.de> * <kontakt@dspies.de>
*/ */
#ifndef __LWIP_AUTOIP_H__ #ifndef __LWIP_AUTOIP_H__
#define __LWIP_AUTOIP_H__ #define __LWIP_AUTOIP_H__

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -65,7 +65,7 @@
#define LWIP_ASSERT(message, assertion) do { if(!(assertion)) \ #define LWIP_ASSERT(message, assertion) do { if(!(assertion)) \
LWIP_PLATFORM_ASSERT(message); } while(0) LWIP_PLATFORM_ASSERT(message); } while(0)
#else /* LWIP_NOASSERT */ #else /* LWIP_NOASSERT */
#define LWIP_ASSERT(message, assertion) #define LWIP_ASSERT(message, assertion)
#endif /* LWIP_NOASSERT */ #endif /* LWIP_NOASSERT */
/** if "expression" isn't true, then print "message" and execute "handler" expression */ /** if "expression" isn't true, then print "message" and execute "handler" expression */
@ -91,7 +91,7 @@
} while(0) } while(0)
#else /* LWIP_DEBUG */ #else /* LWIP_DEBUG */
#define LWIP_DEBUGF(debug, message) #define LWIP_DEBUGF(debug, message)
#endif /* LWIP_DEBUG */ #endif /* LWIP_DEBUG */
#endif /* __LWIP_DEBUG_H__ */ #endif /* __LWIP_DEBUG_H__ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -49,14 +49,14 @@ extern "C" {
/** Get the absolute difference between 2 u32_t values (correcting overflows) /** Get the absolute difference between 2 u32_t values (correcting overflows)
* 'a' is expected to be 'higher' (without overflow) than 'b'. */ * 'a' is expected to be 'higher' (without overflow) than 'b'. */
#define LWIP_U32_DIFF(a, b) (((a) >= (b)) ? ((a) - (b)) : (((a) + ((b) ^ 0xFFFFFFFF) + 1))) #define LWIP_U32_DIFF(a, b) (((a) >= (b)) ? ((a) - (b)) : (((a) + ((b) ^ 0xFFFFFFFF) + 1)))
/* Endianess-optimized shifting of two u8_t to create one u16_t */ /* Endianess-optimized shifting of two u8_t to create one u16_t */
#if BYTE_ORDER == LITTLE_ENDIAN #if BYTE_ORDER == LITTLE_ENDIAN
#define LWIP_MAKE_U16(a, b) ((a << 8) | b) #define LWIP_MAKE_U16(a, b) ((a << 8) | b)
#else #else
#define LWIP_MAKE_U16(a, b) ((b << 8) | a) #define LWIP_MAKE_U16(a, b) ((b << 8) | a)
#endif #endif
#ifndef LWIP_PLATFORM_BYTESWAP #ifndef LWIP_PLATFORM_BYTESWAP
#define LWIP_PLATFORM_BYTESWAP 0 #define LWIP_PLATFORM_BYTESWAP 0

View File

@ -16,11 +16,11 @@ extern "C" {
#endif #endif
/** period (in seconds) of the application calling dhcp_coarse_tmr() */ /** period (in seconds) of the application calling dhcp_coarse_tmr() */
#define DHCP_COARSE_TIMER_SECS 60 #define DHCP_COARSE_TIMER_SECS 60
/** period (in milliseconds) of the application calling dhcp_coarse_tmr() */ /** period (in milliseconds) of the application calling dhcp_coarse_tmr() */
#define DHCP_COARSE_TIMER_MSECS (DHCP_COARSE_TIMER_SECS * 1000UL) #define DHCP_COARSE_TIMER_MSECS (DHCP_COARSE_TIMER_SECS * 1000UL)
/** period (in milliseconds) of the application calling dhcp_fine_tmr() */ /** period (in milliseconds) of the application calling dhcp_fine_tmr() */
#define DHCP_FINE_TIMER_MSECS 500 #define DHCP_FINE_TIMER_MSECS 500
#define DHCP_CHADDR_LEN 16U #define DHCP_CHADDR_LEN 16U
#define DHCP_SNAME_LEN 64U #define DHCP_SNAME_LEN 64U
@ -28,9 +28,9 @@ extern "C" {
struct dhcp struct dhcp
{ {
/** transaction identifier of last sent request */ /** transaction identifier of last sent request */
u32_t xid; u32_t xid;
/** our connection to the DHCP server */ /** our connection to the DHCP server */
struct udp_pcb *pcb; struct udp_pcb *pcb;
/** incoming msg */ /** incoming msg */
struct dhcp_msg *msg_in; struct dhcp_msg *msg_in;
@ -53,7 +53,7 @@ struct dhcp
ip_addr_t offered_ip_addr; ip_addr_t offered_ip_addr;
ip_addr_t offered_sn_mask; ip_addr_t offered_sn_mask;
ip_addr_t offered_gw_addr; ip_addr_t offered_gw_addr;
u32_t offered_t0_lease; /* lease period (in seconds) */ u32_t offered_t0_lease; /* lease period (in seconds) */
u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */ u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */
u32_t offered_t2_rebind; /* recommended rebind time (usually 66% of lease period) */ u32_t offered_t2_rebind; /* recommended rebind time (usually 66% of lease period) */
@ -132,7 +132,7 @@ void dhcp_arp_reply(struct netif *netif, ip_addr_t *addr);
void dhcp_coarse_tmr(void); void dhcp_coarse_tmr(void);
/** to be called every half second */ /** to be called every half second */
void dhcp_fine_tmr(void); void dhcp_fine_tmr(void);
/** DHCP message item offsets and length */ /** DHCP message item offsets and length */
#define DHCP_OP_OFS 0 #define DHCP_OP_OFS 0
#define DHCP_HTYPE_OFS 1 #define DHCP_HTYPE_OFS 1
@ -153,7 +153,7 @@ void dhcp_fine_tmr(void);
#define DHCP_COOKIE_OFS DHCP_MSG_LEN #define DHCP_COOKIE_OFS DHCP_MSG_LEN
#define DHCP_OPTIONS_OFS (DHCP_MSG_LEN + 4) #define DHCP_OPTIONS_OFS (DHCP_MSG_LEN + 4)
#define DHCP_CLIENT_PORT 68 #define DHCP_CLIENT_PORT 68
#define DHCP_SERVER_PORT 67 #define DHCP_SERVER_PORT 67
/** DHCP client states */ /** DHCP client states */
@ -174,7 +174,7 @@ void dhcp_fine_tmr(void);
/** AUTOIP cooperatation flags */ /** AUTOIP cooperatation flags */
#define DHCP_AUTOIP_COOP_STATE_OFF 0 #define DHCP_AUTOIP_COOP_STATE_OFF 0
#define DHCP_AUTOIP_COOP_STATE_ON 1 #define DHCP_AUTOIP_COOP_STATE_ON 1
#define DHCP_BOOTREQUEST 1 #define DHCP_BOOTREQUEST 1
#define DHCP_BOOTREPLY 2 #define DHCP_BOOTREPLY 2
@ -199,7 +199,7 @@ void dhcp_fine_tmr(void);
#define DHCP_OPTION_PAD 0 #define DHCP_OPTION_PAD 0
#define DHCP_OPTION_SUBNET_MASK 1 /* RFC 2132 3.3 */ #define DHCP_OPTION_SUBNET_MASK 1 /* RFC 2132 3.3 */
#define DHCP_OPTION_ROUTER 3 #define DHCP_OPTION_ROUTER 3
#define DHCP_OPTION_DNS_SERVER 6 #define DHCP_OPTION_DNS_SERVER 6
#define DHCP_OPTION_HOSTNAME 12 #define DHCP_OPTION_HOSTNAME 12
#define DHCP_OPTION_IP_TTL 23 #define DHCP_OPTION_IP_TTL 23
#define DHCP_OPTION_MTU 26 #define DHCP_OPTION_MTU 26

View File

@ -1,7 +1,7 @@
/** /**
* lwip DNS resolver header file. * lwip DNS resolver header file.
* Author: Jim Pettinato * Author: Jim Pettinato
* April 2007 * April 2007
* ported from uIP resolv.c Copyright (c) 2002-2003, Adam Dunkels. * ported from uIP resolv.c Copyright (c) 2002-2003, Adam Dunkels.

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -2,29 +2,29 @@
* Copyright (c) 2002 CITEL Technologies Ltd. * Copyright (c) 2002 CITEL Technologies Ltd.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* 3. Neither the name of CITEL Technologies Ltd nor the names of its contributors * 3. Neither the name of CITEL Technologies Ltd nor the names of its contributors
* may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS'' * THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* This file is a contribution to the lwIP TCP/IP stack. * This file is a contribution to the lwIP TCP/IP stack.
* The Swedish Institute of Computer Science and Adam Dunkels * The Swedish Institute of Computer Science and Adam Dunkels
@ -64,8 +64,8 @@ extern "C" {
* these should really be linked from the interface, but * these should really be linked from the interface, but
* if we keep them separate we will not affect the lwip original code * if we keep them separate we will not affect the lwip original code
* too much * too much
* *
* There will be a group for the all systems group address but this * There will be a group for the all systems group address but this
* will not run the state machine as it is used to kick off reports * will not run the state machine as it is used to kick off reports
* from all the other groups * from all the other groups
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -134,7 +134,7 @@ struct ip_hdr {
PACK_STRUCT_FIELD(u16_t _chksum); PACK_STRUCT_FIELD(u16_t _chksum);
/* source and destination IP addresses */ /* source and destination IP addresses */
PACK_STRUCT_FIELD(ip_addr_p_t src); PACK_STRUCT_FIELD(ip_addr_p_t src);
PACK_STRUCT_FIELD(ip_addr_p_t dest); PACK_STRUCT_FIELD(ip_addr_p_t dest);
} PACK_STRUCT_STRUCT; } PACK_STRUCT_STRUCT;
PACK_STRUCT_END PACK_STRUCT_END
#ifdef PACK_STRUCT_USE_INCLUDES #ifdef PACK_STRUCT_USE_INCLUDES

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Jani Monoses <jani@iv.ro> * Author: Jani Monoses <jani@iv.ro>
* *
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -15,7 +15,7 @@
#define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + sizeof(struct memp_malloc_helper)), "MALLOC_"#size, attr) #define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + sizeof(struct memp_malloc_helper)), "MALLOC_"#size, attr)
#define LWIP_MALLOC_MEMPOOL_START #define LWIP_MALLOC_MEMPOOL_START
#define LWIP_MALLOC_MEMPOOL_END #define LWIP_MALLOC_MEMPOOL_END
#endif /* LWIP_MALLOC_MEMPOOL */ #endif /* LWIP_MALLOC_MEMPOOL */
#ifndef LWIP_PBUF_MEMPOOL #ifndef LWIP_PBUF_MEMPOOL
/* This treats "pbuf pools" just like any other pool. /* This treats "pbuf pools" just like any other pool.

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -8,21 +8,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Simon Goldschmidt * Author: Simon Goldschmidt
* *
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -288,7 +288,7 @@ void netif_set_status_callback(struct netif *netif, netif_status_callback_fn sta
void netif_set_link_up(struct netif *netif)ICACHE_FLASH_ATTR; void netif_set_link_up(struct netif *netif)ICACHE_FLASH_ATTR;
void netif_set_link_down(struct netif *netif)ICACHE_FLASH_ATTR; void netif_set_link_down(struct netif *netif)ICACHE_FLASH_ATTR;
/** Ask if a link is up */ /** Ask if a link is up */
#define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0) #define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)
#if LWIP_NETIF_LINK_CALLBACK #if LWIP_NETIF_LINK_CALLBACK

View File

@ -1,5 +1,5 @@
/* /*
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -8,23 +8,23 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
*/ */
#ifndef __LWIP_NETIFAPI_H__ #ifndef __LWIP_NETIFAPI_H__
#define __LWIP_NETIFAPI_H__ #define __LWIP_NETIFAPI_H__

View File

@ -6,9 +6,9 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -17,21 +17,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -60,7 +60,7 @@
#define SYS_LIGHTWEIGHT_PROT 0 #define SYS_LIGHTWEIGHT_PROT 0
#endif #endif
/** /**
* NO_SYS==1: Provides VERY minimal functionality. Otherwise, * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
* use lwIP facilities. * use lwIP facilities.
*/ */
@ -183,8 +183,8 @@
/** /**
* MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h * MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h
* that defines additional pools beyond the "standard" ones required * that defines additional pools beyond the "standard" ones required
* by lwIP. If you set this to 1, you must have lwippools.h in your * by lwIP. If you set this to 1, you must have lwippools.h in your
* inlude path somewhere. * inlude path somewhere.
*/ */
#ifndef MEMP_USE_CUSTOM_POOLS #ifndef MEMP_USE_CUSTOM_POOLS
#define MEMP_USE_CUSTOM_POOLS 0 #define MEMP_USE_CUSTOM_POOLS 0
@ -332,7 +332,7 @@
/** /**
* MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
* for callback/timeout API communication. * for callback/timeout API communication.
* (only needed if you use tcpip.c) * (only needed if you use tcpip.c)
*/ */
#ifndef MEMP_NUM_TCPIP_MSG_API #ifndef MEMP_NUM_TCPIP_MSG_API
@ -341,7 +341,7 @@
/** /**
* MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
* for incoming packets. * for incoming packets.
* (only needed if you use tcpip.c) * (only needed if you use tcpip.c)
*/ */
#ifndef MEMP_NUM_TCPIP_MSG_INPKT #ifndef MEMP_NUM_TCPIP_MSG_INPKT
@ -406,7 +406,7 @@
#endif #endif
/** /**
* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. * PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
*/ */
#ifndef PBUF_POOL_SIZE #ifndef PBUF_POOL_SIZE
#define PBUF_POOL_SIZE 16 #define PBUF_POOL_SIZE 16
@ -727,7 +727,7 @@
#endif #endif
/** /**
* SNMP_PRIVATE_MIB: * SNMP_PRIVATE_MIB:
* When using a private MIB, you have to create a file 'private_mib.h' that contains * When using a private MIB, you have to create a file 'private_mib.h' that contains
* a 'struct mib_array_node mib_private' which contains your MIB. * a 'struct mib_array_node mib_private' which contains your MIB.
*/ */
@ -775,7 +775,7 @@
---------------------------------- ----------------------------------
*/ */
/** /**
* LWIP_IGMP==1: Turn on IGMP module. * LWIP_IGMP==1: Turn on IGMP module.
*/ */
#ifndef LWIP_IGMP #ifndef LWIP_IGMP
#define LWIP_IGMP 0 #define LWIP_IGMP 0
@ -892,12 +892,12 @@
#endif #endif
/** /**
* TCP_WND: The size of a TCP window. This must be at least * TCP_WND: The size of a TCP window. This must be at least
* (2 * TCP_MSS) for things to work well * (2 * TCP_MSS) for things to work well
*/ */
#ifndef TCP_WND #ifndef TCP_WND
#define TCP_WND (4 * TCP_MSS) #define TCP_WND (4 * TCP_MSS)
#endif #endif
/** /**
* TCP_MAXRTX: Maximum number of retransmissions of data segments. * TCP_MAXRTX: Maximum number of retransmissions of data segments.
@ -946,7 +946,7 @@
/** /**
* TCP_SND_BUF: TCP sender buffer space (bytes). * TCP_SND_BUF: TCP sender buffer space (bytes).
*/ */
#ifndef TCP_SND_BUF #ifndef TCP_SND_BUF
#define TCP_SND_BUF 256 #define TCP_SND_BUF 256
@ -1037,7 +1037,7 @@
//#ifndef LWIP_EVENT_API //#ifndef LWIP_EVENT_API
//#define LWIP_EVENT_API 0 //#define LWIP_EVENT_API 0
//#define LWIP_CALLBACK_API 1 //#define LWIP_CALLBACK_API 1
//#else //#else
//#define LWIP_EVENT_API 1 //#define LWIP_EVENT_API 1
//#define LWIP_CALLBACK_API 0 //#define LWIP_CALLBACK_API 0
//#endif //#endif
@ -1735,28 +1735,28 @@
#ifndef CHECKSUM_GEN_IP #ifndef CHECKSUM_GEN_IP
#define CHECKSUM_GEN_IP 1 #define CHECKSUM_GEN_IP 1
#endif #endif
/** /**
* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets. * CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.
*/ */
#ifndef CHECKSUM_GEN_UDP #ifndef CHECKSUM_GEN_UDP
#define CHECKSUM_GEN_UDP 1 #define CHECKSUM_GEN_UDP 1
#endif #endif
/** /**
* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets. * CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.
*/ */
#ifndef CHECKSUM_GEN_TCP #ifndef CHECKSUM_GEN_TCP
#define CHECKSUM_GEN_TCP 1 #define CHECKSUM_GEN_TCP 1
#endif #endif
/** /**
* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets. * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.
*/ */
#ifndef CHECKSUM_CHECK_IP #ifndef CHECKSUM_CHECK_IP
#define CHECKSUM_CHECK_IP 1 #define CHECKSUM_CHECK_IP 1
#endif #endif
/** /**
* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets. * CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -104,15 +104,15 @@ struct pbuf {
* the stack itself, or pbuf->next pointers from a chain. * the stack itself, or pbuf->next pointers from a chain.
*/ */
u16_t ref; u16_t ref;
/* add a pointer for esf_buf */ /* add a pointer for esf_buf */
void * eb; void * eb;
}; };
#if LWIP_SUPPORT_CUSTOM_PBUF #if LWIP_SUPPORT_CUSTOM_PBUF
/** Prototype for a function to free a custom pbuf */ /** Prototype for a function to free a custom pbuf */
typedef void (*pbuf_free_custom_fn)(struct pbuf *p); typedef void (*pbuf_free_custom_fn)(struct pbuf *p);
/** A custom pbuf: like a pbuf, but following a function pointer to free it. */ /** A custom pbuf: like a pbuf, but following a function pointer to free it. */
struct pbuf_custom { struct pbuf_custom {
/** The actual pbuf */ /** The actual pbuf */

View File

@ -1,44 +1,44 @@
/* /*
* puck_def.h * puck_def.h
* *
* Created on: Jul 22, 2010 * Created on: Jul 22, 2010
* Author: dtoma * Author: dtoma
*/ */
#ifndef PUCK_DEF_H_ #ifndef PUCK_DEF_H_
#define PUCK_DEF_H_ #define PUCK_DEF_H_
#define INSTRUMENT_PORT 8760 #define INSTRUMENT_PORT 8760
#define INSTRUMENT_LENGTH 80 #define INSTRUMENT_LENGTH 80
#define MDNS_NAME_LENGTH 68 //68 #define MDNS_NAME_LENGTH 68 //68
char* PUCK_SERVICE = NULL; char* PUCK_SERVICE = NULL;
//#define PUCK_SERVICE "_Escpressif._tcp.local" //#define PUCK_SERVICE "_Escpressif._tcp.local"
#define DNS_SD_SERVICE "_services._dns-sd._udp.local" #define DNS_SD_SERVICE "_services._dns-sd._udp.local"
#define SERVICE_DESCRIPTION "PUCK PROTOCOL" #define SERVICE_DESCRIPTION "PUCK PROTOCOL"
#define PUCK_SERVICE_LENGTH 30 #define PUCK_SERVICE_LENGTH 30
#define UUID_LEN 16 #define UUID_LEN 16
#define DS_VERS_LEN 2 #define DS_VERS_LEN 2
#define DS_SIZE_LEN 2 #define DS_SIZE_LEN 2
#define MAN_ID_LEN 4 #define MAN_ID_LEN 4
#define MAN_MODEL_LEN 2 #define MAN_MODEL_LEN 2
#define MAN_VERS_LEN 2 #define MAN_VERS_LEN 2
#define SER_NUM_LEN 4 #define SER_NUM_LEN 4
#define NAME_LEN 64 #define NAME_LEN 64
#define PUCK_DATASHEET_SIZE 96 #define PUCK_DATASHEET_SIZE 96
#define UUID_OFFSET 0 #define UUID_OFFSET 0
#define DS_VERS_OFFSET UUID_LEN + UUID_OFFSET #define DS_VERS_OFFSET UUID_LEN + UUID_OFFSET
#define DS_SIZE_OFFSET DS_VERS_LEN + DS_VERS_OFFSET #define DS_SIZE_OFFSET DS_VERS_LEN + DS_VERS_OFFSET
#define MAN_ID_OFFSET DS_SIZE_LEN + DS_SIZE_OFFSET #define MAN_ID_OFFSET DS_SIZE_LEN + DS_SIZE_OFFSET
#define MAN_MODEL_OFFSET MAN_ID_LEN + MAN_ID_OFFSET #define MAN_MODEL_OFFSET MAN_ID_LEN + MAN_ID_OFFSET
#define MAN_VERS_OFFSET MAN_MODEL_LEN + MAN_MODEL_OFFSET #define MAN_VERS_OFFSET MAN_MODEL_LEN + MAN_MODEL_OFFSET
#define SER_NUM_OFFSET MAN_VERS_LEN + MAN_VERS_OFFSET #define SER_NUM_OFFSET MAN_VERS_LEN + MAN_VERS_OFFSET
#define NAME_OFFSET SER_NUM_LEN + SER_NUM_OFFSET #define NAME_OFFSET SER_NUM_LEN + SER_NUM_OFFSET
#endif /* __PUCK_DEF_H__ */ #endif /* __PUCK_DEF_H__ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,17 +11,17 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
@ -53,7 +53,7 @@ typedef void * sio_fd_t;
#ifndef sio_open #ifndef sio_open
/** /**
* Opens a serial device for communication. * Opens a serial device for communication.
* *
* @param devnum device number * @param devnum device number
* @return handle to serial device if successful, NULL otherwise * @return handle to serial device if successful, NULL otherwise
*/ */
@ -63,10 +63,10 @@ sio_fd_t sio_open(u8_t devnum)ICACHE_FLASH_ATTR;
#ifndef sio_send #ifndef sio_send
/** /**
* Sends a single character to the serial device. * Sends a single character to the serial device.
* *
* @param c character to send * @param c character to send
* @param fd serial device handle * @param fd serial device handle
* *
* @note This function will block until the character can be sent. * @note This function will block until the character can be sent.
*/ */
void sio_send(u8_t c, sio_fd_t fd)ICACHE_FLASH_ATTR; void sio_send(u8_t c, sio_fd_t fd)ICACHE_FLASH_ATTR;
@ -75,9 +75,9 @@ void sio_send(u8_t c, sio_fd_t fd)ICACHE_FLASH_ATTR;
#ifndef sio_recv #ifndef sio_recv
/** /**
* Receives a single character from the serial device. * Receives a single character from the serial device.
* *
* @param fd serial device handle * @param fd serial device handle
* *
* @note This function will block until a character is received. * @note This function will block until a character is received.
*/ */
u8_t sio_recv(sio_fd_t fd)ICACHE_FLASH_ATTR; u8_t sio_recv(sio_fd_t fd)ICACHE_FLASH_ATTR;
@ -86,12 +86,12 @@ u8_t sio_recv(sio_fd_t fd)ICACHE_FLASH_ATTR;
#ifndef sio_read #ifndef sio_read
/** /**
* Reads from the serial device. * Reads from the serial device.
* *
* @param fd serial device handle * @param fd serial device handle
* @param data pointer to data buffer for receiving * @param data pointer to data buffer for receiving
* @param len maximum length (in bytes) of data to receive * @param len maximum length (in bytes) of data to receive
* @return number of bytes actually received - may be 0 if aborted by sio_read_abort * @return number of bytes actually received - may be 0 if aborted by sio_read_abort
* *
* @note This function will block until data can be received. The blocking * @note This function will block until data can be received. The blocking
* can be cancelled by calling sio_read_abort(). * can be cancelled by calling sio_read_abort().
*/ */
@ -102,7 +102,7 @@ u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len)ICACHE_FLASH_ATTR;
/** /**
* Tries to read from the serial device. Same as sio_read but returns * Tries to read from the serial device. Same as sio_read but returns
* immediately if no data is available and never blocks. * immediately if no data is available and never blocks.
* *
* @param fd serial device handle * @param fd serial device handle
* @param data pointer to data buffer for receiving * @param data pointer to data buffer for receiving
* @param len maximum length (in bytes) of data to receive * @param len maximum length (in bytes) of data to receive
@ -114,12 +114,12 @@ u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len)ICACHE_FLASH_ATTR;
#ifndef sio_write #ifndef sio_write
/** /**
* Writes to the serial device. * Writes to the serial device.
* *
* @param fd serial device handle * @param fd serial device handle
* @param data pointer to data to send * @param data pointer to data to send
* @param len length (in bytes) of data to send * @param len length (in bytes) of data to send
* @return number of bytes actually sent * @return number of bytes actually sent
* *
* @note This function will block until all data can be sent. * @note This function will block until all data can be sent.
*/ */
u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len)ICACHE_FLASH_ATTR; u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len)ICACHE_FLASH_ATTR;
@ -128,7 +128,7 @@ u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len)ICACHE_FLASH_ATTR;
#ifndef sio_read_abort #ifndef sio_read_abort
/** /**
* Aborts a blocking sio_read() call. * Aborts a blocking sio_read() call.
* *
* @param fd serial device handle * @param fd serial device handle
*/ */
void sio_read_abort(sio_fd_t fd)ICACHE_FLASH_ATTR; void sio_read_abort(sio_fd_t fd)ICACHE_FLASH_ATTR;

View File

@ -2,8 +2,8 @@
* Copyright (c) 2001, 2002 Leon Woestenberg <leon.woestenberg@axon.tv> * Copyright (c) 2001, 2002 Leon Woestenberg <leon.woestenberg@axon.tv>
* Copyright (c) 2001, 2002 Axon Digital Design B.V., The Netherlands. * Copyright (c) 2001, 2002 Axon Digital Design B.V., The Netherlands.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -12,21 +12,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Leon Woestenberg <leon.woestenberg@axon.tv> * Author: Leon Woestenberg <leon.woestenberg@axon.tv>
* *
*/ */
@ -109,7 +109,7 @@ void snmp_set_sysname(u8_t *ocstr, u8_t *ocstrlen);
void snmp_set_syslocation(u8_t *ocstr, u8_t *ocstrlen); void snmp_set_syslocation(u8_t *ocstr, u8_t *ocstrlen);
/* network interface */ /* network interface */
void snmp_add_ifinoctets(struct netif *ni, u32_t value); void snmp_add_ifinoctets(struct netif *ni, u32_t value);
void snmp_inc_ifinucastpkts(struct netif *ni); void snmp_inc_ifinucastpkts(struct netif *ni);
void snmp_inc_ifinnucastpkts(struct netif *ni); void snmp_inc_ifinnucastpkts(struct netif *ni);
void snmp_inc_ifindiscards(struct netif *ni); void snmp_inc_ifindiscards(struct netif *ni);
@ -167,7 +167,7 @@ void snmp_inc_icmpoutdestunreachs(void);
void snmp_inc_icmpouttimeexcds(void); void snmp_inc_icmpouttimeexcds(void);
void snmp_inc_icmpoutparmprobs(void); void snmp_inc_icmpoutparmprobs(void);
void snmp_inc_icmpoutsrcquenchs(void); void snmp_inc_icmpoutsrcquenchs(void);
void snmp_inc_icmpoutredirects(void); void snmp_inc_icmpoutredirects(void);
void snmp_inc_icmpoutechos(void); void snmp_inc_icmpoutechos(void);
void snmp_inc_icmpoutechoreps(void); void snmp_inc_icmpoutechoreps(void);
void snmp_inc_icmpouttimestamps(void); void snmp_inc_icmpouttimestamps(void);
@ -242,7 +242,7 @@ void snmp_get_snmpenableauthentraps(u8_t *value);
#define snmp_set_syslocation(ocstr, ocstrlen); #define snmp_set_syslocation(ocstr, ocstrlen);
/* network interface */ /* network interface */
#define snmp_add_ifinoctets(ni,value) #define snmp_add_ifinoctets(ni,value)
#define snmp_inc_ifinucastpkts(ni) #define snmp_inc_ifinucastpkts(ni)
#define snmp_inc_ifinnucastpkts(ni) #define snmp_inc_ifinnucastpkts(ni)
#define snmp_inc_ifindiscards(ni) #define snmp_inc_ifindiscards(ni)
@ -282,26 +282,26 @@ void snmp_get_snmpenableauthentraps(u8_t *value);
/* ICMP */ /* ICMP */
#define snmp_inc_icmpinmsgs() #define snmp_inc_icmpinmsgs()
#define snmp_inc_icmpinerrors() #define snmp_inc_icmpinerrors()
#define snmp_inc_icmpindestunreachs() #define snmp_inc_icmpindestunreachs()
#define snmp_inc_icmpintimeexcds() #define snmp_inc_icmpintimeexcds()
#define snmp_inc_icmpinparmprobs() #define snmp_inc_icmpinparmprobs()
#define snmp_inc_icmpinsrcquenchs() #define snmp_inc_icmpinsrcquenchs()
#define snmp_inc_icmpinredirects() #define snmp_inc_icmpinredirects()
#define snmp_inc_icmpinechos() #define snmp_inc_icmpinechos()
#define snmp_inc_icmpinechoreps() #define snmp_inc_icmpinechoreps()
#define snmp_inc_icmpintimestamps() #define snmp_inc_icmpintimestamps()
#define snmp_inc_icmpintimestampreps() #define snmp_inc_icmpintimestampreps()
#define snmp_inc_icmpinaddrmasks() #define snmp_inc_icmpinaddrmasks()
#define snmp_inc_icmpinaddrmaskreps() #define snmp_inc_icmpinaddrmaskreps()
#define snmp_inc_icmpoutmsgs() #define snmp_inc_icmpoutmsgs()
#define snmp_inc_icmpouterrors() #define snmp_inc_icmpouterrors()
#define snmp_inc_icmpoutdestunreachs() #define snmp_inc_icmpoutdestunreachs()
#define snmp_inc_icmpouttimeexcds() #define snmp_inc_icmpouttimeexcds()
#define snmp_inc_icmpoutparmprobs() #define snmp_inc_icmpoutparmprobs()
#define snmp_inc_icmpoutsrcquenchs() #define snmp_inc_icmpoutsrcquenchs()
#define snmp_inc_icmpoutredirects() #define snmp_inc_icmpoutredirects()
#define snmp_inc_icmpoutechos() #define snmp_inc_icmpoutechos()
#define snmp_inc_icmpoutechoreps() #define snmp_inc_icmpoutechoreps()
#define snmp_inc_icmpouttimestamps() #define snmp_inc_icmpouttimestamps()
#define snmp_inc_icmpouttimestampreps() #define snmp_inc_icmpouttimestampreps()

View File

@ -2,7 +2,7 @@
* @file * @file
* Abstract Syntax Notation One (ISO 8824, 8825) codec. * Abstract Syntax Notation One (ISO 8824, 8825) codec.
*/ */
/* /*
* Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
* All rights reserved. * All rights reserved.

View File

@ -54,7 +54,7 @@ extern "C" {
#endif #endif
/* MIB object instance */ /* MIB object instance */
#define MIB_OBJECT_NONE 0 #define MIB_OBJECT_NONE 0
#define MIB_OBJECT_SCALAR 1 #define MIB_OBJECT_SCALAR 1
#define MIB_OBJECT_TAB 2 #define MIB_OBJECT_TAB 2
@ -113,7 +113,7 @@ struct mib_node
/** tests length and/or range BEFORE setting */ /** tests length and/or range BEFORE setting */
u8_t (*set_test)(struct obj_def *od, u16_t len, void *value); u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
/** sets object value, only to be called when set_test() */ /** sets object value, only to be called when set_test() */
void (*set_value)(struct obj_def *od, u16_t len, void *value); void (*set_value)(struct obj_def *od, u16_t len, void *value);
/** One out of MIB_NODE_AR, MIB_NODE_LR or MIB_NODE_EX */ /** One out of MIB_NODE_AR, MIB_NODE_LR or MIB_NODE_EX */
u8_t node_type; u8_t node_type;
/* array or max list length */ /* array or max list length */
@ -161,7 +161,7 @@ struct mib_ram_array_node
struct mib_list_node struct mib_list_node
{ {
struct mib_list_node *prev; struct mib_list_node *prev;
struct mib_list_node *next; struct mib_list_node *next;
s32_t objid; s32_t objid;
struct mib_node *nptr; struct mib_node *nptr;
@ -223,7 +223,7 @@ struct mib_external_node
void (*get_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value); void (*get_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
u8_t (*set_test_a)(u8_t rid, struct obj_def *od, u16_t len, void *value); u8_t (*set_test_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
void (*set_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value); void (*set_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
/** async Panic Close (agent returns error reply, /** async Panic Close (agent returns error reply,
e.g. used for external transaction cleanup) */ e.g. used for external transaction cleanup) */
void (*get_object_def_pc)(u8_t rid, u8_t ident_len, s32_t *ident); void (*get_object_def_pc)(u8_t rid, u8_t ident_len, s32_t *ident);
void (*get_value_pc)(u8_t rid, struct obj_def *od); void (*get_value_pc)(u8_t rid, struct obj_def *od);

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -302,7 +302,7 @@ typedef struct ip_mreq {
#endif /* FD_SET */ #endif /* FD_SET */
/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided /** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided
* by your system, set this to 0 and include <sys/time.h> in cc.h */ * by your system, set this to 0 and include <sys/time.h> in cc.h */
#ifndef LWIP_TIMEVAL_PRIVATE #ifndef LWIP_TIMEVAL_PRIVATE
#define LWIP_TIMEVAL_PRIVATE 1 #define LWIP_TIMEVAL_PRIVATE 1
#endif #endif

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -53,7 +53,7 @@ extern "C" {
#else #else
#define STAT_COUNTER u16_t #define STAT_COUNTER u16_t
#define STAT_COUNTER_F U16_F #define STAT_COUNTER_F U16_F
#endif #endif
struct stats_proto { struct stats_proto {
STAT_COUNTER xmit; /* Transmitted packets. */ STAT_COUNTER xmit; /* Transmitted packets. */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -76,7 +76,7 @@ typedef u8_t sys_mbox_t;
/** sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate. /** sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate.
* For now we use the same magic value, but we allow this to change in future. * For now we use the same magic value, but we allow this to change in future.
*/ */
#define SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT #define SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT
#include "lwip/err.h" #include "lwip/err.h"
#include "arch/sys_arch.h" #include "arch/sys_arch.h"
@ -115,7 +115,7 @@ void sys_mutex_lock(sys_mutex_t *mutex);
void sys_mutex_unlock(sys_mutex_t *mutex); void sys_mutex_unlock(sys_mutex_t *mutex);
/** Delete a semaphore /** Delete a semaphore
* @param mutex the mutex to delete */ * @param mutex the mutex to delete */
void sys_mutex_free(sys_mutex_t *mutex); void sys_mutex_free(sys_mutex_t *mutex);
#ifndef sys_mutex_valid #ifndef sys_mutex_valid
/** Check if a mutex is valid/allocated: return 1 for valid, 0 for invalid */ /** Check if a mutex is valid/allocated: return 1 for valid, 0 for invalid */
int sys_mutex_valid(sys_mutex_t *mutex); int sys_mutex_valid(sys_mutex_t *mutex);

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -174,7 +174,7 @@ struct tcp_pcb {
/* ports are in host byte order */ /* ports are in host byte order */
u16_t remote_port; u16_t remote_port;
u8_t flags; u8_t flags;
#define TF_ACK_DELAY ((u8_t)0x01U) /* Delayed ACK. */ #define TF_ACK_DELAY ((u8_t)0x01U) /* Delayed ACK. */
#define TF_ACK_NOW ((u8_t)0x02U) /* Immediate ACK. */ #define TF_ACK_NOW ((u8_t)0x02U) /* Immediate ACK. */
@ -196,12 +196,12 @@ struct tcp_pcb {
/* Timers */ /* Timers */
u32_t tmr; u32_t tmr;
u8_t polltmr, pollinterval; u8_t polltmr, pollinterval;
/* Retransmission timer. */ /* Retransmission timer. */
s16_t rtime; s16_t rtime;
u16_t mss; /* maximum segment size */ u16_t mss; /* maximum segment size */
/* RTT (round trip time) estimation variables */ /* RTT (round trip time) estimation variables */
u32_t rttest; /* RTT estimate in 500ms ticks */ u32_t rttest; /* RTT estimate in 500ms ticks */
u32_t rtseq; /* sequence number being timed */ u32_t rtseq; /* sequence number being timed */
@ -213,9 +213,9 @@ struct tcp_pcb {
/* fast retransmit/recovery */ /* fast retransmit/recovery */
u32_t lastack; /* Highest acknowledged seqno. */ u32_t lastack; /* Highest acknowledged seqno. */
u8_t dupacks; u8_t dupacks;
/* congestion avoidance/control variables */ /* congestion avoidance/control variables */
u16_t cwnd; u16_t cwnd;
u16_t ssthresh; u16_t ssthresh;
/* sender variables */ /* sender variables */
@ -226,7 +226,7 @@ struct tcp_pcb {
u32_t snd_lbb; /* Sequence number of next byte to be buffered. */ u32_t snd_lbb; /* Sequence number of next byte to be buffered. */
u16_t acked; u16_t acked;
u16_t snd_buf; /* Available buffer space for sending (in bytes). */ u16_t snd_buf; /* Available buffer space for sending (in bytes). */
#define TCP_SNDQUEUELEN_OVERFLOW (0xffff-3) #define TCP_SNDQUEUELEN_OVERFLOW (0xffff-3)
u16_t snd_queuelen; /* Available buffer space for sending (in tcp_segs). */ u16_t snd_queuelen; /* Available buffer space for sending (in tcp_segs). */
@ -234,12 +234,12 @@ struct tcp_pcb {
#if TCP_OVERSIZE #if TCP_OVERSIZE
/* Extra bytes available at the end of the last pbuf in unsent. */ /* Extra bytes available at the end of the last pbuf in unsent. */
u16_t unsent_oversize; u16_t unsent_oversize;
#endif /* TCP_OVERSIZE */ #endif /* TCP_OVERSIZE */
/* These are ordered by sequence number: */ /* These are ordered by sequence number: */
struct tcp_seg *unsent; /* Unsent (queued) segments. */ struct tcp_seg *unsent; /* Unsent (queued) segments. */
struct tcp_seg *unacked; /* Sent but unacknowledged segments. */ struct tcp_seg *unacked; /* Sent but unacknowledged segments. */
#if TCP_QUEUE_OOSEQ #if TCP_QUEUE_OOSEQ
struct tcp_seg *ooseq; /* Received out of sequence segments. */ struct tcp_seg *ooseq; /* Received out of sequence segments. */
#endif /* TCP_QUEUE_OOSEQ */ #endif /* TCP_QUEUE_OOSEQ */
@ -269,7 +269,7 @@ struct tcp_pcb {
u32_t keep_intvl; u32_t keep_intvl;
u32_t keep_cnt; u32_t keep_cnt;
#endif /* LWIP_TCP_KEEPALIVE */ #endif /* LWIP_TCP_KEEPALIVE */
/* Persist timer counter */ /* Persist timer counter */
u32_t persist_cnt; u32_t persist_cnt;
/* Persist timer back-off */ /* Persist timer back-off */
@ -279,7 +279,7 @@ struct tcp_pcb {
u8_t keep_cnt_sent; u8_t keep_cnt_sent;
}; };
struct tcp_pcb_listen { struct tcp_pcb_listen {
/* Common members of all PCB types */ /* Common members of all PCB types */
IP_PCB; IP_PCB;
/* Protocol specific PCB members */ /* Protocol specific PCB members */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -284,7 +284,7 @@ struct tcp_seg {
u16_t oversize_left; /* Extra bytes available at the end of the last u16_t oversize_left; /* Extra bytes available at the end of the last
pbuf in unsent (used for asserting vs. pbuf in unsent (used for asserting vs.
tcp_pcb.unsent_oversized only) */ tcp_pcb.unsent_oversized only) */
#endif /* TCP_OVERSIZE_DBGCHECK */ #endif /* TCP_OVERSIZE_DBGCHECK */
#if TCP_CHECKSUM_ON_COPY #if TCP_CHECKSUM_ON_COPY
u16_t chksum; u16_t chksum;
u8_t chksum_swapped; u8_t chksum_swapped;
@ -313,7 +313,7 @@ extern u32_t tcp_ticks;
/* The TCP PCB lists. */ /* The TCP PCB lists. */
union tcp_listen_pcbs_t { /* List of all TCP PCBs in LISTEN state. */ union tcp_listen_pcbs_t { /* List of all TCP PCBs in LISTEN state. */
struct tcp_pcb_listen *listen_pcbs; struct tcp_pcb_listen *listen_pcbs;
struct tcp_pcb *pcbs; struct tcp_pcb *pcbs;
}; };
extern struct tcp_pcb *tcp_bound_pcbs; extern struct tcp_pcb *tcp_bound_pcbs;
@ -325,7 +325,7 @@ extern struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-WAIT. *
extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */
/* Axioms about the above lists: /* Axioms about the above lists:
1) Every TCP PCB that is not CLOSED is in one of the lists. 1) Every TCP PCB that is not CLOSED is in one of the lists.
2) A PCB is only in one of the lists. 2) A PCB is only in one of the lists.
3) All PCBs in the tcp_listen_pcbs list is in LISTEN state. 3) All PCBs in the tcp_listen_pcbs list is in LISTEN state.

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* Simon Goldschmidt * Simon Goldschmidt
* *

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -113,7 +113,7 @@ struct udp_pcb {
/** receive callback function */ /** receive callback function */
udp_recv_fn recv; udp_recv_fn recv;
/** user-supplied argument for the recv callback */ /** user-supplied argument for the recv callback */
void *recv_arg; void *recv_arg;
}; };
/* udp_pcbs export for exernal reference (e.g. SNMP agent) */ /* udp_pcbs export for exernal reference (e.g. SNMP agent) */
extern struct udp_pcb *udp_pcbs; extern struct udp_pcb *udp_pcbs;

View File

@ -6,9 +6,9 @@
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -17,21 +17,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
@ -54,7 +54,7 @@
#define SYS_LIGHTWEIGHT_PROT 0 #define SYS_LIGHTWEIGHT_PROT 0
#endif #endif
/** /**
* NO_SYS==1: Provides VERY minimal functionality. Otherwise, * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
* use lwIP facilities. * use lwIP facilities.
*/ */
@ -177,8 +177,8 @@
/** /**
* MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h * MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h
* that defines additional pools beyond the "standard" ones required * that defines additional pools beyond the "standard" ones required
* by lwIP. If you set this to 1, you must have lwippools.h in your * by lwIP. If you set this to 1, you must have lwippools.h in your
* inlude path somewhere. * inlude path somewhere.
*/ */
#ifndef MEMP_USE_CUSTOM_POOLS #ifndef MEMP_USE_CUSTOM_POOLS
#define MEMP_USE_CUSTOM_POOLS 0 #define MEMP_USE_CUSTOM_POOLS 0
@ -326,7 +326,7 @@
/** /**
* MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
* for callback/timeout API communication. * for callback/timeout API communication.
* (only needed if you use tcpip.c) * (only needed if you use tcpip.c)
*/ */
#ifndef MEMP_NUM_TCPIP_MSG_API #ifndef MEMP_NUM_TCPIP_MSG_API
@ -335,7 +335,7 @@
/** /**
* MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
* for incoming packets. * for incoming packets.
* (only needed if you use tcpip.c) * (only needed if you use tcpip.c)
*/ */
#ifndef MEMP_NUM_TCPIP_MSG_INPKT #ifndef MEMP_NUM_TCPIP_MSG_INPKT
@ -400,7 +400,7 @@
#endif #endif
/** /**
* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. * PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
*/ */
#ifndef PBUF_POOL_SIZE #ifndef PBUF_POOL_SIZE
#define PBUF_POOL_SIZE 10 #define PBUF_POOL_SIZE 10
@ -712,7 +712,7 @@
/** /**
* SNMP_CONCURRENT_REQUESTS: Number of concurrent requests the module will * SNMP_CONCURRENT_REQUESTS: Number of concurrent requests the module will
* allow. At least one request buffer is required. * allow. At least one request buffer is required.
*/ */
#ifndef SNMP_CONCURRENT_REQUESTS #ifndef SNMP_CONCURRENT_REQUESTS
#define SNMP_CONCURRENT_REQUESTS 0 #define SNMP_CONCURRENT_REQUESTS 0
@ -727,7 +727,7 @@
#endif #endif
/** /**
* SNMP_PRIVATE_MIB: * SNMP_PRIVATE_MIB:
*/ */
#ifndef SNMP_PRIVATE_MIB #ifndef SNMP_PRIVATE_MIB
#define SNMP_PRIVATE_MIB 0 #define SNMP_PRIVATE_MIB 0
@ -773,7 +773,7 @@
---------------------------------- ----------------------------------
*/ */
/** /**
* LWIP_IGMP==1: Turn on IGMP module. * LWIP_IGMP==1: Turn on IGMP module.
*/ */
#ifndef LWIP_IGMP #ifndef LWIP_IGMP
#define LWIP_IGMP 1 #define LWIP_IGMP 1
@ -958,12 +958,12 @@
#endif #endif
/** /**
* TCP_WND: The size of a TCP window. This must be at least * TCP_WND: The size of a TCP window. This must be at least
* (2 * TCP_MSS) for things to work well * (2 * TCP_MSS) for things to work well
*/ */
#ifndef TCP_WND #ifndef TCP_WND
#define TCP_WND (*(volatile uint32*)0x600011F0) #define TCP_WND (*(volatile uint32*)0x600011F0)
#endif #endif
/** /**
* TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really * TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really
@ -979,7 +979,7 @@
/** /**
* TCP_SND_BUF: TCP sender buffer space (bytes). * TCP_SND_BUF: TCP sender buffer space (bytes).
*/ */
#ifndef TCP_SND_BUF #ifndef TCP_SND_BUF
#define TCP_SND_BUF 2 * TCP_MSS #define TCP_SND_BUF 2 * TCP_MSS
@ -1070,7 +1070,7 @@
#ifndef LWIP_EVENT_API #ifndef LWIP_EVENT_API
#define LWIP_EVENT_API 0 #define LWIP_EVENT_API 0
#define LWIP_CALLBACK_API 1 #define LWIP_CALLBACK_API 1
#else #else
#define LWIP_EVENT_API 1 #define LWIP_EVENT_API 1
#define LWIP_CALLBACK_API 0 #define LWIP_CALLBACK_API 0
#endif #endif
@ -1769,28 +1769,28 @@
#ifndef CHECKSUM_GEN_IP #ifndef CHECKSUM_GEN_IP
#define CHECKSUM_GEN_IP 1 #define CHECKSUM_GEN_IP 1
#endif #endif
/** /**
* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets. * CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.
*/ */
#ifndef CHECKSUM_GEN_UDP #ifndef CHECKSUM_GEN_UDP
#define CHECKSUM_GEN_UDP 1 #define CHECKSUM_GEN_UDP 1
#endif #endif
/** /**
* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets. * CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.
*/ */
#ifndef CHECKSUM_GEN_TCP #ifndef CHECKSUM_GEN_TCP
#define CHECKSUM_GEN_TCP 1 #define CHECKSUM_GEN_TCP 1
#endif #endif
/** /**
* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets. * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.
*/ */
#ifndef CHECKSUM_CHECK_IP #ifndef CHECKSUM_CHECK_IP
#define CHECKSUM_CHECK_IP 1 #define CHECKSUM_CHECK_IP 1
#endif #endif
/** /**
* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets. * CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.
*/ */

View File

@ -2,9 +2,9 @@
* Copyright (c) 2001-2003 Swedish Institute of Computer Science. * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
* Copyright (c) 2003-2004 Leon Woestenberg <leon.woestenberg@axon.tv> * Copyright (c) 2003-2004 Leon Woestenberg <leon.woestenberg@axon.tv>
* Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands. * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
@ -13,21 +13,21 @@
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */

View File

@ -6,13 +6,13 @@
* The authors hereby grant permission to use, copy, modify, distribute, * The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided * and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this * that existing copyright notices are retained in all copies and that this
* notice and the following disclaimer are included verbatim in any * notice and the following disclaimer are included verbatim in any
* distributions. No written agreement, license, or royalty fee is required * distributions. No written agreement, license, or royalty fee is required
* for any of the authorized uses. * for any of the authorized uses.
* *
* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2010-2011 Espressif System * Copyright (c) 2010-2011 Espressif System
* *
*/ */
#ifndef _WLAN_LWIP_IF_H_ #ifndef _WLAN_LWIP_IF_H_
@ -10,7 +10,7 @@
#define LWIP_IF1_PRIO 29 #define LWIP_IF1_PRIO 29
enum { enum {
SIG_LWIP_RX = 0, SIG_LWIP_RX = 0,
}; };
struct netif * eagle_lwip_if_alloc(struct ieee80211_conn *conn, const uint8 *macaddr, struct ip_info *info); struct netif * eagle_lwip_if_alloc(struct ieee80211_conn *conn, const uint8 *macaddr, struct ip_info *info);

View File

@ -34,7 +34,7 @@
/* /*
* It is vital that this file is only included once in the entire * It is vital that this file is only included once in the entire
* system. * system.
*/ */
#ifndef _RTCTIME_INTERNAL_H_ #ifndef _RTCTIME_INTERNAL_H_
@ -533,7 +533,7 @@ static void rtc_time_enter_deep_sleep_us(uint32_t us)
if (rtc_time_check_wake_magic()) if (rtc_time_check_wake_magic())
rtc_time_set_sleep_magic(); rtc_time_set_sleep_magic();
else else
bbram_save(); bbram_save();
rtc_reg_write(RTC_TARGET_ADDR,rtc_time_read_raw()+cycles); rtc_reg_write(RTC_TARGET_ADDR,rtc_time_read_raw()+cycles);
@ -788,7 +788,7 @@ static int32_t rtc_time_adjust_delta_by_rate(int32_t delta) {
} }
static uint64_t rtc_time_adjust_us_by_rate(uint64_t us, int force) { static uint64_t rtc_time_adjust_us_by_rate(uint64_t us, int force) {
uint64_t usoff = us - rtc_usatlastrate; uint64_t usoff = us - rtc_usatlastrate;
uint64_t usadj = (usoff * ((1ull << 32) + (int) rtc_usrate)) >> 32; uint64_t usadj = (usoff * ((1ull << 32) + (int) rtc_usrate)) >> 32;
usadj = usadj + rtc_rateadjustedus; usadj = usadj + rtc_rateadjustedus;

View File

@ -64,7 +64,7 @@ typedef struct{
#endif #endif
pmbedtls_session psession; pmbedtls_session psession;
mbedtls_net_context fd; mbedtls_net_context fd;
mbedtls_net_context listen_fd; mbedtls_net_context listen_fd;
mbedtls_ctr_drbg_context ctr_drbg; mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ssl_context ssl; mbedtls_ssl_context ssl;
mbedtls_ssl_config conf; mbedtls_ssl_config conf;

View File

@ -111,7 +111,7 @@ typedef enum{
do { \ do { \
mbedtls_parse_thread(s, event, error); \ mbedtls_parse_thread(s, event, error); \
}while(0) }while(0)
typedef enum{ typedef enum{
ENTCONN_EVENT_NONE = 0, ENTCONN_EVENT_NONE = 0,
NETCONN_EVENT_ESTABLISHED = 1, NETCONN_EVENT_ESTABLISHED = 1,

View File

@ -57,7 +57,7 @@
#else #else
// I2C displays can be defined in an external file. // I2C displays can be defined in an external file.
#define U8G2_DISPLAY_TABLE_I2C \ #define U8G2_DISPLAY_TABLE_I2C \
U8G2_DISPLAY_TABLE_I2C_EXTRA U8G2_DISPLAY_TABLE_I2C_EXTRA
@ -150,7 +150,7 @@
#else #else
// SPI displays can be defined in an external file. // SPI displays can be defined in an external file.
#define U8G2_DISPLAY_TABLE_SPI \ #define U8G2_DISPLAY_TABLE_SPI \
U8G2_DISPLAY_TABLE_SPI_EXTRA U8G2_DISPLAY_TABLE_SPI_EXTRA

View File

@ -18,7 +18,7 @@
#else #else
// //
// The font table can be defined in an external file. // The font table can be defined in an external file.
#define U8G2_FONT_TABLE \ #define U8G2_FONT_TABLE \
U8G2_FONT_TABLE_EXTRA U8G2_FONT_TABLE_EXTRA

View File

@ -73,7 +73,7 @@
#define BUILD_SPIFFS #define BUILD_SPIFFS
//#define SPIFFS_FIXED_LOCATION 0x100000 //#define SPIFFS_FIXED_LOCATION 0x100000
//#define SPIFFS_MAX_FILESYSTEM_SIZE 0x20000 //#define SPIFFS_MAX_FILESYSTEM_SIZE 0x20000
//#define SPIFFS_SIZE_1M_BOUNDARY //#define SPIFFS_SIZE_1M_BOUNDARY
#define SPIFFS_CACHE 1 // Enable if you use you SPIFFS in R/W mode #define SPIFFS_CACHE 1 // Enable if you use you SPIFFS in R/W mode
#define SPIFFS_MAX_OPEN_FILES 4 // maximum number of open files for SPIFFS #define SPIFFS_MAX_OPEN_FILES 4 // maximum number of open files for SPIFFS
@ -119,10 +119,10 @@
// management, using internal timer callbacks. Whilst many Lua developers // management, using internal timer callbacks. Whilst many Lua developers
// prefer to implement equivalent features in Lua, others will prefer the // prefer to implement equivalent features in Lua, others will prefer the
// Wifi module to do this for them. Uncomment the following to enable // Wifi module to do this for them. Uncomment the following to enable
// this functionality. See the relevant WiFi module documentation for // this functionality. See the relevant WiFi module documentation for
// further details, as the scope of these changes is not obvious. // further details, as the scope of these changes is not obvious.
// Enable the wifi.startsmart() and wifi.stopsmart() // Enable the wifi.startsmart() and wifi.stopsmart()
//#define WIFI_SMART_ENABLE //#define WIFI_SMART_ENABLE
// Enable wifi.sta.config() event callbacks // Enable wifi.sta.config() event callbacks

View File

@ -307,7 +307,7 @@ extern unsigned int max_content_len;
#else #else
// the current mbedtls integration doesn't allow to set the buffer size dynamically: // the current mbedtls integration doesn't allow to set the buffer size dynamically:
// MBEDTLS_SSL_MAX_FRAGMENT_LENGTH feature and dynamic sizing are mutually exclusive // MBEDTLS_SSL_MAX_FRAGMENT_LENGTH feature and dynamic sizing are mutually exclusive
// due to non-constant initializer element in app/mbedtls/library/ssl_tls.c:150 // due to non-constant initializer element in app/mbedtls/library/ssl_tls.c:150
// the buffer size is hardcoded here and value is taken from SSL_BUFFER_SIZE (user_config.h) // the buffer size is hardcoded here and value is taken from SSL_BUFFER_SIZE (user_config.h)
#define MBEDTLS_SSL_MAX_CONTENT_LEN SSL_BUFFER_SIZE /**< Maxium fragment length in bytes, determines the size of each of the two internal I/O buffers */ #define MBEDTLS_SSL_MAX_CONTENT_LEN SSL_BUFFER_SIZE /**< Maxium fragment length in bytes, determines the size of each of the two internal I/O buffers */
#endif #endif

Some files were not shown because too many files have changed in this diff Show More