Skip to content

Commit

Permalink
Updated to version 1.1.0 from development branch
Browse files Browse the repository at this point in the history
  • Loading branch information
BhupeshKharwa-AlifSemi committed Apr 22, 2024
2 parents b073511 + 62db8e9 commit 2f1758a
Show file tree
Hide file tree
Showing 20 changed files with 2,764 additions and 769 deletions.
13 changes: 11 additions & 2 deletions AlifSemiconductor.AzureRTOS.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
-->

<releases>
<release version="1.1.0" date="2024-02-22">
- update sample apps
</release>

<release version="1.0.0" date="2023-11-16">
- Initial Release
</release>
Expand Down Expand Up @@ -373,6 +377,8 @@
<file category="source" name="THREADX/samples/bayer2rgb.c" attr="template" select="AzureRTOS Camera test App"/>
<file category="header" name="THREADX/samples/Include/bayer.h" attr="template" select="AzureRTOS Camera test App"/>
<file category="source" name="THREADX/samples/adc_testapp.c" attr="template" select="AzureRTOS ADC test App"/>
<file category="source" name="THREADX/samples/ADC_Click_Board_testapp.c" attr="template" select="AzureRTOS ADC Click Board test App"/>
<file category="source" name="THREADX/samples/ADC_Potentiometer_testapp.c" attr="template" select="AzureRTOS ADC Potentiometer test App"/>
<file category="source" name="THREADX/samples/dac_testapp.c" attr="template" select="AzureRTOS DAC test App"/>
<file category="source" name="THREADX/samples/ARX3A0_Camera_Sensor_testApp.c" attr="template" select="AzureRTOS MIPI CSI2 Image capture App"/>
<file category="source" name="THREADX/samples/bayer.c" attr="template" select="AzureRTOS MIPI CSI2 Image capture App"/>
Expand All @@ -382,18 +388,21 @@
<file category="source" name="THREADX/samples/mix_bus_i2c_i3c_testApp.c" attr="template" select="AzureRTOS I3C/I2C Mix bus testApp"/>
<file category="source" name="THREADX/samples/CMP_testapp.c" attr="template" select="AzureRTOS Comparator testApp"/>
<file category="source" name="THREADX/samples/MRAM_Threadx.c" attr="template" select="AzureRTOS MRAM flash testApp"/>
<file category="source" name="THREADX/samples/MW_testapp.c" attr="template" select="AzureRTOS SPI Microwire test App"/>
<file category="source" name="THREADX/samples/HWSEM_Threadx.c" attr="template" select="AzureRTOS HWSEM testApp"/>
<file category="source" name="THREADX/samples/MIPI_Interface_Video_testApp.c" attr="template" select="AzureRTOS Viewfinder testApp"/>
<file category="source" name="THREADX/samples/image_processing.c" attr="template" select="AzureRTOS Viewfinder testApp"/>
<!-- <file category="source" name="THREADX/samples/bayer.c" attr="template" select="AzureRTOS Viewfinder testApp"/>
<file category="source" name="THREADX/samples/bayer.c" attr="template" select="AzureRTOS Viewfinder testApp"/>
<file category="source" name="THREADX/samples/bayer2rgb.c" attr="template" select="AzureRTOS Viewfinder testApp"/>
<file category="header" name="THREADX/samples/Include/bayer.h" attr="template" select="AzureRTOS Viewfinder testApp"/>-->
<file category="header" name="THREADX/samples/Include/bayer.h" attr="template" select="AzureRTOS Viewfinder testApp"/>
<file category="source" name="THREADX/samples/Flash_ISSI_Threadx_app.c" attr="template" select="AzureRTOS (OSPI)ISSI Flash testApp"/>
<!-- <file category="source" name="THREADX/samples/QEC_app.c" attr="template" select="AzureRTOS QEC testApp"/>-->
<file category="source" name="THREADX/samples/PDM_testApp.c" attr="template" select="AzureRTOS PDM testApp"/>
<file category="source" name="THREADX/samples/LPPDM_testApp.c" attr="template" select="AzureRTOS LPPDM testApp"/>
<file category="source" name="THREADX/samples/dma_testmemcpy.c" attr="template" select="AzureRTOS DMA Testmemcpy testApp"/>
<file category="source" name="THREADX/samples/GT911_TestApp.c" attr="template" select="AzureRTOS Touch Screen testApp"/>
<file category="source" name="THREADX/samples/TSENS_testapp.c" attr="template" select="AzureRTOS TSENS App"/>
<file category="header" name="THREADX/samples/temperature.h" attr="template" select="AzureRTOS TSENS App"/>
<file category="source" name="THREADX/samples/SPI0_SPI1_testapp.c" attr="template" select="AzureRTOS SPI testApp"/>
<file category="source" name="THREADX/samples/LPSPI_SPI_testapp.c" attr="template" select="AzureRTOS LPSPI testApp"/>
<file category="source" name="THREADX/samples/i3c_master_loopback_testapp.c" attr="template" select="AzureRTOS I3C Master Loopback testApp"/>
Expand Down
1 change: 1 addition & 0 deletions NETX/driver/Inc/mac_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ typedef struct {
uint32_t tx_descs_in_use; /**< Number of tx descriptors in use by the hardware */
eth_config config; /**< Configuration information (Speed/Duplex/Autonegotiation). */
uint32_t rx_buf_size; /**< DMA rx buf size to be used */
uint8_t irq_priority; /**< priority of the Ethernet MAC IRQ. */
} MAC_DEV;

