esp32: Prefix ROM routines with esp32_rom_
Also provide their prototypes in `soc.h`. This should help readability, since some ROM functions, with their names as provided by Espressif, have sometimes the same prefix as Zephyr APIs. Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This commit is contained in:
parent
095424c416
commit
5f22dab17a
5 changed files with 45 additions and 13 deletions
|
@ -24,10 +24,12 @@
|
|||
|
||||
PROVIDE ( __stack = 0x3ffe3f20 );
|
||||
|
||||
PROVIDE ( uart_tx_one_char = 0x40009200 );
|
||||
PROVIDE ( uart_rx_one_char = 0x400092d0 );
|
||||
PROVIDE ( uartAttach = 0x40008fd0 );
|
||||
PROVIDE ( intr_matrix_set = 0x4000681c );
|
||||
PROVIDE ( esp32_rom_uart_tx_one_char = 0x40009200 );
|
||||
PROVIDE ( esp32_rom_uart_rx_one_char = 0x400092d0 );
|
||||
PROVIDE ( esp32_rom_uart_attach = 0x40008fd0 );
|
||||
PROVIDE ( esp32_rom_intr_matrix_set = 0x4000681c );
|
||||
PROVIDE ( esp32_rom_gpio_matrix_in = 0x40009edc );
|
||||
PROVIDE ( esp32_rom_gpio_matrix_out = 0x40009f0c );
|
||||
|
||||
MEMORY
|
||||
{
|
||||
|
|
29
arch/xtensa/soc/esp32/soc.h
Normal file
29
arch/xtensa/soc/esp32/soc.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2017 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __SOC_H__
|
||||
#define __SOC_H__
|
||||
|
||||
#include <rom/ets_sys.h>
|
||||
|
||||
#include <zephyr/types.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
extern int esp32_rom_intr_matrix_set(int cpu_no,
|
||||
int interrupt_src,
|
||||
int interrupt_line);
|
||||
|
||||
extern int esp32_rom_gpio_matrix_in(u32_t gpio, u32_t signal_index,
|
||||
bool inverted);
|
||||
extern int esp32_rom_gpio_matrix_out(u32_t gpio, u32_t signal_index,
|
||||
bool out_inverted,
|
||||
bool out_enabled_inverted);
|
||||
|
||||
extern void esp32_rom_uart_attach(void);
|
||||
extern STATUS esp32_rom_uart_tx_one_char(u8_t chr);
|
||||
extern STATUS esp32_rom_uart_rx_one_char(u8_t *chr);
|
||||
|
||||
#endif /* __SOC_H__ */
|
|
@ -5,12 +5,12 @@
|
|||
*/
|
||||
|
||||
/* Include esp-idf headers first to avoid redefining BIT() macro */
|
||||
#include <rom/ets_sys.h>
|
||||
#include <soc/dport_reg.h>
|
||||
#include <soc/gpio_reg.h>
|
||||
#include <soc/io_mux_reg.h>
|
||||
#include <soc/soc.h>
|
||||
|
||||
#include <soc.h>
|
||||
#include <errno.h>
|
||||
#include <device.h>
|
||||
#include <gpio.h>
|
||||
|
@ -272,8 +272,8 @@ static int gpio_esp32_init(struct device *device)
|
|||
IRQ_CONNECT(CONFIG_GPIO_ESP32_IRQ, 1, gpio_esp32_isr,
|
||||
NULL, 0);
|
||||
|
||||
intr_matrix_set(0, ETS_GPIO_INTR_SOURCE,
|
||||
CONFIG_GPIO_ESP32_IRQ);
|
||||
esp32_rom_intr_matrix_set(0, ETS_GPIO_INTR_SOURCE,
|
||||
CONFIG_GPIO_ESP32_IRQ);
|
||||
|
||||
irq_enable(CONFIG_GPIO_ESP32_IRQ);
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
*/
|
||||
|
||||
/* Include esp-idf headers first to avoid redefining BIT() macro */
|
||||
#include <rom/uart.h>
|
||||
#include <rom/ets_sys.h>
|
||||
|
||||
#include <soc.h>
|
||||
#include <uart.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -16,7 +16,7 @@ static unsigned char esp32_uart_tx(struct device *dev,
|
|||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
uart_tx_one_char(c);
|
||||
esp32_rom_uart_tx_one_char(c);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ static int esp32_uart_rx(struct device *dev, unsigned char *p_char)
|
|||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
switch (uart_rx_one_char(p_char)) {
|
||||
switch (esp32_rom_uart_rx_one_char(p_char)) {
|
||||
case OK:
|
||||
return 0;
|
||||
case PENDING:
|
||||
|
@ -43,7 +43,7 @@ static int esp32_uart_init(struct device *dev)
|
|||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
uartAttach();
|
||||
esp32_rom_uart_attach();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
*/
|
||||
|
||||
/* Include esp-idf headers first to avoid redefining BIT() macro */
|
||||
#include <rom/ets_sys.h>
|
||||
#include <soc/rtc_cntl_reg.h>
|
||||
#include <soc/timer_group_reg.h>
|
||||
|
||||
#include <soc.h>
|
||||
#include <string.h>
|
||||
#include <watchdog.h>
|
||||
#include <device.h>
|
||||
|
@ -212,7 +212,8 @@ static int wdt_esp32_init(struct device *dev)
|
|||
* located in xtensa_vectors.S.
|
||||
*/
|
||||
irq_disable(CONFIG_WDT_ESP32_IRQ);
|
||||
intr_matrix_set(0, ETS_TG1_WDT_LEVEL_INTR_SOURCE, CONFIG_WDT_ESP32_IRQ);
|
||||
esp32_rom_intr_matrix_set(0, ETS_TG1_WDT_LEVEL_INTR_SOURCE,
|
||||
CONFIG_WDT_ESP32_IRQ);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue