Free (GPLv2) TCP/IP stack developed by TASS Belgium
Dependents: lpc1768-picotcp-demo ZeroMQ_PicoTCP_Publisher_demo TCPSocket_HelloWorld_PicoTCP Pico_TCP_UDP_Test ... more
pico_mbed.cpp
00001 #include <mbed.h> 00002 #include <rtos.h> 00003 00004 extern "C" { 00005 #include "pico_config.h" 00006 00007 pico_time local_time; 00008 uint32_t last_os_time; 00009 00010 void *pico_mutex_init(void) 00011 { 00012 return new Mutex(); 00013 } 00014 00015 void pico_mutex_lock(void *_m) 00016 { 00017 Mutex *m = (Mutex *)_m; 00018 m->lock(); 00019 } 00020 00021 void pico_mutex_unlock(void *_m) 00022 { 00023 Mutex *m = (Mutex *)_m; 00024 m->unlock(); 00025 } 00026 00027 void pico_mutex_deinit(void *_m) 00028 { 00029 Mutex *m = (Mutex *)_m; 00030 delete m; 00031 } 00032 00033 #ifdef PICO_MEASURE_STACK 00034 int freeStack = STACK_TOTAL_WORDS; 00035 void stack_fill_pattern(void * ptr) 00036 { 00037 int * movingPtr = (int *)ptr; 00038 int * finalPtr = movingPtr - STACK_TOTAL_WORDS; 00039 while(movingPtr >= finalPtr) 00040 { 00041 *movingPtr = STACK_PATTERN; 00042 movingPtr--; 00043 } 00044 } 00045 00046 void stack_count_free_words(void *ptr) 00047 { 00048 int * movingPtr = (int *)ptr; 00049 int * finalPtr = movingPtr - STACK_TOTAL_WORDS; 00050 int tmpFreeStack = 0; 00051 00052 while(finalPtr != movingPtr) 00053 { 00054 if(*finalPtr != STACK_PATTERN) 00055 break; 00056 tmpFreeStack++; 00057 finalPtr++; 00058 } 00059 freeStack = tmpFreeStack; 00060 } 00061 00062 int stack_get_free_words(void) 00063 { 00064 return freeStack; 00065 } 00066 00067 #endif 00068 00069 }
Generated on Tue Jul 12 2022 15:59:22 by 1.7.2