soc: arm: gigadevice: use common API headers

Stop relying on <soc.h> to access HAL APIs. Use generic, per-API headers
instead. Note that <soc.h> has been left as is for now, since ARM MPU
relies on a fragile chain of includes/type definitions.

This change should improve compilation efficiency, as we no longer pull
APIs that are not needed. A similar approach is followed by STM32
drivers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2022-06-01 12:35:35 +02:00 committed by Stephanos Ioannidis
commit 4946a15f15
10 changed files with 27 additions and 9 deletions

View file

@ -9,7 +9,9 @@
#include <errno.h>
#include <zephyr/drivers/pinctrl.h>
#include <zephyr/drivers/dac.h>
#include <soc.h>
#include <gd32_dac.h>
#include <gd32_rcu.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(dac_gd32, CONFIG_DAC_LOG_LEVEL);

View file

@ -8,7 +8,9 @@
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/interrupt_controller/gd32_exti.h>
#include <soc.h>
#include <gd32_gpio.h>
#include <gd32_rcu.h>
#include "gpio_utils.h"

View file

@ -11,7 +11,9 @@
#include <zephyr/devicetree.h>
#include <zephyr/drivers/pinctrl.h>
#include <zephyr/drivers/i2c.h>
#include <soc.h>
#include <gd32_i2c.h>
#include <gd32_rcu.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(i2c_gd32, CONFIG_I2C_LOG_LEVEL);

View file

@ -8,10 +8,11 @@
#include <zephyr/device.h>
#include <zephyr/drivers/interrupt_controller/gd32_exti.h>
#include <soc.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/sys/util_macro.h>
#include <gd32_exti.h>
/** Unsupported line indicator */
#define EXTI_NOTSUP 0xFFU

View file

@ -5,7 +5,9 @@
*/
#include <zephyr/drivers/pinctrl.h>
#include <soc.h>
#include <gd32_gpio.h>
#include <gd32_rcu.h>
BUILD_ASSERT((GD32_PUPD_NONE == GPIO_PUPD_NONE) &&
(GD32_PUPD_PULLUP == GPIO_PUPD_PULLUP) &&

View file

@ -5,7 +5,9 @@
*/
#include <zephyr/drivers/pinctrl.h>
#include <soc.h>
#include <gd32_gpio.h>
#include <gd32_rcu.h>
/** AFIO DT node */
#define AFIO_NODE DT_NODELABEL(afio)

View file

@ -10,9 +10,11 @@
#include <zephyr/drivers/pwm.h>
#include <zephyr/drivers/pinctrl.h>
#include <soc.h>
#include <zephyr/sys/util_macro.h>
#include <gd32_rcu.h>
#include <gd32_timer.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(pwm_gd32, CONFIG_PWM_LOG_LEVEL);

View file

@ -8,7 +8,9 @@
#include <errno.h>
#include <zephyr/drivers/pinctrl.h>
#include <zephyr/drivers/uart.h>
#include <soc.h>
#include <gd32_usart.h>
#include <gd32_rcu.h>
/* Unify GD32 HAL USART status register name to USART_STAT */
#ifndef USART_STAT

View file

@ -10,7 +10,9 @@
#include <zephyr/kernel.h>
#include <zephyr/drivers/pinctrl.h>
#include <zephyr/drivers/spi.h>
#include <soc.h>
#include <gd32_rcu.h>
#include <gd32_spi.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(spi_gd32);

View file

@ -34,6 +34,7 @@ endif()
zephyr_include_directories(${gd32_soc_sys_dir}/include)
zephyr_include_directories(${gd32_std_dir}/include)
zephyr_include_directories(${ZEPHYR_HAL_GIGADEVICE_MODULE_DIR}/include)
zephyr_include_directories(${ZEPHYR_HAL_GIGADEVICE_MODULE_DIR}/common_include)
zephyr_library_sources(${gd32_soc_sys_dir}/source/system_${CONFIG_SOC_SERIES}.c)