Skip to content

Commit fa26c2b

Browse files
projects:ad7124:sync up the project folder with innersource
1)Removed the mbed platform support for ad7124 2)Resolved the coverity errors Signed-off-by: Kantipudi-Supriya <[email protected]>
1 parent f66c468 commit fa26c2b

File tree

15 files changed

+194
-311
lines changed

15 files changed

+194
-311
lines changed

projects/ad7124_iio/.mbedignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

projects/ad7124_iio/STM32/nucleo_h563/.extSettings

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
[ProjectFiles]
2-
HeaderPath=../../app;../../../../libraries/no-OS/util;../../../../libraries/no-OS/include;../../../../libraries/no-OS/drivers/platform/stm32;../../../../libraries/no-OS/iio;../../../../libraries/no-OS/drivers/adc/ad7124;../../../../libraries/no-OS/drivers/api;../../../../libraries/no-OS/drivers/eeprom/24xx32a/;../../../../libraries/precision-converters-library/common/;../../../../libraries/precision-converters-library/board_info/;
2+
HeaderPath=../../app;../../../../libraries/no-OS/util;../../../../libraries/no-OS/include;../../../../libraries/no-OS/drivers/platform/stm32;../../../../libraries/no-OS/iio;../../../../libraries/no-OS/drivers/adc/ad7124;../../../../libraries/no-OS/drivers/api;../../../../libraries/no-OS/drivers/eeprom/24xx32a/;../../../../libraries/precision-converters-library/common/;../../../../libraries/precision-converters-library/board_info/;../../../_common/;
33

44
[Groups]
55
app/=../../app/main.c;../../app/ad7124_iio.c;../../app/ad7124_iio.h;../../app/app_config.h;../../app/app_config.c;../../app/app_config_stm32.c;../../app/app_config_stm32.h;../../app/ad7124_user_config.c;../../app/ad7124_user_config.h;../../app/ad7124_support.c;../../app/ad7124_support.h;../../app/stm32_gpio_irq_generated.c;
66

7+
app/_common/=../../../_common/common_macros.h;
8+
79
app/libraries/precision-converters-library/common/=../../../../libraries/precision-converters-library/common/common.h;../../../../libraries/precision-converters-library/common/common.c;
810

911
app/libraries/precision-converters-library/board_info/=../../../../libraries/precision-converters-library/board_info/board_info.c;../../../../libraries/precision-converters-library/board_info/board_info.h;
@@ -21,4 +23,4 @@ app/libraries/no-OS/iio/=../../../../libraries/no-OS/iio/iio.c;../../../../libra
2123
app/libraries/no-OS/drivers/api/=../../../../libraries/no-OS/drivers/api/no_os_gpio.c;../../../../libraries/no-OS/drivers/api/no_os_spi.c;../../../../libraries/no-OS/drivers/api/no_os_irq.c;../../../../libraries/no-OS/drivers/api/no_os_uart.c;../../../../libraries/no-OS/drivers/api/no_os_i2c.c;../../../../libraries/no-OS/drivers/api/no_os_eeprom.c;../../../../libraries/no-OS/drivers/api/no_os_dma.c;
2224

2325
[Others]
24-
Define=_USE_STD_INT_TYPES;TINYIIOD_VERSION_MAJOR;TINYIIOD_VERSION_MINOR;TINYIIOD_VERSION_GIT;IIOD_BUFFER_SIZE;IIO_IGNORE_BUFF_OVERRUN_ERR;USE_PHY_COM_PORT;
26+
Define=_USE_STD_INT_TYPES;TINYIIOD_VERSION_MAJOR;TINYIIOD_VERSION_MINOR;TINYIIOD_VERSION_GIT;IIOD_BUFFER_SIZE;IIO_IGNORE_BUFF_OVERRUN_ERR;USE_PHY_COM_PORT;ACTIVE_PLATFORM:2;ACTIVE_IIO_CLIENT:1;