/**
Expand Down
3 changes: 2 additions & 1 deletion NETX/driver/Src/nx_eth_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ static MAC_DEV mac0 = {
.speed = ETH_SPEED_CONFIG,
.duplex = ETH_DUPLEX_CONFIG,
},
.irq_priority = RTE_ETH_MAC_IRQ_PRIORITY,
};

/** \brief Driver instance */
Expand Down Expand Up @@ -1484,7 +1485,7 @@ MAC_DEV *dev = nx_mac_driver -> nx_driver_dev;
/* Clear pending interrupt requests */
NVIC_ClearPendingIRQ(dev -> irq);
/* Set priority and enable interrupts */
NVIC_SetPriority(dev -> irq, 1);
NVIC_SetPriority(dev -> irq, dev -> irq_priority);
NVIC_EnableIRQ(dev -> irq);

/* Create event flags to signal the PHY poll events */
Expand Down
283 changes: 283 additions & 0 deletions THREADX/samples/ADC_Click_Board_testapp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,283 @@
/* Copyright (C) 2023 Alif Semiconductor - All Rights Reserved.
* Use, distribution and modification of this code is permitted under the
* terms stated in the Alif Semiconductor Software License Agreement
*
* You should have received a copy of the Alif Semiconductor Software
* License Agreement with this file. If not, please write to:
* contact@alifsemi.com, or visit: https://alifsemi.com/license
*/
/**************************************************************************//**
* @file : ADC_Click_Board_testapp.c
* @author : Prabhakar kumar
* @email : prabhakar.kumar@alifsemi.com
* @version : V1.0.0
* @date : 15-sept-2023
* @brief : Testapp demo application code click board analog input
* - Internal input analog signal corresponding output is digital value.
* - the input from the Click Board (CLICK_ANA) is internally connected to
* the ADC121 instance channel_0(j11 Pin 8).
* - the converted digital value are stored in user provided memory
* address.
*
* Hardware Connection:
* Connect MIKROE Click board J29 and J30 for input.
* @note CLICK_ANA is then connected to the voltage level translator
******************************************************************************/

/* System Includes */
#include <stdio.h>
#include "tx_api.h"
#include "system_utils.h"

/* include for ADC Driver */
#include "Driver_ADC.h"

/* PINMUX include */
#include "pinconf.h"

#include "se_services_port.h"
#include "RTE_Components.h"
#if defined(RTE_Compiler_IO_STDOUT)
#include "retarget_stdout.h"
#endif /* RTE_Compiler_IO_STDOUT */

/* single shot conversion scan use ARM_ADC_SINGLE_SHOT_CH_CONV*/

#define ADC_CONVERSION ARM_ADC_SINGLE_SHOT_CH_CONV

/* Instance for ADC12 */
extern ARM_DRIVER_ADC Driver_ADC121;
static ARM_DRIVER_ADC *ADCdrv = &Driver_ADC121;

#define CLICK_BOARD_INPUT ARM_ADC_CHANNEL_0
#define NUM_CHANNELS (8)

void adc_click_board_demo(ULONG thread_input);

/* Define the ThreadX object control blocks... */
#define DEMO_STACK_SIZE 1024
#define TX_ADC_INT_AVG_SAMPLE_RDY 0x01

TX_THREAD adc_thread;
TX_EVENT_FLAGS_GROUP event_flags_adc;

/* Demo purpose adc_sample*/
UINT adc_sample[NUM_CHANNELS];

volatile UINT num_samples = 0;

/**
* @fn static int32_t pinmux_config(void)
* @brief ADC potentiometer pinmux configuration
* @retval execution status.
*/
static int32_t pinmux_config(void)
{
INT ret = 0U;

ret = pinconf_set(PORT_0, PIN_7, PINMUX_ALTERNATE_FUNCTION_7,
PADCTRL_READ_ENABLE );
if (ret)
{
/* failed while configuring the PIMUX */
return ret;
}

return ret;
}

/*
* @func : void adc_conversion_callback(uint32_t event, uint8_t channel, uint32_t sample_output)
* @brief : adc conversion isr callback
* @return : NONE
*/
static void adc_conversion_callback(uint32_t event, uint8_t channel, uint32_t sample_output)
{
if (event & ARM_ADC_EVENT_CONVERSION_COMPLETE)
{
num_samples += 1;

/* Store the value for the respective channels */
adc_sample[channel] = sample_output;
/* Sample ready Wake up Thread. */
tx_event_flags_set(&event_flags_adc, TX_ADC_INT_AVG_SAMPLE_RDY, TX_OR);
}
}

