From 310dc9d0e553ea2fe41aa6265675f908d57500d7 Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Tue, 14 Feb 2023 15:51:44 +0100 Subject: [PATCH] Ensure only public symbols are exported Change-Id: I976e472ea46293ede86cae7205b4735091e434f1 --- CMakeLists.txt | 2 +- include/peripheral_io.h | 94 ++++++++++++++++++++--------------------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddae94a..b321988 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ ENDFOREACH(flag) ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -Werror -fPIC") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -Werror -fPIC -fvisibility=hidden") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") diff --git a/include/peripheral_io.h b/include/peripheral_io.h index e90b0f3..1de9bc0 100644 --- a/include/peripheral_io.h +++ b/include/peripheral_io.h @@ -111,7 +111,7 @@ typedef struct _peripheral_gpio_s *peripheral_gpio_h; * * @post peripheral_gpio_close() */ -int peripheral_gpio_open(int gpio_pin, peripheral_gpio_h *gpio); +EXPORT_API int peripheral_gpio_open(int gpio_pin, peripheral_gpio_h *gpio); /** * @platform @@ -133,7 +133,7 @@ int peripheral_gpio_open(int gpio_pin, peripheral_gpio_h *gpio); * * @pre peripheral_gpio_open() */ -int peripheral_gpio_close(peripheral_gpio_h gpio); +EXPORT_API int peripheral_gpio_close(peripheral_gpio_h gpio); /** * @platform @@ -158,7 +158,7 @@ int peripheral_gpio_close(peripheral_gpio_h gpio); * @see peripheral_gpio_direction_e * @see peripheral_gpio_set_edge_mode() */ -int peripheral_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_direction_e direction); +EXPORT_API int peripheral_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_direction_e direction); /** * @platform @@ -183,7 +183,7 @@ int peripheral_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_direct * @see peripheral_gpio_edge_e * @see peripheral_gpio_set_direction() */ -int peripheral_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e edge); +EXPORT_API int peripheral_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e edge); /** * @platform @@ -230,7 +230,7 @@ typedef void(*peripheral_gpio_interrupted_cb)(peripheral_gpio_h gpio, peripheral * @post peripheral_gpio_unset_interrupted_cb() * @see peripheral_gpio_set_edge_mode() */ -int peripheral_gpio_set_interrupted_cb(peripheral_gpio_h gpio, peripheral_gpio_interrupted_cb callback, void *user_data); +EXPORT_API int peripheral_gpio_set_interrupted_cb(peripheral_gpio_h gpio, peripheral_gpio_interrupted_cb callback, void *user_data); /** * @platform @@ -249,7 +249,7 @@ int peripheral_gpio_set_interrupted_cb(peripheral_gpio_h gpio, peripheral_gpio_i * * @pre peripheral_gpio_set_interrupted_cb() */ -int peripheral_gpio_unset_interrupted_cb(peripheral_gpio_h gpio); +EXPORT_API int peripheral_gpio_unset_interrupted_cb(peripheral_gpio_h gpio); /** * @platform @@ -272,7 +272,7 @@ int peripheral_gpio_unset_interrupted_cb(peripheral_gpio_h gpio); * * @see peripheral_gpio_write() */ -int peripheral_gpio_read(peripheral_gpio_h gpio, uint32_t *value); +EXPORT_API int peripheral_gpio_read(peripheral_gpio_h gpio, uint32_t *value); /** * @platform @@ -297,7 +297,7 @@ int peripheral_gpio_read(peripheral_gpio_h gpio, uint32_t *value); * @see peripheral_gpio_read() * @see peripheral_gpio_set_direction() */ -int peripheral_gpio_write(peripheral_gpio_h gpio, uint32_t value); +EXPORT_API int peripheral_gpio_write(peripheral_gpio_h gpio, uint32_t value); /** * @} @@ -339,7 +339,7 @@ typedef struct _peripheral_i2c_s *peripheral_i2c_h; * * @post peripheral_i2c_close() */ -int peripheral_i2c_open(int bus, int address, peripheral_i2c_h *i2c); +EXPORT_API int peripheral_i2c_open(int bus, int address, peripheral_i2c_h *i2c); /** * @brief Enumeration for open flags (bitmask). @@ -383,7 +383,7 @@ typedef enum { * * @post peripheral_i2c_close() */ -int peripheral_i2c_open_flags(int bus, int address, peripheral_open_flags_e flags, peripheral_i2c_h *i2c); +EXPORT_API int peripheral_i2c_open_flags(int bus, int address, peripheral_open_flags_e flags, peripheral_i2c_h *i2c); /** * @platform @@ -403,7 +403,7 @@ int peripheral_i2c_open_flags(int bus, int address, peripheral_open_flags_e flag * * @pre peripheral_i2c_open() */ -int peripheral_i2c_close(peripheral_i2c_h i2c); +EXPORT_API int peripheral_i2c_close(peripheral_i2c_h i2c); /** * @platform @@ -426,7 +426,7 @@ int peripheral_i2c_close(peripheral_i2c_h i2c); * * @see peripheral_i2c_write() */ -int peripheral_i2c_read(peripheral_i2c_h i2c, uint8_t *data, uint32_t length); +EXPORT_API int peripheral_i2c_read(peripheral_i2c_h i2c, uint8_t *data, uint32_t length); /** * @platform @@ -449,7 +449,7 @@ int peripheral_i2c_read(peripheral_i2c_h i2c, uint8_t *data, uint32_t length); * * @see peripheral_i2c_read() */ -int peripheral_i2c_write(peripheral_i2c_h i2c, uint8_t *data, uint32_t length); +EXPORT_API int peripheral_i2c_write(peripheral_i2c_h i2c, uint8_t *data, uint32_t length); /** * @platform @@ -472,7 +472,7 @@ int peripheral_i2c_write(peripheral_i2c_h i2c, uint8_t *data, uint32_t length); * * @see peripheral_i2c_write_register_byte() */ -int peripheral_i2c_read_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t *data); +EXPORT_API int peripheral_i2c_read_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t *data); /** * @platform @@ -495,7 +495,7 @@ int peripheral_i2c_read_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t * * @see peripheral_i2c_read_register_byte() */ -int peripheral_i2c_write_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t data); +EXPORT_API int peripheral_i2c_write_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t data); /** * @platform @@ -518,7 +518,7 @@ int peripheral_i2c_write_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_ * * @see peripheral_i2c_write_register_word() */ -int peripheral_i2c_read_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_t *data); +EXPORT_API int peripheral_i2c_read_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_t *data); /** * @platform @@ -541,7 +541,7 @@ int peripheral_i2c_read_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_ * * @see peripheral_i2c_read_register_word() */ -int peripheral_i2c_write_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_t data); +EXPORT_API int peripheral_i2c_write_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_t data); /** * @} @@ -592,7 +592,7 @@ typedef enum { * * @post peripheral_pwm_close() */ -int peripheral_pwm_open(int chip, int pin, peripheral_pwm_h *pwm); +EXPORT_API int peripheral_pwm_open(int chip, int pin, peripheral_pwm_h *pwm); /** * @platform @@ -614,7 +614,7 @@ int peripheral_pwm_open(int chip, int pin, peripheral_pwm_h *pwm); * * @pre peripheral_pwm_open() */ -int peripheral_pwm_close(peripheral_pwm_h pwm); +EXPORT_API int peripheral_pwm_close(peripheral_pwm_h pwm); /** * @platform @@ -635,7 +635,7 @@ int peripheral_pwm_close(peripheral_pwm_h pwm); * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error */ -int peripheral_pwm_set_period(peripheral_pwm_h pwm, uint32_t period_ns); +EXPORT_API int peripheral_pwm_set_period(peripheral_pwm_h pwm, uint32_t period_ns); /** * @platform @@ -656,7 +656,7 @@ int peripheral_pwm_set_period(peripheral_pwm_h pwm, uint32_t period_ns); * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error */ -int peripheral_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle_ns); +EXPORT_API int peripheral_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle_ns); /** * @platform @@ -679,7 +679,7 @@ int peripheral_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle_ns); * * @see peripheral_pwm_polarity_e */ -int peripheral_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity); +EXPORT_API int peripheral_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity); /** * @platform @@ -700,7 +700,7 @@ int peripheral_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error */ -int peripheral_pwm_set_enabled(peripheral_pwm_h pwm, bool enabled); +EXPORT_API int peripheral_pwm_set_enabled(peripheral_pwm_h pwm, bool enabled); /** * @} @@ -742,7 +742,7 @@ typedef struct _peripheral_adc_s *peripheral_adc_h; * * @post peripheral_adc_close() */ -int peripheral_adc_open(int device, int channel, peripheral_adc_h *adc); +EXPORT_API int peripheral_adc_open(int device, int channel, peripheral_adc_h *adc); /** * @platform @@ -764,7 +764,7 @@ int peripheral_adc_open(int device, int channel, peripheral_adc_h *adc); * * @pre peripheral_adc_open() */ -int peripheral_adc_close(peripheral_adc_h adc); +EXPORT_API int peripheral_adc_close(peripheral_adc_h adc); /** * @platform @@ -786,7 +786,7 @@ int peripheral_adc_close(peripheral_adc_h adc); * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error * */ -int peripheral_adc_read(peripheral_adc_h adc, uint32_t *value); +EXPORT_API int peripheral_adc_read(peripheral_adc_h adc, uint32_t *value); /** * @} @@ -901,7 +901,7 @@ typedef enum { * * @post peripheral_uart_close() */ -int peripheral_uart_open(int port, peripheral_uart_h *uart); +EXPORT_API int peripheral_uart_open(int port, peripheral_uart_h *uart); /** * @platform @@ -928,7 +928,7 @@ int peripheral_uart_open(int port, peripheral_uart_h *uart); * * @post peripheral_uart_close() */ -int peripheral_uart_open_flags(int port, peripheral_open_flags_e flags, peripheral_uart_h *uart); +EXPORT_API int peripheral_uart_open_flags(int port, peripheral_open_flags_e flags, peripheral_uart_h *uart); /** * @platform @@ -948,7 +948,7 @@ int peripheral_uart_open_flags(int port, peripheral_open_flags_e flags, peripher * * @pre peripheral_uart_open() */ -int peripheral_uart_close(peripheral_uart_h uart); +EXPORT_API int peripheral_uart_close(peripheral_uart_h uart); /** * @platform @@ -971,7 +971,7 @@ int peripheral_uart_close(peripheral_uart_h uart); * * @see peripheral_uart_baud_rate_e */ -int peripheral_uart_set_baud_rate(peripheral_uart_h uart, peripheral_uart_baud_rate_e baud); +EXPORT_API int peripheral_uart_set_baud_rate(peripheral_uart_h uart, peripheral_uart_baud_rate_e baud); /** * @platform @@ -994,7 +994,7 @@ int peripheral_uart_set_baud_rate(peripheral_uart_h uart, peripheral_uart_baud_r * * @see peripheral_uart_byte_size_e */ -int peripheral_uart_set_byte_size(peripheral_uart_h uart, peripheral_uart_byte_size_e byte_size); +EXPORT_API int peripheral_uart_set_byte_size(peripheral_uart_h uart, peripheral_uart_byte_size_e byte_size); /** * @platform @@ -1017,7 +1017,7 @@ int peripheral_uart_set_byte_size(peripheral_uart_h uart, peripheral_uart_byte_s * * @see peripheral_uart_parity_e */ -int peripheral_uart_set_parity(peripheral_uart_h uart, peripheral_uart_parity_e parity); +EXPORT_API int peripheral_uart_set_parity(peripheral_uart_h uart, peripheral_uart_parity_e parity); /** * @platform @@ -1040,7 +1040,7 @@ int peripheral_uart_set_parity(peripheral_uart_h uart, peripheral_uart_parity_e * * @see peripheral_uart_stop_bits_e */ -int peripheral_uart_set_stop_bits(peripheral_uart_h uart, peripheral_uart_stop_bits_e stop_bits); +EXPORT_API int peripheral_uart_set_stop_bits(peripheral_uart_h uart, peripheral_uart_stop_bits_e stop_bits); /** * @platform @@ -1065,7 +1065,7 @@ int peripheral_uart_set_stop_bits(peripheral_uart_h uart, peripheral_uart_stop_b * @see peripheral_uart_software_flow_control_e * @see peripheral_uart_hardware_flow_control_e */ -int peripheral_uart_set_flow_control(peripheral_uart_h uart, +EXPORT_API int peripheral_uart_set_flow_control(peripheral_uart_h uart, peripheral_uart_software_flow_control_e sw_flow_control, peripheral_uart_hardware_flow_control_e hw_flow_control); @@ -1091,7 +1091,7 @@ int peripheral_uart_set_flow_control(peripheral_uart_h uart, * * @see peripheral_uart_write() */ -int peripheral_uart_read(peripheral_uart_h uart, uint8_t *data, uint32_t length); +EXPORT_API int peripheral_uart_read(peripheral_uart_h uart, uint8_t *data, uint32_t length); /** @@ -1113,7 +1113,7 @@ int peripheral_uart_read(peripheral_uart_h uart, uint8_t *data, uint32_t length) * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error * */ -int peripheral_uart_flush(peripheral_uart_h uart); +EXPORT_API int peripheral_uart_flush(peripheral_uart_h uart); /** * @platform @@ -1134,7 +1134,7 @@ int peripheral_uart_flush(peripheral_uart_h uart); * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error * */ -int peripheral_uart_drain(peripheral_uart_h uart); +EXPORT_API int peripheral_uart_drain(peripheral_uart_h uart); /** * @platform @@ -1158,7 +1158,7 @@ int peripheral_uart_drain(peripheral_uart_h uart); * * @see peripheral_uart_read() */ -int peripheral_uart_write(peripheral_uart_h uart, uint8_t *data, uint32_t length); +EXPORT_API int peripheral_uart_write(peripheral_uart_h uart, uint8_t *data, uint32_t length); /** * @} @@ -1220,7 +1220,7 @@ typedef enum { * * @post peripheral_spi_close() */ -int peripheral_spi_open(int bus, int cs, peripheral_spi_h *spi); +EXPORT_API int peripheral_spi_open(int bus, int cs, peripheral_spi_h *spi); /** * @platform @@ -1242,7 +1242,7 @@ int peripheral_spi_open(int bus, int cs, peripheral_spi_h *spi); * * @see peripheral_spi_open() */ -int peripheral_spi_close(peripheral_spi_h spi); +EXPORT_API int peripheral_spi_close(peripheral_spi_h spi); /** * @platform @@ -1265,7 +1265,7 @@ int peripheral_spi_close(peripheral_spi_h spi); * * @see peripheral_spi_mode_e */ -int peripheral_spi_set_mode(peripheral_spi_h spi, peripheral_spi_mode_e mode); +EXPORT_API int peripheral_spi_set_mode(peripheral_spi_h spi, peripheral_spi_mode_e mode); /** * @platform @@ -1289,7 +1289,7 @@ int peripheral_spi_set_mode(peripheral_spi_h spi, peripheral_spi_mode_e mode); * * @see peripheral_spi_bit_order_e */ -int peripheral_spi_set_bit_order(peripheral_spi_h spi, peripheral_spi_bit_order_e bit_order); +EXPORT_API int peripheral_spi_set_bit_order(peripheral_spi_h spi, peripheral_spi_bit_order_e bit_order); /** * @platform @@ -1310,7 +1310,7 @@ int peripheral_spi_set_bit_order(peripheral_spi_h spi, peripheral_spi_bit_order_ * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error */ -int peripheral_spi_set_bits_per_word(peripheral_spi_h spi, uint8_t bits); +EXPORT_API int peripheral_spi_set_bits_per_word(peripheral_spi_h spi, uint8_t bits); /** * @platform @@ -1332,7 +1332,7 @@ int peripheral_spi_set_bits_per_word(peripheral_spi_h spi, uint8_t bits); * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error */ -int peripheral_spi_set_frequency(peripheral_spi_h spi, uint32_t freq_hz); +EXPORT_API int peripheral_spi_set_frequency(peripheral_spi_h spi, uint32_t freq_hz); /** * @platform @@ -1356,7 +1356,7 @@ int peripheral_spi_set_frequency(peripheral_spi_h spi, uint32_t freq_hz); * * @see peripheral_spi_write() */ -int peripheral_spi_read(peripheral_spi_h spi, uint8_t *data, uint32_t length); +EXPORT_API int peripheral_spi_read(peripheral_spi_h spi, uint8_t *data, uint32_t length); /** * @platform @@ -1380,7 +1380,7 @@ int peripheral_spi_read(peripheral_spi_h spi, uint8_t *data, uint32_t length); * * @see peripheral_spi_read() */ -int peripheral_spi_write(peripheral_spi_h spi, uint8_t *data, uint32_t length); +EXPORT_API int peripheral_spi_write(peripheral_spi_h spi, uint8_t *data, uint32_t length); /** * @platform @@ -1406,7 +1406,7 @@ int peripheral_spi_write(peripheral_spi_h spi, uint8_t *data, uint32_t length); * @see peripheral_spi_read() * @see peripheral_spi_write() */ -int peripheral_spi_transfer(peripheral_spi_h spi, uint8_t *txdata, uint8_t *rxdata, uint32_t length); +EXPORT_API int peripheral_spi_transfer(peripheral_spi_h spi, uint8_t *txdata, uint8_t *rxdata, uint32_t length); /** * @} -- 2.34.1