projects/ad7124_iio/STM32/nucleo_h563/ad7124_iio.ioc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ Mcu.PinsNb=47
108108
Mcu.ThirdPartyNb=0
109109
Mcu.UserConstants=
110110
Mcu.UserName=STM32H563ZITx
111-
MxCube.Version=6.11.0
112-
MxDb.Version=DB.6.0.110
111+
MxCube.Version=6.11.1
112+
MxDb.Version=DB.6.0.111
113113
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
114114
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
115115
NVIC.EXTI3_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:false
@@ -334,7 +334,7 @@ ProjectManager.ToolChainLocation=
334334
ProjectManager.UAScriptAfterPath=
335335
ProjectManager.UAScriptBeforePath=
336336
ProjectManager.UnderRoot=true
337-
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-false,3-MX_USART3_UART_Init-USART3-false-HAL-false,4-MX_ICACHE_Init-ICACHE-false-HAL-false,5-MX_SPI1_Init-SPI1-false-HAL-false,6-MX_I2C1_Init-I2C1-false-HAL-true,0-MX_CORTEX_M33_NS_Init-CORTEX_M33_NS-false-HAL-true,0-MX_PWR_Init-PWR-false-HAL-true
337+
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-false,3-MX_USART3_UART_Init-USART3-false-HAL-false,4-MX_ICACHE_Init-ICACHE-false-HAL-false,5-MX_SPI1_Init-SPI1-false-HAL-false,6-MX_I2C1_Init-I2C1-false-HAL-false,0-MX_CORTEX_M33_NS_Init-CORTEX_M33_NS-false-HAL-true,0-MX_PWR_Init-PWR-false-HAL-true
338338
RCC.ADCFreq_Value=250000000
339339
RCC.AHBFreq_Value=250000000
340340
RCC.APB1Freq_Value=250000000

projects/ad7124_iio/app/ad7124_iio.c

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @brief Main interface for AD7124 IIO Application firmware example program.
44
* @details This module acts as an interface for the AD7124 IIO Application.
55
*******************************************************************************
6-
* Copyright (c) 2023-24 Analog Devices, Inc.
6+
* Copyright (c) 2023-25 Analog Devices, Inc.
77
88
* All rights reserved.
99
*
@@ -24,7 +24,6 @@
2424
#include "no_os_util.h"
2525
#include "no_os_error.h"
2626
#include "common.h"
27-
#include "no_os_gpio.h"
2827
#include "no_os_irq.h"
2928
#include "ad7124_support.h"
3029
#include "iio_trigger.h"
@@ -661,9 +660,11 @@ static int iio_ad7124_local_backend_event_read(void *conn,
661660
uint8_t *buf,
662661
uint32_t len)
663662
{
663+
int ret = 0;
664664
#if (ACTIVE_IIO_CLIENT == IIO_CLIENT_LOCAL)
665-
return pl_gui_event_read(buf, len);
665+
ret = pl_gui_event_read(buf, len);
666666
#endif
667+
return ret;
667668
}
668669

669670
/**
@@ -677,9 +678,11 @@ static int iio_ad7124_local_backend_event_write(void *conn,
677678
uint8_t *buf,
678679
uint32_t len)
679680
{
681+
int ret = 0;
680682
#if (ACTIVE_IIO_CLIENT == IIO_CLIENT_LOCAL)
681-
return pl_gui_event_write(buf, len);
683+
ret = pl_gui_event_write(buf, len);
682684
#endif
685+
return ret;
683686
}
684687

685688
/**
@@ -728,23 +731,39 @@ static int32_t ad7124_iio_prepare_transfer(void* dev_instance, uint32_t ch_mask)
728731
* If not, the GPIO interrupt may occur during the period where there is a UART read happening
729732
* for the READBUF command. If UART interrupts are not prioritized, then it would lead to missing of
730733
* characters in the IIO command sent from the client. */
731-
#if(DATA_CAPTURE_MODE == CONTINUOUS_DATA_CAPTURE)
732-
#if(ACTIVE_PLATFORM == STM32_PLATFORM)
733-
no_os_irq_set_priority(trigger_irq_desc, IRQ_INT_ID, RDY_GPIO_PRIORITY);
734-
#endif
734+
#if (DATA_CAPTURE_MODE == CONTINUOUS_DATA_CAPTURE) && (ACTIVE_IIO_CLIENT == IIO_CLIENT_REMOTE)
735+
ret = no_os_irq_set_priority(trigger_irq_desc, IRQ_INT_ID, RDY_GPIO_PRIORITY);
736+
if (ret) {
737+
return ret;
738+
}
735739
#endif
736740

737741
ret = ad7124_trigger_data_capture(ad7124_dev_inst);
738742
if (ret) {
739743
return ret;
740744
}
741745