/**
* @func : void adc_click_board_demo(ULONG thread_input)
* @brief : ADC Click Board demo
* - test to verify the click board analog input of adc.
* - Internal input of click board in analog signal corresponding
* output is digital value.
* - converted value is the allocated user memory address.
* @return : NONE
*/
void adc_click_board_demo(ULONG thread_input)
{
INT ret = 0;
ULONG events = 0;
UINT error_code = SERVICES_REQ_SUCCESS;
UINT service_error_code;
ARM_DRIVER_VERSION version;

(void) thread_input;

/* Initialize the SE services */
se_services_port_init();

/* enable the 160 MHz clock */
error_code = SERVICES_clocks_enable_clock(se_services_s_handle,
/*clock_enable_t*/ CLKEN_CLK_160M,
/*bool enable */ true,
&service_error_code);
if (error_code)
{
printf("SE Error: 160 MHz clk enable = %d\n", error_code);
return;
}

printf("\t\t\n >>> ADC demo starting up!!! <<< \r\n");

version = ADCdrv->GetVersion();
printf("\r\n ADC version api:%X driver:%X...\r\n",version.api, version.drv);

/* PINMUX */
ret = pinmux_config();
if (ret != 0)
{
printf("Error in pin-mux configuration\n");
return;
}

/* Initialize ADC driver */
ret = ADCdrv->Initialize(adc_conversion_callback);
if (ret != ARM_DRIVER_OK){
printf("\r\n Error: ADC init failed\n");
return;
}

/* Power control ADC */
ret = ADCdrv->PowerControl(ARM_POWER_FULL);
if (ret != ARM_DRIVER_OK){
printf("\r\n Error: ADC Power up failed\n");
goto error_uninitialize;
}

/* set conversion mode */
ret = ADCdrv->Control(ARM_ADC_CONVERSION_MODE_CTRL, ADC_CONVERSION);
if (ret != ARM_DRIVER_OK){
printf("\r\n Error: ADC select conversion mode failed\n");
goto error_poweroff;
}

/* set initial channel */
ret = ADCdrv->Control(ARM_ADC_CHANNEL_INIT_VAL, CLICK_BOARD_INPUT);
if (ret != ARM_DRIVER_OK){
printf("\r\n Error: ADC channel init failed\n");
goto error_poweroff;
}

printf(">>> Allocated memory buffer Address is 0x%X <<<\n",(uint32_t)(adc_sample + CLICK_BOARD_INPUT));
/* Start ADC */
ret = ADCdrv->Start();
if (ret != ARM_DRIVER_OK){
printf("\r\n Error: ADC Start failed\n");
goto error_poweroff;
}

/* wait for timeout */
while(num_samples == 0);

/* wait till conversion comes ( isr callback ) */
ret = tx_event_flags_get(&event_flags_adc, TX_ADC_INT_AVG_SAMPLE_RDY,
TX_OR_CLEAR, &events, TX_WAIT_FOREVER);
if (ret != TX_SUCCESS) {
printf("Error: ADC tx_event_flags_get\n");
goto error_poweroff;
}

printf("\n Click Board input conversion completed \n");

/* Stop ADC */
ret = ADCdrv->Stop();
if (ret != ARM_DRIVER_OK){
printf("\r\n Error: ADC Stop failed\n");
goto error_poweroff;
}

printf("\n ---END--- \r\n wait forever >>> \n");
while(1);

error_poweroff:

/* Power off ADC peripheral */
ret = ADCdrv->PowerControl(ARM_POWER_OFF);
if (ret != ARM_DRIVER_OK)
{
printf("\r\n Error: ADC Power OFF failed.\r\n");
}

error_uninitialize:

/* Un-initialize ADC driver */
ret = ADCdrv->Uninitialize();
if (ret != ARM_DRIVER_OK)
{
printf("\r\n Error: ADC Uninitialize failed.\r\n");
}
/* disable the 160 MHz clock */
error_code = SERVICES_clocks_enable_clock(se_services_s_handle,
/*clock_enable_t*/ CLKEN_CLK_160M,
/*bool enable */ false,
&service_error_code);
if (error_code)
{
printf("SE Error: 160 MHz clk disable = %d\n", error_code);
return;
}

printf("\r\n ADC demo exiting...\r\n");
}

/* Define main entry point. */
int main()
{
#if defined(RTE_Compiler_IO_STDOUT_User)
int32_t ret;
ret = stdout_init();
if(ret != ARM_DRIVER_OK)
{
while(1)
{
}
}
#endif

/* Enter the ThreadX kernel. */
tx_kernel_enter();
}

/* Define what the initial system looks like. */
void tx_application_define(void *first_unused_memory)
{
INT status;

/* Create the event flags group used by ADC thread */
status = tx_event_flags_create(&event_flags_adc, "event flags ADC");
if (status != TX_SUCCESS)
{
printf("Could not create event flags\n");
return;
}

/* Create the main thread. */
status = tx_thread_create(&adc_thread, "adc_thread", adc_click_board_demo, 0,
first_unused_memory, DEMO_STACK_SIZE,
1, 1, TX_NO_TIME_SLICE, TX_AUTO_START);
if (status != TX_SUCCESS)
{
printf("Could not create thread\n");
return;
}
}
Loading

0 comments on commit 2f1758a

Please sign in to comment.