You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.1 KiB
55 lines
1.1 KiB
/********************************************************************* |
|
PicoTCP. Copyright (c) 2014-2015 Altran Intelligent Systems. Some rights reserved. |
|
See LICENSE and COPYING for usage. |
|
|
|
*********************************************************************/ |
|
#ifndef _INCLUDE_PICO_ESP8266 |
|
#define _INCLUDE_PICO_ESP8266 |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdint.h> |
|
#include <stdlib.h> |
|
#include <string.h> |
|
#include "pico_constants.h" |
|
|
|
/* -------------- DEBUG ------------- */ |
|
|
|
/* #define dbg(...) */ |
|
#define dbg printf |
|
|
|
/* -------------- MEMORY ------------- */ |
|
extern void *pvPortMalloc( size_t xWantedSize ); |
|
extern void vPortFree( void *pv ); |
|
|
|
#define pico_free vPortFree |
|
|
|
static inline void *pico_zalloc(size_t size) |
|
{ |
|
void *ptr = (void *)pvPortMalloc(size); |
|
|
|
if(ptr) |
|
memset(ptr, 0u, size); |
|
|
|
return ptr; |
|
} |
|
|
|
/* -------------- TIME ------------- */ |
|
|
|
extern volatile uint32_t esp_tick; |
|
|
|
static inline pico_time PICO_TIME_MS(void) { |
|
return (pico_time) esp_tick; |
|
} |
|
|
|
static inline pico_time PICO_TIME(void) { |
|
return PICO_TIME_MS() / 1000; |
|
} |
|
|
|
static inline void PICO_IDLE(void) { |
|
uint32_t now = esp_tick; |
|
while (now == esp_tick) |
|
; |
|
} |
|
|
|
#endif
|
|
|