746+
/* Clear pending interrupt to ensure first sample is valid data */
747+
ret = no_os_irq_clear_pending(trigger_irq_desc, IRQ_INT_ID);
748+
if (ret) {
749+
return ret;
750+
}
751+
742752
#if (DATA_CAPTURE_MODE == BURST_DATA_CAPTURE)
743753
ret = no_os_irq_enable(trigger_irq_desc, IRQ_INT_ID);
744754
if (ret) {
745755
return ret;
746756
}
747757
#else /* Continuous Capture Mode */
758+
759+
/* Clear pending Interrupt before enabling back the trigger.
760+
* Else , a spurious interrupt is observed after a legitimate interrupt,
761+
* as SPI SDO is on the same pin and is mistaken for an interrupt event */
762+
ret = no_os_irq_clear_pending(trigger_irq_desc, IRQ_INT_ID);
763+
if (ret) {
764+
return ret;
765+
}
766+
748767
ret = iio_trig_enable(ad7124_hw_trig_desc);
749768
if (ret) {
750769
return ret;
@@ -826,15 +845,13 @@ int32_t ad7124_trigger_handler(struct iio_device_data *iio_dev_data)
826845
return ret;
827846
}
828847

829-
#if (ACTIVE_PLATFORM == STM32_PLATFORM)
830848
/* Clear pending Interrupt before enabling back the trigger.
831849
* Else , a spurious interrupt is observed after a legitimate interrupt,
832850
* as SPI SDO is on the same pin and is mistaken for an interrupt event */
833851
ret = no_os_irq_clear_pending(trigger_irq_desc, IRQ_INT_ID);
834852
if (ret) {
835853
return ret;
836854
}
837-
#endif
838855

839856
/* Enable back the interrupts to use RDY / SDO shared pin as end of
840857
* conversion interrupt event monitor pin */
@@ -912,15 +929,13 @@ static int32_t ad7124_iio_submit_buffer(struct iio_device_data *iio_dev_data)
912929
return ret;
913930
}
914931

915-
#if (ACTIVE_PLATFORM == STM32_PLATFORM)
916932
/* Clear pending Interrupt before enabling back the trigger.
917933
* Else, a spurious interrupt is observed after a legitimate interrupt,
918934
* as SPI SDO is on the same pin and is mistaken for an interrupt event */
919935
ret = no_os_irq_clear_pending(trigger_irq_desc, IRQ_INT_ID);
920936
if (ret) {
921937
return ret;
922938
}
923-
#endif
924939

925940
/* Interrupt is enabled back after data is pushed into buffer */
926941
ret = no_os_irq_enable(trigger_irq_desc, IRQ_INT_ID);
@@ -1063,6 +1078,7 @@ int ad7124_iio_init(struct iio_device **desc, uint8_t dev_indx)
10631078
ad7124_sampling_frequency,
10641079
chn);
10651080
if (ret) {
1081+
free(iio_ad7124_inst);
10661082
return ret;
10671083
}
10681084
}

projects/ad7124_iio/app/ad7124_support.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*@file ad7124_support.c
33
*@brief Provides useful support functions for the AD7124 NoOS driver
44
******************************************************************************
5-
* Copyright (c) 2023-24 Analog Devices, Inc.
5+
* Copyright (c) 2023-25 Analog Devices, Inc.
66
* All rights reserved.
77
*
88
* This software is proprietary to Analog Devices, Inc. and its licensors.
@@ -46,12 +46,13 @@ int ad7124_get_polarity(struct ad7124_dev *dev,
4646
enum ad7124_input_polarity *polarity)
4747
{
4848
uint8_t setup_id;
49-
setup_id = dev->chan_map[chn].setup_sel;
5049

5150
if (!dev || !polarity) {
5251
return -EINVAL;
5352
}
5453

54+
setup_id = dev->chan_map[chn].setup_sel;
55+
5556
if (dev->setups[setup_id].bi_unipolar) {
5657
*polarity = AD7124_BIPOLAR;
5758
} else {

projects/ad7124_iio/app/ad7124_support.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*@file ad7124_support.h
33
*@brief Provides useful support functions for the AD7124 NoOS driver
44
******************************************************************************
5-
* Copyright (c) 2023-24 Analog Devices, Inc.
5+
* Copyright (c) 2023-25 Analog Devices, Inc.
66
* All rights reserved.
77
*
88
* This software is proprietary to Analog Devices, Inc. and its licensors.
@@ -32,7 +32,7 @@
3232
* or failed in between.
3333
* Note: This timeout factor is dependent upon the MCU clock frequency. Below timeout
3434
* is tested for SDP-K1 platform @180Mhz default core clock */
35-
#define AD7124_CONV_TIMEOUT 1000000
35+
#define AD7124_CONV_TIMEOUT 0xffffffff
3636

3737
/******************************************************************************/
3838
/********************** Variables and User Defined Data Types *****************/

projects/ad7124_iio/app/app_config.c

Lines changed: 3 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file app_config.c
33
* @brief Source file for the application configuration for AD7124 IIO Application
44
********************************************************************************
5-
* Copyright (c) 2023-24 Analog Devices, Inc.
5+
* Copyright (c) 2023-25 Analog Devices, Inc.
66
* All rights reserved.
77
*
88
* This software is proprietary to Analog Devices, Inc. and its licensors.
@@ -68,10 +68,8 @@ struct no_os_uart_init_param uart_init_params = {
6868
.size = NO_OS_UART_CS_8,
6969
.parity = NO_OS_UART_PAR_NO,
7070
.stop = NO_OS_UART_STOP_1_BIT,
71-
#if (ACTIVE_PLATFORM == STM32_PLATFORM)
7271
.asynchronous_rx = true,
7372
.irq_id = UART_IRQ_ID,
74-
#endif
7573
#if defined(USE_VIRTUAL_COM_PORT)
7674
.platform_ops = &vcom_ops,
7775
.extra = &vcom_extra_init_params
@@ -173,20 +171,8 @@ struct no_os_irq_ctrl_desc *ticker_int_desc;
173171
/************************** Functions Definition ******************************/
174172
/******************************************************************************/
175173

176-
#if (ACTIVE_IIO_CLIENT == IIO_CLIENT_LOCAL)
177174
/**
178-
* @brief lvgl tick update callback function for pocket lab
179-
* @param ctx[in] - callback context
180-
* @return none
181-
*/
182-
void lvgl_tick_callback(void* ctx)
183-
{
184-
pl_gui_lvgl_tick_update(LVGL_TICK_TIME_MS);
185-
}
186-
#endif
187-
188-
/**
189-
* @brief Initialize the UART peripheral
175+
* @brief Initialize the UART peripheral
190176
* @return 0 in case of success, negative error code otherwise
191177
*/
192178
static int init_uart(void)
@@ -244,41 +230,8 @@ int init_interrupt(void)
244230
return 0;
245231
}
246232

247-
#if (ACTIVE_PLATFORM == MBED_PLATFORM)
248233
/**
249-
* @brief Initialize the lvgl timer peripheral
250-
* @return 0 in case of success, negative error code otherwise
251-
*/
252-
static int32_t init_lvgl_timer(void)
253-
{
254-
int32_t ret;
255-
256-
/* Init interrupt controller for Ticker interrupt */
257-
ret = no_os_irq_ctrl_init(&ticker_int_desc, &ticker_int_init_params);
258-
if (ret) {
259-
return ret;
260-
}
261-
262-
/* Register a callback function for Ticker interrupt */
263-
ret = no_os_irq_register_callback(ticker_int_desc,
264-
TICKER_ID,
265-
&ticker_int_callback_desc);
266-
if (ret) {
267-
return ret;
268-
}
269-
270-
/* Enable Ticker interrupt */
271-
ret = no_os_irq_enable(ticker_int_desc, TICKER_ID);
272-
if (ret) {
273-
return ret;
274-
}
275-
276-
return 0;
277-
}
278-
#endif
279-
280-
/**
281-
* @brief Initialize the system peripherals
234+
* @brief Initialize the system peripherals
282235
* @return 0 in case of success, negative error code otherwise
283236
*/
284237
int init_system(void)
@@ -294,14 +247,6 @@ int init_system(void)
294247
return ret;
295248
}
296249

297-
#if (ACTIVE_IIO_CLIENT == IIO_CLIENT_LOCAL)
298-
/* Initialize the lvgl timer */
299-
ret = init_lvgl_timer();
300-
if (ret) {
301-
return ret;
302-
}
303-
#endif
304-
305250
ret = no_os_gpio_get(&csb_gpio, &csb_init_param);
306251
if (ret) {
307252
return ret;
@@ -322,20 +267,11 @@ int init_system(void)
322267
return ret;
323268
}
324269

325-
#if(ACTIVE_PLATFORM == MBED_PLATFORM)
326270
ret = no_os_gpio_direction_output(csb_gpio, NO_OS_GPIO_HIGH);
327271
if (ret) {
328272
return ret;
329273
}
330274

331-
#if defined(USE_SDRAM)
332-
ret = sdram_init();
333-
if (ret) {
334-
return ret;
335-
}
336-
#endif
337-
#endif
338-
339275
ret = init_interrupt();
340276
if (ret) {
341277
return ret;

0 commit comments

Comments
 (0)