Fix sdk_uart_rx_one_char implementation, move into sdk_compat.c
This commit is contained in:
parent
be3968abf0
commit
0c6a8881a4
2 changed files with 17 additions and 13 deletions
|
@ -363,15 +363,6 @@ static void dump_excinfo(void) {
|
||||||
sdk_system_rtc_mem_write(0, excinfo, 32);
|
sdk_system_rtc_mem_write(0, excinfo, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
// .irom0.text+0x368
|
|
||||||
int sdk_uart_rx_one_char(char *buf) {
|
|
||||||
/* This functions returns 1 instead of -1 on error,
|
|
||||||
but is otherwise the same. Unsure if anyone checks the
|
|
||||||
result for a specific value though.
|
|
||||||
*/
|
|
||||||
return uart_getc_nowait(0) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// .irom0.text+0x398
|
// .irom0.text+0x398
|
||||||
void sdk_wdt_init(void) {
|
void sdk_wdt_init(void) {
|
||||||
WDT.CTRL &= ~WDT_CTRL_ENABLE;
|
WDT.CTRL &= ~WDT_CTRL_ENABLE;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Wrappers for functions called by binary espressif libraries
|
* Compatibility routines for the Espressif SDK and its API
|
||||||
*
|
*
|
||||||
* Part of esp-open-rtos
|
* Part of esp-open-rtos
|
||||||
* Copyright (C) 2015 Superhouse Automation Pty Ltd
|
* Copyright (C) 2015 Superhouse Automation Pty Ltd
|
||||||
|
@ -10,6 +10,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <common_macros.h>
|
#include <common_macros.h>
|
||||||
|
|
||||||
|
#include <esp/uart.h>
|
||||||
|
|
||||||
void IRAM *zalloc(size_t nbytes)
|
void IRAM *zalloc(size_t nbytes)
|
||||||
{
|
{
|
||||||
return calloc(1, nbytes);
|
return calloc(1, nbytes);
|
||||||
|
@ -18,9 +20,8 @@ void IRAM *zalloc(size_t nbytes)
|
||||||
extern void (*__init_array_start)(void);
|
extern void (*__init_array_start)(void);
|
||||||
extern void (*__init_array_end)(void);
|
extern void (*__init_array_end)(void);
|
||||||
|
|
||||||
/* Do things which should be done as part of the startup code, but aren't.
|
/* Do things which should be done as part of the SDK startup code, but aren't.
|
||||||
|
TODO: Move into app_main.c
|
||||||
Can be replaced with _start() once we have open source startup code.
|
|
||||||
*/
|
*/
|
||||||
void sdk_compat_initialise()
|
void sdk_compat_initialise()
|
||||||
{
|
{
|
||||||
|
@ -29,3 +30,15 @@ void sdk_compat_initialise()
|
||||||
for ( p = &__init_array_start; p != &__init_array_end; ++p)
|
for ( p = &__init_array_start; p != &__init_array_end; ++p)
|
||||||
(*p)();
|
(*p)();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* UART RX function from Espressif SDK internals.
|
||||||
|
*
|
||||||
|
* Not part of published API.
|
||||||
|
*/
|
||||||
|
int sdk_uart_rx_one_char(char *buf) {
|
||||||
|
int c = uart_getc_nowait(0);
|
||||||
|
if(c < 0)
|
||||||
|
return 1;
|
||||||
|
*buf = (char)c;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue