summaryrefslogtreecommitdiff
path: root/bsp
diff options
context:
space:
mode:
Diffstat (limited to 'bsp')
-rw-r--r--bsp/apollo2/board/adc.c85
-rw-r--r--bsp/apollo2/board/adc.h6
-rw-r--r--bsp/apollo2/board/board.c6
-rw-r--r--bsp/apollo2/board/flash.c2
-rw-r--r--bsp/apollo2/board/gpio.c146
-rw-r--r--bsp/apollo2/board/i2c.c44
-rw-r--r--bsp/apollo2/board/pdm.c101
-rw-r--r--bsp/apollo2/board/pdm.h2
-rw-r--r--bsp/apollo2/board/pwm.h2
-rw-r--r--bsp/apollo2/board/rtc.c1
-rw-r--r--bsp/apollo2/board/smbus.c17
-rw-r--r--bsp/apollo2/board/spi.c92
-rw-r--r--bsp/apollo2/board/uart.c21
-rw-r--r--bsp/apollo2/libraries/drivers/SConscript1
-rw-r--r--bsp/apollo2/libraries/drivers/am_mcu_apollo.h2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_adc.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_adc.h12
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.h12
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.c28
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.h12
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.c21
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.h14
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_debug.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_debug.h12
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_flash.c43
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_flash.h28
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_global.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_global.h12
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_gpio.c4
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_gpio.h19
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.c22
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.h21
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.c8
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.h11
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_iom.c1625
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_iom.h116
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_ios.c56
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_ios.h10
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_itm.c31
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_itm.h13
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.h12
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_otp.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_otp.h12
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_pdm.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_pdm.h11
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_pin.h69
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.h11
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_queue.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_queue.h2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_reset.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_reset.h2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_rtc.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_rtc.h12
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_stimer.c27
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_stimer.h12
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_sysctrl.c6
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_sysctrl.h10
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_systick.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_systick.h2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_tpiu.c4
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_tpiu.h12
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_ttp.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_ttp.h2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_uart.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_uart.h12
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_vcomp.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_vcomp.h12
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_wdt.c2
-rw-r--r--bsp/apollo2/libraries/drivers/hal/am_hal_wdt.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_adc.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_base_addresses.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_cachectrl.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_clkgen.h13
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_ctimer.h4
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_flashctrl.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_gpio.h24
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_iomstr.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_ioslave.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_itm.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_jedec.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_macros.h27
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_macros_asm.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_mcuctrl.h3
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_nvic.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_pdm.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_pwrctrl.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_rstgen.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_rtc.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_sysctrl.h45
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_systick.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_tpiu.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_uart.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_vcomp.h2
-rw-r--r--bsp/apollo2/libraries/drivers/regs/am_reg_wdt.h2
-rw-r--r--bsp/apollo2/libraries/startup/SConscript1
-rw-r--r--bsp/apollo2/project.uvoptx1224
-rw-r--r--bsp/apollo2/project.uvprojx645
-rw-r--r--bsp/apollo2/rtthread.sct14
101 files changed, 3626 insertions, 1334 deletions
diff --git a/bsp/apollo2/board/adc.c b/bsp/apollo2/board/adc.c
index 13be618ecf..a0044bcc37 100644
--- a/bsp/apollo2/board/adc.c
+++ b/bsp/apollo2/board/adc.c
@@ -19,46 +19,57 @@
*
* Change Logs:
* Date Author Notes
- * 2017-12-04 Haley the first version
+ * 2017-09-18 Haley the first version
*/
+#include <rtthread.h>
#include <rtdevice.h>
#include "am_mcu_apollo.h"
-#include "board.h"
#ifdef RT_USING_ADC
-/* sem define */
-rt_sem_t adcsem = RT_NULL;
+/* messagequeue define */
+struct rt_messagequeue adcbat_mq;
-#define BATTERY_GPIO 29 /* Battery */
-#define BATTERY_ADC_PIN AM_HAL_PIN_29_ADCSE1
-#define BATTERY_ADC_CHANNEL AM_HAL_ADC_SLOT_CHSEL_SE1 /* BATTERY ADC�ɼ�ͨ�� */
-#define BATTERY_ADC_CHANNELNUM 1 /* BATTERY ADC�ɼ�ͨ���� */
+#define BATTERY_GPIO 35 /* Battery */
+#define BATTERY_ADC_PIN AM_HAL_PIN_35_ADCSE7
+#define BATTERY_ADC_CHANNEL AM_HAL_ADC_SLOT_CHSEL_SE7 /* BATTERY ADC�ɼ�ͨ�� */
+#define BATTERY_ADC_CHANNELNUM 7 /* BATTERY ADC�ɼ�ͨ���� */
#define ADC_CTIMER_NUM 3 /* ADCʹ�ö�ʱ�� */
+#define ADC_CTIMER_COUNT (2048/512 - 1)
#define ADC_CHANNEL_NUM 1 /* ADC�ɼ�ͨ������ */
-#define ADC_SAMPLE_NUM 8 /* ADC��������, NE_OF_OUTPUT */
+#define ADC_SAMPLE_NUM 8 /* ADC�������� */
-rt_uint8_t bat_adc_cnt = (ADC_CHANNEL_NUM + 1)*ADC_SAMPLE_NUM;
-rt_int16_t am_adc_buffer_pool[64];
+rt_uint8_t bat_adc_cnt = 0;
+static rt_uint8_t am_adcbat_buffer_pool[256];
+static rt_int16_t am_adcbat_buffertemp[32];
-rt_uint8_t am_adc_data_get(rt_int16_t *buff, rt_uint16_t size)
+rt_uint8_t am_adc_data_get(rt_uint8_t channel, rt_int16_t *buff, rt_uint16_t size)
{
- /* wait adc interrupt release sem forever */
- rt_sem_take(adcsem, RT_WAITING_FOREVER);
+ rt_uint8_t adc_bufftemp[32];
+
+ if (channel == BATTERY_ADC_CHANNELNUM)
+ {
+ /* wait adc message forever */
+ rt_mq_recv(&adcbat_mq, adc_bufftemp, 32, RT_WAITING_FOREVER);
+ }
/* copy the data */
- rt_memcpy(buff, am_adc_buffer_pool, size*sizeof(rt_int16_t));
+ rt_memcpy(buff, adc_bufftemp, size*sizeof(rt_int16_t));
return 0;
}
-void am_adc_start(void)
+void am_adc_start(rt_uint8_t channel)
{
- /* adcsem create */
- adcsem = rt_sem_create("adcsem", 0, RT_IPC_FLAG_FIFO);
+ /* messagequeue init */
+ rt_mq_init(&adcbat_mq, "mq_adcbat",
+ &am_adcbat_buffer_pool[0],
+ 32 - sizeof(void*),
+ sizeof(am_adcbat_buffer_pool),
+ RT_IPC_FLAG_FIFO);
/* Start the ctimer */
am_hal_ctimer_start(ADC_CTIMER_NUM, AM_HAL_CTIMER_TIMERA);
@@ -67,13 +78,16 @@ void am_adc_start(void)
am_hal_adc_trigger();
}
-void am_adc_stop(void)
+void am_adc_stop(rt_uint8_t channel)
{
/* Stop the ctimer */
am_hal_ctimer_stop(ADC_CTIMER_NUM, AM_HAL_CTIMER_TIMERA);
- /* adcsem delete */
- rt_sem_delete(adcsem);
+ /* messagequeue delete */
+ rt_mq_delete(&adceeg_mq);
+
+ /* messagequeue delete */
+ rt_mq_delete(&adcbat_mq);
}
/**
@@ -87,6 +101,9 @@ void am_adc_isr(void)
{
uint32_t ui32Status, ui32FifoData;
+ /* enter interrupt */
+ rt_interrupt_enter();
+
/* Read the interrupt status */
ui32Status = am_hal_adc_int_status_get(true);
@@ -101,20 +118,23 @@ void am_adc_isr(void)
/* Read the value from the FIFO into the circular buffer */
ui32FifoData = am_hal_adc_fifo_pop();
- if(AM_HAL_ADC_FIFO_SLOT(ui32FifoData) == BATTERY_ADC_CHANNELNUM)
- am_adc_buffer_pool[bat_adc_cnt++] = AM_HAL_ADC_FIFO_SAMPLE(ui32FifoData);
+ if (AM_HAL_ADC_FIFO_SLOT(ui32FifoData) == BATTERY_ADC_CHANNELNUM)
+ {
+ am_adcbat_buffertemp[bat_adc_cnt++] = AM_HAL_ADC_FIFO_SAMPLE(ui32FifoData);
+ }
- if(bat_adc_cnt > (ADC_CHANNEL_NUM + 1)*ADC_SAMPLE_NUM - 1)
+ if ((bat_adc_cnt > ADC_SAMPLE_NUM + 2 - 1))
{
- /* shift data */
- rt_memmove(am_adc_buffer_pool, am_adc_buffer_pool + ADC_CHANNEL_NUM*ADC_SAMPLE_NUM, ADC_CHANNEL_NUM*ADC_SAMPLE_NUM*sizeof(rt_int16_t));
- bat_adc_cnt = (ADC_CHANNEL_NUM + 1)*ADC_SAMPLE_NUM;
+ bat_adc_cnt = 0;
- /* release adcsem */
- rt_sem_release(adcsem);
+ /* send the message */
+ rt_mq_send(&adcbat_mq, am_adcbat_buffertemp, ADC_SAMPLE_NUM*sizeof(rt_int16_t));
}
} while (AM_HAL_ADC_FIFO_COUNT(ui32FifoData) > 0);
}
+
+ /* leave interrupt */
+ rt_interrupt_leave();
}
static void timerA3_for_adc_init(void)
@@ -129,7 +149,7 @@ static void timerA3_for_adc_init(void)
am_hal_ctimer_int_enable(AM_HAL_CTIMER_INT_TIMERA3);
/* Set 512 sample rate */
- am_hal_ctimer_period_set(ADC_CTIMER_NUM, AM_HAL_CTIMER_TIMERA, 3, 1);
+ am_hal_ctimer_period_set(ADC_CTIMER_NUM, AM_HAL_CTIMER_TIMERA, ADC_CTIMER_COUNT, 1);
/* Enable the timer A3 to trigger the ADC directly */
am_hal_ctimer_adc_trigger_enable();
@@ -184,7 +204,10 @@ int rt_hw_adc_init(void)
/* Enable the ADC */
am_hal_adc_enable();
- rt_kprintf("adc_init!\n");
+ /* Trigger the ADC once */
+ //am_hal_adc_trigger();
+
+ //rt_kprintf("adc_init!\n");
return 0;
}
diff --git a/bsp/apollo2/board/adc.h b/bsp/apollo2/board/adc.h
index 7e1f1eebc4..4e4396bae3 100644
--- a/bsp/apollo2/board/adc.h
+++ b/bsp/apollo2/board/adc.h
@@ -32,8 +32,8 @@
*
*/
int rt_hw_adc_init(void);
-rt_uint8_t am_adc_data_get(rt_int16_t *buff, rt_uint16_t size);
-void am_adc_start(void);
-void am_adc_stop(void);
+rt_uint8_t am_adc_data_get(rt_uint8_t channel, rt_int16_t *buff, rt_uint16_t size);
+void am_adc_start(rt_uint8_t channel);
+void am_adc_stop(rt_uint8_t channel);
#endif // __ADC_H_
diff --git a/bsp/apollo2/board/board.c b/bsp/apollo2/board/board.c
index ed1ff52302..23bc332af4 100644
--- a/bsp/apollo2/board/board.c
+++ b/bsp/apollo2/board/board.c
@@ -104,15 +104,17 @@ void am_low_power_init(void)
/* Turn off the voltage comparator as this is enabled on reset */
am_hal_vcomp_disable();
+ #ifndef RT_USING_RTC
/* Run the RTC off the LFRC */
am_hal_rtc_osc_select(AM_HAL_RTC_OSC_LFRC);
/* Stop the XT and LFRC */
am_hal_clkgen_osc_stop(AM_HAL_CLKGEN_OSC_XT);
- am_hal_clkgen_osc_stop(AM_HAL_CLKGEN_OSC_LFRC);
+ //am_hal_clkgen_osc_stop(AM_HAL_CLKGEN_OSC_LFRC);
/* Disable the RTC */
am_hal_rtc_osc_disable();
+ #endif
}
/**
@@ -159,7 +161,7 @@ void rt_hw_board_init(void)
/* Turn off unused Flash & SRAM */
am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_FLASH512K);
- am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_SRAM32K);
+ //am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_SRAM32K);
#endif
diff --git a/bsp/apollo2/board/flash.c b/bsp/apollo2/board/flash.c
index cc8e4dd499..ae224e85a1 100644
--- a/bsp/apollo2/board/flash.c
+++ b/bsp/apollo2/board/flash.c
@@ -140,7 +140,7 @@ int rt_hw_rom_init(void)
/* register the device */
rt_device_register(&device, "rom", RT_DEVICE_FLAG_RDWR);
- rt_kprintf("register device rom!\r\n");
+ //rt_kprintf("register device rom!\r\n");
return 0;
}
diff --git a/bsp/apollo2/board/gpio.c b/bsp/apollo2/board/gpio.c
index 3a422dd452..c2eb1be581 100644
--- a/bsp/apollo2/board/gpio.c
+++ b/bsp/apollo2/board/gpio.c
@@ -24,10 +24,14 @@
#include <rtthread.h>
#include <rtdevice.h>
+#include <rthw.h>
#include "am_mcu_apollo.h"
#ifdef RT_USING_PIN
+#define APLLO2_PIN_NUMBERS 64 //[34, 64]
+struct rt_pin_irq_hdr am_pin_irq_hdr_tab[64];
+
void am_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
{
if (mode == PIN_MODE_OUTPUT)
@@ -43,12 +47,17 @@ void am_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
else if (mode == PIN_MODE_INPUT_PULLUP)
{
/* input setting: pull up. */
+ am_hal_gpio_pin_config(pin, AM_HAL_GPIO_INPUT);
+ }
+ else if (mode == PIN_MODE_INPUT_PULLDOWN)
+ {
+ /* input setting: pull down. */
am_hal_gpio_pin_config(pin, AM_HAL_GPIO_OPENDRAIN);
}
else
{
/* input setting:default. */
- am_hal_gpio_pin_config(pin, AM_HAL_GPIO_INPUT);
+ am_hal_gpio_pin_config(pin, AM_HAL_GPIO_3STATE);
}
}
@@ -58,40 +67,159 @@ void am_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value)
{
am_hal_gpio_out_bit_clear(pin);
}
- else
+ else if (value == PIN_HIGH)
{
am_hal_gpio_out_bit_set(pin);
- }
+ }
}
int am_pin_read(rt_device_t dev, rt_base_t pin)
{
int value = PIN_LOW;
- if (am_hal_gpio_input_bit_read(pin) == 0)
+ if (am_hal_gpio_pin_config_read(pin) == AM_HAL_GPIO_OUTPUT)
{
- value = PIN_LOW;
+ if (am_hal_gpio_out_bit_read(pin) == 0)
+ {
+ value = PIN_LOW;
+ }
+ else
+ {
+ value = PIN_HIGH;
+ }
}
else
{
- value = PIN_HIGH;
+ if (am_hal_gpio_input_bit_read(pin) == 0)
+ {
+ value = PIN_LOW;
+ }
+ else
+ {
+ value = PIN_HIGH;
+ }
}
return value;
}
-const static struct rt_pin_ops _am_pin_ops =
+rt_err_t am_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
+ rt_uint32_t mode, void (*hdr)(void *args), void *args)
+{
+ rt_base_t level;
+ rt_int32_t irqindex = -1;
+
+ irqindex = pin;
+
+ level = rt_hw_interrupt_disable();
+ if(am_pin_irq_hdr_tab[irqindex].pin == pin &&
+ am_pin_irq_hdr_tab[irqindex].hdr == hdr &&
+ am_pin_irq_hdr_tab[irqindex].mode == mode &&
+ am_pin_irq_hdr_tab[irqindex].args == args
+ )
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_EOK;
+ }
+ if(am_pin_irq_hdr_tab[irqindex].pin != -1)
+ {
+ rt_hw_interrupt_enable(level);
+ return -RT_EBUSY;
+ }
+ am_pin_irq_hdr_tab[irqindex].pin = pin;
+ am_pin_irq_hdr_tab[irqindex].hdr = hdr;
+ am_pin_irq_hdr_tab[irqindex].mode = mode;
+ am_pin_irq_hdr_tab[irqindex].args = args;
+ rt_hw_interrupt_enable(level);
+
+ return RT_EOK;
+}
+
+rt_err_t am_pin_dettach_irq(struct rt_device *device, rt_int32_t pin)
+{
+ rt_base_t level;
+ rt_int32_t irqindex = -1;
+
+ irqindex = pin;
+
+ level = rt_hw_interrupt_disable();
+ if(am_pin_irq_hdr_tab[irqindex].pin == -1)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_EOK;
+ }
+ am_pin_irq_hdr_tab[irqindex].pin = -1;
+ am_pin_irq_hdr_tab[irqindex].hdr = RT_NULL;
+ am_pin_irq_hdr_tab[irqindex].mode = 0;
+ am_pin_irq_hdr_tab[irqindex].args = RT_NULL;
+ rt_hw_interrupt_enable(level);
+
+ return RT_EOK;
+}
+
+rt_err_t am_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
+{
+ rt_base_t level;
+ rt_int32_t irqindex = -1;
+
+ irqindex = pin;
+
+ if (enabled == PIN_IRQ_ENABLE)
+ {
+ level = rt_hw_interrupt_disable();
+
+ /* Configure the GPIO/button interrupt polarity */
+ if (am_pin_irq_hdr_tab[irqindex].mode == PIN_IRQ_MODE_RISING)
+ {
+ am_hal_gpio_int_polarity_bit_set(am_pin_irq_hdr_tab[irqindex].pin, AM_HAL_GPIO_RISING);
+ }
+ else if (am_pin_irq_hdr_tab[irqindex].mode == PIN_IRQ_MODE_FALLING)
+ {
+ am_hal_gpio_int_polarity_bit_set(am_pin_irq_hdr_tab[irqindex].pin, AM_HAL_GPIO_FALLING);
+ }
+
+ /* Clear the GPIO Interrupt (write to clear) */
+ am_hal_gpio_int_clear(AM_HAL_GPIO_BIT(am_pin_irq_hdr_tab[irqindex].pin));
+
+ /* Enable the GPIO/button interrupt */
+ am_hal_gpio_int_enable(AM_HAL_GPIO_BIT(am_pin_irq_hdr_tab[irqindex].pin));
+
+ rt_hw_interrupt_enable(level);
+ }
+ else if (enabled == PIN_IRQ_DISABLE)
+ {
+ if (am_hal_gpio_int_enable_get() != AM_HAL_GPIO_BIT(am_pin_irq_hdr_tab[irqindex].pin))
+ {
+ return RT_ENOSYS;
+ }
+
+ /* Disable the GPIO/button interrupt */
+ am_hal_gpio_int_disable(AM_HAL_GPIO_BIT(am_pin_irq_hdr_tab[irqindex].pin));
+ }
+ else
+ {
+ return RT_ENOSYS;
+ }
+
+ return RT_EOK;
+}
+
+const static struct rt_pin_ops am_pin_ops =
{
am_pin_mode,
am_pin_write,
am_pin_read,
+ am_pin_attach_irq,
+ am_pin_dettach_irq,
+ am_pin_irq_enable,
};
int rt_hw_pin_init(void)
{
- rt_device_pin_register("pin", &_am_pin_ops, RT_NULL);
+ rt_device_pin_register("pin", &am_pin_ops, RT_NULL);
- rt_kprintf("pin_init!\n");
+ //rt_device_pin_irq_register("pin", &am_pin_ops, RT_NULL);
+ //rt_kprintf("pin_init!\n");
return 0;
}
diff --git a/bsp/apollo2/board/i2c.c b/bsp/apollo2/board/i2c.c
index cb91cdd2e5..6d1bcdc0c0 100644
--- a/bsp/apollo2/board/i2c.c
+++ b/bsp/apollo2/board/i2c.c
@@ -25,7 +25,6 @@
#include <rtthread.h>
#include <rtdevice.h>
#include "am_mcu_apollo.h"
-#include "board.h"
/* I2C0 */
#define AM_I2C0_IOM_INST 0
@@ -43,6 +42,14 @@
#define I2C2_GPIO_SDA 25
#define I2C2_GPIO_CFG_SDA AM_HAL_PIN_25_M2SDA
+/* I2C3 */
+#define AM_I2C3_IOM_INST 3
+
+#define I2C3_GPIO_SCL 42
+#define I2C3_GPIO_CFG_SCK AM_HAL_PIN_42_M3SCL
+#define I2C3_GPIO_SDA 43
+#define I2C3_GPIO_CFG_SDA AM_HAL_PIN_43_M3SDA
+
/* I2C4 */
#define AM_I2C4_IOM_INST 4
@@ -76,7 +83,7 @@ rt_size_t rt_i2c_master_xfer(struct rt_i2c_bus_device *bus,
struct am_i2c_bus * am_i2c_bus = (struct am_i2c_bus *)bus;
struct rt_i2c_msg *msg;
int i;
- rt_int32_t ret = RT_EOK;
+ rt_uint32_t msg_len = 0;
for (i = 0; i < num; i++)
{
@@ -84,16 +91,16 @@ rt_size_t rt_i2c_master_xfer(struct rt_i2c_bus_device *bus,
if (msg->flags == RT_I2C_RD)
{
am_hal_iom_i2c_read(am_i2c_bus->u32Module, msg->addr, (uint32_t *)msg->buf, msg->len, AM_HAL_IOM_RAW);
+ msg_len += msg->len;
}
else if(msg->flags == RT_I2C_WR)
{
am_hal_iom_i2c_write(am_i2c_bus->u32Module, msg->addr, (uint32_t *)msg->buf, msg->len, AM_HAL_IOM_RAW);
+ msg_len += (msg->len - 1);
}
-
- ret++;
}
- return ret;
+ return msg_len;
}
rt_err_t rt_i2c_bus_control(struct rt_i2c_bus_device *bus,
@@ -136,7 +143,7 @@ static struct am_i2c_bus am_i2c_bus_0 =
#ifdef RT_USING_I2C1
static struct am_i2c_bus am_i2c_bus_1 =
{
- {0},
+ {1},
AM_I2C1_IOM_INST
};
#endif
@@ -144,7 +151,7 @@ static struct am_i2c_bus am_i2c_bus_1 =
#ifdef RT_USING_I2C2
static struct am_i2c_bus am_i2c_bus_2 =
{
- {1},
+ {2},
AM_I2C2_IOM_INST
};
#endif
@@ -152,7 +159,7 @@ static struct am_i2c_bus am_i2c_bus_2 =
#ifdef RT_USING_I2C3
static struct am_i2c_bus am_i2c_bus_3 =
{
- {2},
+ {3},
AM_I2C3_IOM_INST
};
#endif
@@ -160,7 +167,7 @@ static struct am_i2c_bus am_i2c_bus_3 =
#ifdef RT_USING_I2C4
static struct am_i2c_bus am_i2c_bus_4 =
{
- {3},
+ {4},
AM_I2C4_IOM_INST
};
#endif
@@ -203,6 +210,23 @@ int rt_i2c_init(void)
rt_i2c_bus_device_register(&am_i2c->parent, "i2c2");
#endif
+#ifdef RT_USING_I2C3
+ /* init i2c gpio */
+ am_hal_gpio_pin_config(I2C3_GPIO_SCL, I2C3_GPIO_CFG_SCK | AM_HAL_GPIO_PULL6K);
+ am_hal_gpio_pin_config(I2C3_GPIO_SDA, I2C3_GPIO_CFG_SDA | AM_HAL_GPIO_PULL6K);
+
+ /* Initialize IOM 3 in I2C mode at 400KHz */
+ am_hal_iom_pwrctrl_enable(AM_I2C3_IOM_INST);
+ g_sIOMConfig.ui32ClockFrequency = AM_HAL_IOM_400KHZ;
+ am_hal_iom_config(AM_I2C3_IOM_INST, &g_sIOMConfig);
+ am_hal_iom_enable(AM_I2C3_IOM_INST);
+
+ /* init i2c bus device */
+ am_i2c = &am_i2c_bus_3;
+ am_i2c->parent.ops = &am_i2c_ops;
+ rt_i2c_bus_device_register(&am_i2c->parent, "i2c3");
+#endif
+
#ifdef RT_USING_I2C4
/* init i2c gpio */
am_hal_gpio_pin_config(I2C4_GPIO_SCL, I2C4_GPIO_CFG_SCK | AM_HAL_GPIO_PULL6K);
@@ -220,7 +244,7 @@ int rt_i2c_init(void)
rt_i2c_bus_device_register(&am_i2c->parent, "i2c4");
#endif
- rt_kprintf("i2c_init!\n");
+ //rt_kprintf("i2c_init!\n");
return 0;
}
diff --git a/bsp/apollo2/board/pdm.c b/bsp/apollo2/board/pdm.c
index e97d2fa530..3eb46f7411 100644
--- a/bsp/apollo2/board/pdm.c
+++ b/bsp/apollo2/board/pdm.c
@@ -25,15 +25,15 @@
#include <rtthread.h>
#include <rtdevice.h>
#include "am_mcu_apollo.h"
-#include "board.h"
#ifdef RT_USING_PDM
-/* sem define */
-rt_sem_t pdmsem = RT_NULL;
+/* messagequeue define */
+struct rt_messagequeue pdm_mq;
-#define NWA_FRAME_MS 10
-#define NWA_FRAME_SAMPLES (16*NWA_FRAME_MS) /* 16k, 16bit, mono audio data */
+static rt_uint8_t am_pdm_buffer_pool[1024];
+
+#define NWA_FRAME_SAMPLES 160 /* 8k, 16bit, mono audio data */
#define PDM_FIFO_THRESHOLD NWA_FRAME_SAMPLES
#define PDM_GPIO_CLK 22
@@ -41,23 +41,16 @@ rt_sem_t pdmsem = RT_NULL;
#define PDM_GPIO_DATA 23
#define PDM_GPIO_CFG_DATA AM_HAL_PIN_23_PDM_DATA
-#define PING_PONG_BUF_SIZE 8000*NWA_FRAME_MS
-static rt_uint16_t am_pdm_buffer_pool[PING_PONG_BUF_SIZE];
-static rt_uint8_t pdm_flag = 0;
-static rt_uint16_t pdm_cnt = 0;
-
-
static am_hal_pdm_config_t g_sPDMConfig =
{
- AM_HAL_PDM_PCFG_LRSWAP_DISABLE | AM_HAL_PDM_PCFG_RIGHT_PGA_P105DB | AM_HAL_PDM_PCFG_LEFT_PGA_P105DB
- | AM_HAL_PDM_PCFG_MCLKDIV_DIV1 | AM_HAL_PDM_PCFG_SINC_RATE(48) | AM_HAL_PDM_PCFG_ADCHPD_ENABLE
- | AM_HAL_PDM_PCFG_HPCUTOFF(0xB) | AM_HAL_PDM_PCFG_CYCLES(0x1) | AM_HAL_PDM_PCFG_SOFTMUTE_DISABLE
- | AM_HAL_PDM_PCFG_PDMCORE_ENABLE, /* Set the PDM configuration */
- AM_REG_PDM_VCFG_IOCLKEN_EN | AM_HAL_PDM_VCFG_RSTB_NORMAL | AM_REG_PDM_VCFG_PDMCLKSEL_750KHz
- | AM_HAL_PDM_VCFG_PDMCLK_ENABLE | AM_HAL_PDM_VCFG_I2SMODE_DISABLE | AM_HAL_PDM_VCFG_BCLKINV_DISABLE
- | AM_HAL_PDM_VCFG_DMICDEL_DISABLE | AM_HAL_PDM_VCFG_SELAP_INTERNAL | AM_HAL_PDM_VCFG_PACK_DISABLE
- | AM_HAL_PDM_VCFG_CHANNEL_RIGHT, /* Set the Voice Configuration */
- PDM_FIFO_THRESHOLD, /* Select the FIFO PCM sample threshold */
+ AM_HAL_PDM_PCFG_LRSWAP_DISABLE | AM_HAL_PDM_PCFG_RIGHT_PGA_0DB | AM_HAL_PDM_PCFG_LEFT_PGA_0DB
+ | AM_HAL_PDM_PCFG_MCLKDIV_DIV1 | AM_HAL_PDM_PCFG_SINC_RATE(48) | AM_HAL_PDM_PCFG_ADCHPD_ENABLE
+ | AM_HAL_PDM_PCFG_HPCUTOFF(0x1) | AM_HAL_PDM_PCFG_CYCLES(0x1) | AM_HAL_PDM_PCFG_SOFTMUTE_DISABLE
+ | AM_HAL_PDM_PCFG_PDMCORE_ENABLE, /* Set the PDM configuration */
+ AM_HAL_PDM_IOCLK_750KHZ | AM_HAL_PDM_VCFG_RSTB_NORMAL | AM_HAL_PDM_VCFG_PDMCLK_ENABLE
+ | AM_HAL_PDM_VCFG_I2SMODE_DISABLE | AM_HAL_PDM_VCFG_BCLKINV_DISABLE | AM_HAL_PDM_VCFG_DMICDEL_DISABLE
+ | AM_HAL_PDM_VCFG_SELAP_INTERNAL | AM_HAL_PDM_VCFG_PACK_DISABLE | AM_HAL_PDM_VCFG_CHANNEL_LEFT, /* Set the Voice Configuration */
+ PDM_FIFO_THRESHOLD, /* Select the FIFO PCM sample threshold 0~256 */
};
/**
@@ -71,28 +64,13 @@ static am_hal_pdm_config_t g_sPDMConfig =
*/
rt_uint8_t am_pdm_data_get(rt_uint8_t *buff, rt_uint16_t size)
{
- uint8_t temp;
- int i;
-
- /* wait adc interrupt release sem forever */
- rt_sem_take(pdmsem, RT_WAITING_FOREVER);
+ rt_uint8_t pdm_rbufftemp[340];
- for(i = 0; i < PING_PONG_BUF_SIZE; i++)
- {
- temp = (uint8_t)(am_pdm_buffer_pool[i] & 0xFF);
- /* lower byte */
- while ( AM_BFRn(UART, 0, FR, TXFF) );
- AM_REGn(UART, 0, DR) = temp;
+ /* wait pdm message forever */
+ rt_mq_recv(&pdm_mq, pdm_rbufftemp, 340, RT_WAITING_FOREVER);
- temp = (uint8_t)((am_pdm_buffer_pool[i] & 0xFF00)>>8);
- /* higher byte */
- while ( AM_BFRn(UART, 0, FR, TXFF) );
- AM_REGn(UART, 0, DR) = temp;
- }
/* copy the data */
- //rt_memcpy(buff, am_pdm_buffer_pool, size*sizeof(rt_uint16_t));
-
- pdm_flag = 0;
+ rt_memcpy(buff, (char *)pdm_rbufftemp, size);
return 0;
}
@@ -108,12 +86,9 @@ rt_uint8_t am_pdm_data_get(rt_uint8_t *buff, rt_uint16_t size)
*/
void am_pdm_start(void)
{
- /* adcsem create */
- pdmsem = rt_sem_create("pdmsem", 0, RT_IPC_FLAG_FIFO);
-
/* Enable PDM */
- am_hal_pdm_enable();
am_hal_interrupt_enable(AM_HAL_INTERRUPT_PDM);
+ am_hal_pdm_enable();
}
/**
@@ -128,11 +103,8 @@ void am_pdm_start(void)
void am_pdm_stop(void)
{
/* Disable PDM */
- am_hal_pdm_disable();
am_hal_interrupt_disable(AM_HAL_INTERRUPT_PDM);
-
- /* adcsem delete */
- rt_sem_delete(pdmsem);
+ am_hal_pdm_disable();
}
/**
@@ -153,7 +125,7 @@ uint8_t am_pdm_left_gain_get(void)
/**
* @brief Set the pdm left gain.
*
- * @param None.
+ * @param gain_val.
*
* This function Set the pdm left gain.
*
@@ -183,7 +155,7 @@ uint8_t am_pdm_right_gain_get(void)
/**
* @brief Set the pdm right gain.
*
- * @param None.
+ * @param gain_val.
*
* This function Set the pdm right gain.
*
@@ -204,33 +176,19 @@ void am_pdm_right_gain_set(uint8_t gain_val)
*/
void am_pdm_isr (void)
{
- uint32_t ui32FifoData;
int i;
+ rt_int16_t pdm_sbufftemp[160];
/* Clear the PDM interrupt */
am_hal_pdm_int_clear(AM_HAL_PDM_INT_UNDFL | AM_HAL_PDM_INT_OVF | AM_HAL_PDM_INT_FIFO);
for (i = 0; i < PDM_FIFO_THRESHOLD; i++) /* adjust as needed */
{
- ui32FifoData = am_hal_pdm_fifo_data_read();
-
- if(pdm_flag == 0)
- {
- am_pdm_buffer_pool[pdm_cnt * PDM_FIFO_THRESHOLD + i] = (uint16_t)ui32FifoData;
- }
+ pdm_sbufftemp[i] = (rt_int16_t)am_hal_pdm_fifo_data_read();
}
- if(pdm_flag == 0)
- pdm_cnt ++;
-
- if(pdm_cnt == PING_PONG_BUF_SIZE/PDM_FIFO_THRESHOLD) /* 500 means 10 second logging under 8k sampling rate */
- {
- pdm_cnt = 0;
- pdm_flag = 1;
-
- /* release pdmsem */
- rt_sem_release(pdmsem);
- }
+ /* send the message */
+ rt_mq_send(&pdm_mq, pdm_sbufftemp, PDM_FIFO_THRESHOLD*sizeof(rt_int16_t));
}
/**
@@ -258,7 +216,14 @@ int rt_hw_pdm_init(void)
/* Clear PDM interrupts */
am_hal_pdm_int_clear(AM_HAL_PDM_INT_UNDFL | AM_HAL_PDM_INT_OVF | AM_HAL_PDM_INT_FIFO);
- rt_kprintf("pdm_init!\n");
+ /* messagequeue init */
+ rt_mq_init(&pdm_mq, "mq_pdm",
+ &am_pdm_buffer_pool[0],
+ 340 - sizeof(void*),
+ sizeof(am_pdm_buffer_pool),
+ RT_IPC_FLAG_FIFO);
+
+ //rt_kprintf("pdm_init!\n");
return 0;
}
diff --git a/bsp/apollo2/board/pdm.h b/bsp/apollo2/board/pdm.h
index b0fae857c4..43ed075da8 100644
--- a/bsp/apollo2/board/pdm.h
+++ b/bsp/apollo2/board/pdm.h
@@ -31,7 +31,7 @@
* @brief External function definitions
*
*/
-int rt_hw_pdm_init(void);
+int rt_pdm_init(void);
rt_uint8_t am_pdm_data_get(rt_uint8_t *buff, rt_uint16_t size);
void am_pdm_start(void);
void am_pdm_stop(void);
diff --git a/bsp/apollo2/board/pwm.h b/bsp/apollo2/board/pwm.h
index 2c22e38891..53a6571264 100644
--- a/bsp/apollo2/board/pwm.h
+++ b/bsp/apollo2/board/pwm.h
@@ -32,5 +32,7 @@
*
*/
int rt_hw_pwm_init(void);
+void am_pwm_start(int led);
+void am_pwm_stop(int led);
#endif // __PWM_H_
diff --git a/bsp/apollo2/board/rtc.c b/bsp/apollo2/board/rtc.c
index 4ac1869472..1bc4779257 100644
--- a/bsp/apollo2/board/rtc.c
+++ b/bsp/apollo2/board/rtc.c
@@ -118,7 +118,6 @@ int rt_hw_rtc_init(void)
#if RTC_CLK_SRC == XT
/* Enable the XT for the RTC */
- //am_hal_clkgen_osc_start(AM_HAL_CLKGEN_OSC_LFRC);
am_hal_clkgen_osc_start(AM_HAL_CLKGEN_OSC_XT);
/* Select XT for RTC clock source */
diff --git a/bsp/apollo2/board/smbus.c b/bsp/apollo2/board/smbus.c
index d2d801994e..ae41f9fac6 100644
--- a/bsp/apollo2/board/smbus.c
+++ b/bsp/apollo2/board/smbus.c
@@ -25,23 +25,22 @@
#include <rtthread.h>
#include <rtdevice.h>
#include "am_mcu_apollo.h"
-#include "board.h"
#ifdef RT_USING_SMBUS
#define SMBUS_GPIO_SDA 5
#define SMBUS_GPIO_SCL 6
-#define mSDA_LOW() am_hal_gpio_out_bit_clear(SMBUS_GPIO_SCL) /* Clear SDA line */
-#define mSDA_HIGH() am_hal_gpio_out_bit_set(SMBUS_GPIO_SCL) /* Set SDA line */
-#define mSCL_LOW() am_hal_gpio_out_bit_clear(SMBUS_GPIO_SDA) /* Clear SCL line */
-#define mSCL_HIGH() am_hal_gpio_out_bit_set(SMBUS_GPIO_SDA) /* Set SCL line */
+#define mSDA_LOW() am_hal_gpio_out_bit_clear(SMBUS_GPIO_SDA) /* Clear SDA line */
+#define mSDA_HIGH() am_hal_gpio_out_bit_set(SMBUS_GPIO_SDA) /* Set SDA line */
+#define mSCL_LOW() am_hal_gpio_out_bit_clear(SMBUS_GPIO_SCL) /* Clear SCL line */
+#define mSCL_HIGH() am_hal_gpio_out_bit_set(SMBUS_GPIO_SCL) /* Set SCL line */
-#define mSDA_READ() am_hal_gpio_input_bit_read(SMBUS_GPIO_SCL) /* Read SCL line */
+#define mSDA_READ() am_hal_gpio_input_bit_read(SMBUS_GPIO_SDA) /* Read SDA line */
-#define mSDA_IN() am_hal_gpio_pin_config(SMBUS_GPIO_SCL, AM_HAL_GPIO_INPUT | AM_HAL_GPIO_PULL6K) /* Set SDA as Input */
-#define mSDA_OUT() am_hal_gpio_pin_config(SMBUS_GPIO_SCL, AM_HAL_GPIO_OUTPUT) /* Set SDA as Output */
-#define mSCL_OUT() am_hal_gpio_pin_config(SMBUS_GPIO_SDA, AM_HAL_GPIO_OUTPUT) /* Set SCL as Output */
+#define mSDA_IN() am_hal_gpio_pin_config(SMBUS_GPIO_SDA, AM_HAL_GPIO_INPUT | AM_HAL_GPIO_PULL6K) /* Set SDA as Input */
+#define mSDA_OUT() am_hal_gpio_pin_config(SMBUS_GPIO_SDA, AM_HAL_GPIO_OUTPUT) /* Set SDA as Output */
+#define mSCL_OUT() am_hal_gpio_pin_config(SMBUS_GPIO_SCL, AM_HAL_GPIO_OUTPUT) /* Set SCL as Output */
#define ACK 0
#define NACK 1
diff --git a/bsp/apollo2/board/spi.c b/bsp/apollo2/board/spi.c
index 5267329684..783f359af0 100644
--- a/bsp/apollo2/board/spi.c
+++ b/bsp/apollo2/board/spi.c
@@ -25,10 +25,9 @@
#include <rtthread.h>
#include <rtdevice.h>
#include "am_mcu_apollo.h"
-#include "board.h"
#include "spi.h"
-/* SPI1 */
+/* SPI0 */
#define AM_SPI0_IOM_INST 0
#define SPI0_GPIO_SCK 5
@@ -38,17 +37,17 @@
#define SPI0_GPIO_MOSI 7
#define SPI0_GPIO_CFG_MOSI AM_HAL_PIN_7_M0MOSI
-/* SPI2 */
+/* SPI1 */
#define AM_SPI1_IOM_INST 1
static am_hal_iom_config_t g_sIOMConfig =
{
AM_HAL_IOM_SPIMODE, // ui32InterfaceMode
- AM_HAL_IOM_8MHZ, // ui32ClockFrequency
+ AM_HAL_IOM_400KHZ, // ui32ClockFrequency
0, // bSPHA
0, // bSPOL
- 4, // ui8WriteThreshold
- 60, // ui8ReadThreshold
+ 80, // ui8WriteThreshold
+ 80, // ui8ReadThreshold
};
/* AM spi driver */
@@ -64,7 +63,19 @@ static rt_err_t configure(struct rt_spi_device* device, struct rt_spi_configurat
struct am_spi_bus * am_spi_bus = (struct am_spi_bus *)device->bus;
rt_uint32_t max_hz = configuration->max_hz;
- if(max_hz >= 8000000)
+ if(max_hz >= 24000000)
+ {
+ g_sIOMConfig.ui32ClockFrequency = AM_HAL_IOM_24MHZ;
+ }
+ else if(max_hz >= 16000000)
+ {
+ g_sIOMConfig.ui32ClockFrequency = AM_HAL_IOM_16MHZ;
+ }
+ else if(max_hz >= 12000000)
+ {
+ g_sIOMConfig.ui32ClockFrequency = AM_HAL_IOM_12MHZ;
+ }
+ else if(max_hz >= 8000000)
{
g_sIOMConfig.ui32ClockFrequency = AM_HAL_IOM_8MHZ;
}
@@ -147,7 +158,6 @@ static rt_err_t configure(struct rt_spi_device* device, struct rt_spi_configurat
/* init SPI */
am_hal_iom_disable(am_spi_bus->u32Module);
- am_hal_iom_pwrctrl_enable(am_spi_bus->u32Module);
am_hal_iom_config(am_spi_bus->u32Module, &g_sIOMConfig);
am_hal_iom_enable(am_spi_bus->u32Module);
@@ -167,14 +177,12 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message* mes
/* take CS */
if (message->cs_take)
{
- ;
+ am_hal_gpio_out_bit_clear(am_spi_cs->chip_select);
}
// ������
if (recv_ptr != RT_NULL)
{
- u32TransferSize = u32BytesRemaining;
-
while (u32BytesRemaining)
{
/* Set the transfer size to either 64, or the number of remaining
@@ -182,22 +190,21 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message* mes
if (u32BytesRemaining > 64)
{
u32TransferSize = 64;
+ am_hal_gpio_pin_config(SPI0_GPIO_MOSI, AM_HAL_GPIO_OUTPUT | AM_HAL_GPIO_PULL6K);
+ am_hal_gpio_out_bit_set(SPI0_GPIO_MOSI);
am_hal_iom_spi_read(am_spi_bus->u32Module, am_spi_cs->chip_select,
- (uint32_t *)recv_ptr, u32TransferSize, AM_HAL_IOM_CS_LOW | AM_HAL_IOM_RAW);
+ (uint32_t *)recv_ptr, u32TransferSize, AM_HAL_IOM_RAW);
+ am_hal_gpio_pin_config(SPI0_GPIO_MOSI, SPI0_GPIO_CFG_MOSI | AM_HAL_GPIO_PULL6K);
}
else
{
u32TransferSize = u32BytesRemaining;
- /* release CS */
- if(message->cs_release)
{
+ am_hal_gpio_pin_config(SPI0_GPIO_MOSI, AM_HAL_GPIO_OUTPUT | AM_HAL_GPIO_PULL6K);
+ am_hal_gpio_out_bit_set(SPI0_GPIO_MOSI);
am_hal_iom_spi_read(am_spi_bus->u32Module, am_spi_cs->chip_select,
(uint32_t *)recv_ptr, u32TransferSize, AM_HAL_IOM_RAW);
- }
- else
- {
- am_hal_iom_spi_read(am_spi_bus->u32Module, am_spi_cs->chip_select,
- (uint32_t *)recv_ptr, u32TransferSize, AM_HAL_IOM_CS_LOW | AM_HAL_IOM_RAW);
+ am_hal_gpio_pin_config(SPI0_GPIO_MOSI, SPI0_GPIO_CFG_MOSI | AM_HAL_GPIO_PULL6K);
}
}
@@ -207,33 +214,26 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message* mes
}
// ���
- else if (send_ptr != RT_NULL)
+ else
{
while (u32BytesRemaining)
{
/* Set the transfer size to either 32, or the number of remaining
bytes, whichever is smaller */
- if (u32BytesRemaining > 32)
+ if (u32BytesRemaining > 64)
{
- u32TransferSize = 32;
+ u32TransferSize = 64;
am_hal_iom_spi_write(am_spi_bus->u32Module, am_spi_cs->chip_select,
- (uint32_t *)send_ptr, u32TransferSize, AM_HAL_IOM_CS_LOW | AM_HAL_IOM_RAW);
+ (uint32_t *)send_ptr, u32TransferSize, AM_HAL_IOM_RAW);
}
else
{
u32TransferSize = u32BytesRemaining;
- /* release CS */
- if (message->cs_release)
{
am_hal_iom_spi_write(am_spi_bus->u32Module, am_spi_cs->chip_select,
(uint32_t *)send_ptr, u32TransferSize, AM_HAL_IOM_RAW);
}
- else
- {
- am_hal_iom_spi_write(am_spi_bus->u32Module, am_spi_cs->chip_select,
- (uint32_t *)send_ptr, u32TransferSize, AM_HAL_IOM_CS_LOW | AM_HAL_IOM_RAW);
- }
}
u32BytesRemaining -= u32TransferSize;
@@ -241,6 +241,12 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message* mes
}
}
+ /* release CS */
+ if(message->cs_release)
+ {
+ am_hal_gpio_out_bit_set(am_spi_cs->chip_select);
+ }
+
return message->length;
}
@@ -250,31 +256,31 @@ static const struct rt_spi_ops am_spi_ops =
xfer
};
-#ifdef RT_USING_SPI1
-static struct am_spi_bus am_spi_bus_1 =
+#ifdef RT_USING_SPI0
+static struct am_spi_bus am_spi_bus_0 =
{
{0},
AM_SPI0_IOM_INST
};
-#endif /* #ifdef RT_USING_SPI1 */
+#endif /* #ifdef RT_USING_SPI0 */
-#ifdef RT_USING_SPI2
-static struct ambiq_spi_bus ambiq_spi_bus_2 =
+#ifdef RT_USING_SPI1
+static struct am_spi_bus am_spi_bus_1 =
{
- {1},
+ {0},
AM_SPI1_IOM_INST
};
-#endif /* #ifdef RT_USING_SPI2 */
+#endif /* #ifdef RT_USING_SPI1 */
int yr_hw_spi_init(void)
{
struct am_spi_bus* am_spi;
-#ifdef RT_USING_SPI1
+#ifdef RT_USING_SPI0
/* init spi gpio */
am_hal_gpio_pin_config(SPI0_GPIO_SCK, SPI0_GPIO_CFG_SCK);
- am_hal_gpio_pin_config(SPI0_GPIO_MISO, SPI0_GPIO_CFG_MISO);
- am_hal_gpio_pin_config(SPI0_GPIO_MOSI, SPI0_GPIO_CFG_MOSI);
+ am_hal_gpio_pin_config(SPI0_GPIO_MISO, SPI0_GPIO_CFG_MISO | AM_HAL_GPIO_PULL6K);
+ am_hal_gpio_pin_config(SPI0_GPIO_MOSI, SPI0_GPIO_CFG_MOSI | AM_HAL_GPIO_PULL6K);
/* Initialize IOM 0 in SPI mode at 100KHz */
am_hal_iom_pwrctrl_enable(AM_SPI0_IOM_INST);
@@ -282,11 +288,11 @@ int yr_hw_spi_init(void)
am_hal_iom_enable(AM_SPI0_IOM_INST);
//init spi bus device
- am_spi = &am_spi_bus_1;
- rt_spi_bus_register(&am_spi->parent, "spi1", &am_spi_ops);
+ am_spi = &am_spi_bus_0;
+ rt_spi_bus_register(&am_spi->parent, "spi0", &am_spi_ops);
#endif
- rt_kprintf("spi init!\n");
+ //rt_kprintf("spi init!\n");
return 0;
}
diff --git a/bsp/apollo2/board/uart.c b/bsp/apollo2/board/uart.c
index 94a76299ba..fc3884bf2d 100644
--- a/bsp/apollo2/board/uart.c
+++ b/bsp/apollo2/board/uart.c
@@ -25,7 +25,6 @@
#include <rtthread.h>
#include <rtdevice.h>
#include "am_mcu_apollo.h"
-#include "board.h"
/* USART0 */
#define AM_UART0_INST 0
@@ -165,8 +164,14 @@ static rt_err_t am_configure(struct rt_serial_device *serial, struct serial_conf
else if (cfg->stop_bits == STOP_BITS_2)
uart_cfg.bTwoStopBits = true;
- uart_cfg.ui32Parity = cfg->parity;
- uart_cfg.ui32FlowCtrl = AM_HAL_UART_PARITY_NONE;
+ if (cfg->parity == PARITY_NONE)
+ uart_cfg.ui32Parity = AM_HAL_UART_PARITY_NONE;
+ else if (cfg->parity == PARITY_ODD)
+ uart_cfg.ui32Parity = AM_HAL_UART_PARITY_ODD;
+ else if (cfg->parity == PARITY_EVEN)
+ uart_cfg.ui32Parity = AM_HAL_UART_PARITY_EVEN;
+
+ uart_cfg.ui32FlowCtrl = AM_HAL_UART_FLOW_CTRL_NONE;
/* UART Config */
am_hal_uart_config(uart->uart_device, &uart_cfg);
@@ -181,7 +186,7 @@ static rt_err_t am_configure(struct rt_serial_device *serial, struct serial_conf
am_hal_uart_enable(uart->uart_device);
/* Enable interrupts */
- am_hal_uart_int_enable(uart->uart_device, AM_HAL_UART_INT_RX_TMOUT | AM_HAL_UART_INT_RX | AM_HAL_UART_INT_TX);
+ am_hal_uart_int_enable(uart->uart_device, AM_HAL_UART_INT_RX_TMOUT | AM_HAL_UART_INT_RX);
/* Enable the uart interrupt in the NVIC */
am_hal_interrupt_enable(uart->uart_interrupt);
@@ -231,7 +236,7 @@ static int am_putc(struct rt_serial_device *serial, char c)
//if (txsize > 0)
{
am_hal_uart_char_transmit_buffered(uart->uart_device, c);
- }
+ }
/* Wait until busy bit clears to make sure UART fully transmitted last byte */
while ( am_hal_uart_flags_get(uart->uart_device) & AM_HAL_UART_FR_BUSY );
@@ -400,9 +405,6 @@ int rt_hw_uart_init(void)
#if defined(RT_USING_UART0)
uart = &uart0;
config.baud_rate = BAUD_RATE_115200;
- config.data_bits = DATA_BITS_8;
- config.stop_bits = STOP_BITS_1;
- config.parity = PARITY_NONE;
RCC_Configuration(uart);
@@ -418,9 +420,6 @@ int rt_hw_uart_init(void)
#if defined(RT_USING_UART1)
uart = &uart1;
config.baud_rate = BAUD_RATE_115200;
- config.data_bits = DATA_BITS_8;
- config.stop_bits = STOP_BITS_1;
- config.parity = PARITY_NONE;
RCC_Configuration(uart);
diff --git a/bsp/apollo2/libraries/drivers/SConscript b/bsp/apollo2/libraries/drivers/SConscript
index 6e460fbc5f..da2298889c 100644
--- a/bsp/apollo2/libraries/drivers/SConscript
+++ b/bsp/apollo2/libraries/drivers/SConscript
@@ -10,6 +10,7 @@ hal/am_hal_clkgen.c
hal/am_hal_debug.c
hal/am_hal_cachectrl.c
hal/am_hal_pwrctrl.c
+hal/am_hal_mcuctrl.c
hal/am_hal_sysctrl.c
hal/am_hal_reset.c
hal/am_hal_stimer.c
diff --git a/bsp/apollo2/libraries/drivers/am_mcu_apollo.h b/bsp/apollo2/libraries/drivers/am_mcu_apollo.h
index bf46aa61bb..ecd55de013 100644
--- a/bsp/apollo2/libraries/drivers/am_mcu_apollo.h
+++ b/bsp/apollo2/libraries/drivers/am_mcu_apollo.h
@@ -44,7 +44,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_MCU_APOLLO_H
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_adc.c b/bsp/apollo2/libraries/drivers/hal/am_hal_adc.c
index 957408d0e5..87a6c60483 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_adc.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_adc.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_adc.h b/bsp/apollo2/libraries/drivers/hal/am_hal_adc.h
index 86b48b162c..554e997441 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_adc.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_adc.h
@@ -42,17 +42,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_ADC_H
#define AM_HAL_ADC_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
//! @name Clock Selection
@@ -309,6 +304,11 @@ am_hal_adc_config_t;
(((value) & AM_REG_ADC_FIFO_COUNT_M) >> AM_REG_ADC_FIFO_COUNT_S)
//! @}
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.c b/bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.c
index 26c41a22e3..49b879398e 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.h b/bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.h
index b8ce914b94..beb7104516 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_cachectrl.h
@@ -38,17 +38,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_CACHECTRL_H
#define AM_HAL_CACHECTRL_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
// Cache configuration structure
@@ -186,6 +181,11 @@ extern const am_hal_cachectrl_config_t am_hal_cachectrl_defaults;
AM_HAL_CACHECTRL_CACHECFG_DATA_CLKGATE_ENABLE | \
AM_HAL_CACHECTRL_CACHECFG_CONFIG_2WAY_512)
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.c b/bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.c
index d60d7e47b5..83ac822609 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -287,16 +287,20 @@ am_hal_clkgen_int_clear(uint32_t ui32Interrupt)
//! AM_HAL_CLKGEN_OSC_LFRC
//! AM_HAL_CLKGEN_OSC_XT
//!
-//! @return 0 None.
+//! @return None.
//
//*****************************************************************************
void
am_hal_clkgen_osc_start(uint32_t ui32OscFlags)
{
- //
- // Start the oscillator(s).
- //
- AM_REG(CLKGEN, OCTRL) &= ~ui32OscFlags;
+ if ( ui32OscFlags & (AM_HAL_CLKGEN_OSC_LFRC | AM_HAL_CLKGEN_OSC_XT) )
+ {
+ //
+ // Start the oscillator(s).
+ // Note that these bits are cleared in order to enable the oscillator.
+ //
+ AM_REG(CLKGEN, OCTRL) &= ~ui32OscFlags;
+ }
}
//*****************************************************************************
@@ -318,10 +322,14 @@ am_hal_clkgen_osc_start(uint32_t ui32OscFlags)
void
am_hal_clkgen_osc_stop(uint32_t ui32OscFlags)
{
- //
- // Stop the oscillator(s).
- //
- AM_REG(CLKGEN, OCTRL) |= ui32OscFlags;
+ if ( ui32OscFlags & (AM_HAL_CLKGEN_OSC_LFRC | AM_HAL_CLKGEN_OSC_XT) )
+ {
+ //
+ // Stop the oscillator(s).
+ // Note that these bits are set in order to stop the oscillator.
+ //
+ AM_REG(CLKGEN, OCTRL) |= ui32OscFlags;
+ }
}
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.h b/bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.h
index fc50cb9b43..3ad31bbf7f 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_clkgen.h
@@ -38,17 +38,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_CLKGEN_H
#define AM_HAL_CLKGEN_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
//! @name System Clock max frequency
@@ -178,6 +173,11 @@ extern "C"
(AM_REG_CLKGEN_UARTEN_UART0EN_##entype << \
AM_HAL_CLKGEN_UARTEN_UARTENn_S(module))
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.c b/bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.c
index 13fc3c07cc..f3d06b6a76 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -68,11 +68,12 @@
// still pass in the event of a timer rollover.
//
//*****************************************************************************
+//! Timer read workaround: Do count values differ by one tick or less.
#define adjacent(A, B) (((A) == (B)) || (((A) + 1) == (B)) || ((B) == 0))
//*****************************************************************************
//
-// Array of function pointers for handling CTimer interrupts.
+//! Array of function pointers for handling CTimer interrupts.
//
//*****************************************************************************
am_hal_ctimer_handler_t am_hal_ctimer_ppfnHandlers[16];
@@ -162,10 +163,10 @@ back2back_reads( uint32_t u32TimerAddr, uint32_t u32Data[])
//*****************************************************************************
//
-// @brief Check to see if the given CTimer is using the HFRC
-//
-// Note - Calls to this function should be from inside a critical section.
-//
+//! @brief Check to see if the given CTimer is using the HFRC
+//!
+//! @note Calls to this function should be from inside a critical section.
+//!
//! @return None.
//
//*****************************************************************************
@@ -501,7 +502,7 @@ am_hal_ctimer_config(uint32_t ui32TimerNumber,
//! @param ui32TimerSegment specifies which segment of the timer should be
//! enabled.
//!
-//! @param ui32Configval specifies the configuration options for the selected
+//! @param ui32ConfigVal specifies the configuration options for the selected
//! timer.
//!
//! This function should be used to perform the initial set-up of the
@@ -823,7 +824,7 @@ uint32_t
am_hal_ctimer_read(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
{
volatile uint32_t ui32Value = 0;
- uint32_t ui32Values[3] = {0};
+ uint32_t ui32Values[4] = {0, };
uint32_t ui32TimerAddrTbl[4] =
{
REG_CTIMER_BASEADDR + AM_REG_CTIMER_TMR0_O,
@@ -1023,7 +1024,7 @@ am_hal_ctimer_pin_disable(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
//!
//! @param ui32TimerSegment specifies which segment of the timer to use.
//!
-//! @param bInvertOutpt determines whether the output should be inverted. If
+//! @param bInvertOutput determines whether the output should be inverted. If
//! true, the timer output pin for the selected timer segment will be
//! inverted.
//!
@@ -1131,7 +1132,7 @@ am_hal_ctimer_compare_set(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment,
pui32CmprRegA = (uint32_t *)(AM_REG_CTIMERn(0) +
AM_REG_CTIMER_CMPRA0_O +
(ui32TimerNumber * TIMER_OFFSET));
- pui32CmprRegB = pui32CmprRegA + CTIMER_CMPR_OFFSET;
+ pui32CmprRegB = pui32CmprRegA + CTIMER_CMPR_OFFSET / 4;
//
// Write the compare register with the selected value.
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.h b/bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.h
index fa1ebe16c4..dbd4d8e198 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_ctimer.h
@@ -42,17 +42,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_CTIMER_H
#define AM_HAL_CTIMER_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
//! Number of timers
@@ -114,7 +109,7 @@ extern "C"
//!
//! These options are to be used with the \e am_hal_ctimer_config_t structure
//! used by \e am_hal_ctimer_config
-//! @{
+//! @{
//
//*****************************************************************************
#define AM_HAL_CTIMER_CLK_PIN AM_REG_CTIMER_CTRL0_TMRA0CLK(0x0)
@@ -208,6 +203,11 @@ am_hal_ctimer_config_t;
//*****************************************************************************
typedef void (*am_hal_ctimer_handler_t)(void);
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_debug.c b/bsp/apollo2/libraries/drivers/hal/am_hal_debug.c
index 4078b5a5a0..4f79ca7b99 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_debug.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_debug.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_debug.h b/bsp/apollo2/libraries/drivers/hal/am_hal_debug.h
index a482799c4f..3cb28d9367 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_debug.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_debug.h
@@ -42,17 +42,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_DEBUG_H
#define AM_HAL_DEBUG_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
// Debug assert macros.
@@ -73,6 +68,11 @@ extern "C"
#endif // AM_DEBUG_ASSERT
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// External function prototypes.
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_flash.c b/bsp/apollo2/libraries/drivers/hal/am_hal_flash.c
index cd38da812c..db9f000a78 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_flash.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_flash.c
@@ -54,7 +54,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -430,6 +430,47 @@ am_hal_flash_delay(uint32_t ui32Iterations)
//*****************************************************************************
//
+//! @brief Delays for a desired amount of cycles while also waiting for a
+//! status change.
+//!
+//! @param ui32usMaxDelay - Maximum number of ~1uS delay loops.
+//! @param ui32Address - Address of the register for the status change.
+//! @param ui32Mask - Mask for the status change.
+//! @param ui32Value - Target value for the status change.
+//!
+//! This function will delay for approximately the given number of microseconds
+//! while checking for a status change, exiting when either the given time has
+//! expired or the status change is detected.
+//!
+//! @returns 0 = timeout.
+//! 1 = status change detected.
+//
+//*****************************************************************************
+uint32_t
+am_hal_flash_delay_status_change(uint32_t ui32usMaxDelay, uint32_t ui32Address,
+ uint32_t ui32Mask, uint32_t ui32Value)
+{
+ while ( ui32usMaxDelay-- )
+ {
+ //
+ // Check the status
+ //
+ if ( ( AM_REGVAL(ui32Address) & ui32Mask ) == ui32Value )
+ {
+ return 1;
+ }
+
+ //
+ // Call the BOOTROM cycle function to delay for about 1 microsecond.
+ //
+ am_hal_flash_delay( FLASH_CYCLES_US(1) );
+ }
+
+ return 0;
+} // am_hal_flash_delay_status_change()
+
+//*****************************************************************************
+//
//! @brief Static Helper Function to check customer info valid bits erasure.
//!
//! Use this function to test the state of the 128 valid bits at the beginning
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_flash.h b/bsp/apollo2/libraries/drivers/hal/am_hal_flash.h
index 66d6f5059c..dad39a6d23 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_flash.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_flash.h
@@ -42,17 +42,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_FLASH_H
#define AM_HAL_FLASH_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
#include <stdint.h>
#include <stdbool.h>
@@ -94,13 +89,19 @@ extern "C"
//
#define AM_HAL_FLASH_ADDR2ABSPAGE(addr) ( addr >> 13 )
+//*****************************************************************************
+//
+// Given an integer number of microseconds, convert to a value representing the
+// number of am_hal_flash_delay() cycles that will provide that amount of delay.
+// This macro is designed to take into account some of the call overhead.
//
-// Given a number of microseconds, convert to a value representing the number of
-// cycles that will give that delay. This macro is basically taking into account
-// some of the call overhead.
// e.g. To provide a 2us delay:
// am_hal_flash_delay( FLASH_CYCLES_US(2) );
//
+// IMPORTANT - Apollo2 is spec'ed for only 48MHz operation, so this macro
+// assumes that.
+//
+//*****************************************************************************
#define FLASH_CYCLES_US(n) ((n * (AM_HAL_CLKGEN_FREQ_MAX_MHZ / 3)) - 4)
//
@@ -223,6 +224,11 @@ extern g_am_hal_flash_t g_am_hal_flash;
#define AM_HAL_FLASH_INFO_CHUNK2INST(n) ((n >> 5) & 1
#define AM_HAL_FLASH_INFO_ADDR2CHUNK(n) ((n) >> 14)
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// Function prototypes for the helper functions
@@ -254,6 +260,10 @@ extern void am_hal_flash_recovery(uint32_t ui32RecoveryKey);
extern uint32_t am_hal_flash_load_ui32(uint32_t ui32Address);
extern void am_hal_flash_store_ui32(uint32_t ui32Address, uint32_t ui32Data);
extern void am_hal_flash_delay(uint32_t ui32Iterations);
+extern uint32_t am_hal_flash_delay_status_change(uint32_t ui32Iterations,
+ uint32_t ui32Address,
+ uint32_t ui32Mask,
+ uint32_t ui32Value);
//
// These functions update security/protection bits in the customer INFO blOCK.
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_global.c b/bsp/apollo2/libraries/drivers/hal/am_hal_global.c
index 498eb1627a..e9a3e2f67a 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_global.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_global.c
@@ -43,7 +43,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_global.h b/bsp/apollo2/libraries/drivers/hal/am_hal_global.h
index bb437b198a..0edb0fa745 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_global.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_global.h
@@ -42,17 +42,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_GLOBAL_H
#define AM_HAL_GLOBAL_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
// Macro definitions
@@ -108,6 +103,11 @@ extern "C"
extern volatile uint32_t g_ui32HALflags;
#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifdef __cplusplus
}
#endif
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_gpio.c b/bsp/apollo2/libraries/drivers/hal/am_hal_gpio.c
index 480118da6b..6715890737 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_gpio.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_gpio.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -479,7 +479,7 @@ am_hal_gpio_int_register(uint32_t ui32GPIONumber,
//!
//! This function gets the state of one GPIO polarity bit.
//!
-//! @note When the bit is a one the interrupt polarity is rising edge.
+//! @note When the bit is a zero the interrupt polarity is rising edge.
//!
//! @return the current polarity.
//
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_gpio.h b/bsp/apollo2/libraries/drivers/hal/am_hal_gpio.h
index 60e5cf36d6..553569e5ed 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_gpio.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_gpio.h
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -119,7 +119,7 @@
//*****************************************************************************
//
-// Output options
+// Output options (OUTCFG)
//
//*****************************************************************************
#define AM_HAL_GPIO_OUT_DISABLE ((0x0 << 1) << CFGVAL_GPIOCFG_S)
@@ -129,6 +129,15 @@
//*****************************************************************************
//
+// Special options for IOM0 and IOM4 clocks.
+// For 24MHz operation, a special enable must be selected. The 24MHZ select is
+// selected via bit0 of OUTCFG (which is, in a way,an alias of OUT_PUSHPULL).
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_24MHZ_ENABLE ((0x1 << 1) << CFGVAL_GPIOCFG_S)
+
+//*****************************************************************************
+//
// Pad configuration options.
// (Configuration value bits 7:0.)
//
@@ -498,13 +507,13 @@
//! @return None.
//
//*****************************************************************************
-#define am_hal_gpio_int_polarity_bit_set(ui32PinNumber, ui32Polarity) \
- if ( (uint32_t)(ui32PinNumber) < AM_HAL_GPIO_MAX_PADS ) \
+#define am_hal_gpio_int_polarity_bit_set(ui32BitNum, ui32Polarity) \
+ if ( (uint32_t)(ui32BitNum) < AM_HAL_GPIO_MAX_PADS ) \
{ \
AM_CRITICAL_BEGIN_ASM \
\
AM_REGn(GPIO, 0, PADKEY) = AM_REG_GPIO_PADKEY_KEYVAL; \
- AM_HAL_GPIO_POL_W(ui32PinNumber, ui32Polarity); \
+ AM_HAL_GPIO_POL_W(ui32BitNum, ui32Polarity); \
AM_REGn(GPIO, 0, PADKEY) = 0; \
\
AM_CRITICAL_END_ASM \
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.c b/bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.c
index 18e61b98f6..8c8527d7f3 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.c
@@ -41,7 +41,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -133,7 +133,7 @@ static am_hal_i2c_bit_bang_priv_t am_hal_i2c_bit_bang_priv;
// Wait for any stretched clock to go high
// If it times out - return failure
//
-static bool
+static __inline bool
i2c_pull_and_wait_scl_hi(void)
{
// Maximum time to wait for clock stretching
@@ -165,7 +165,7 @@ i2c_pull_and_wait_scl_hi(void)
//! returns None.
//
//*****************************************************************************
-am_hal_i2c_bit_bang_enum_t
+am_hal_i2c_bit_bang_enum_e
am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
uint32_t sda_gpio_number)
{
@@ -192,7 +192,7 @@ am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
//
// Set up SCK GPIO configuration bi-direction, input
//
- am_hal_gpio_pin_config(sck_gpio_number, AM_HAL_PIN_OPENDRAIN);
+ am_hal_gpio_pin_config(sck_gpio_number, AM_HAL_PIN_OPENDRAIN | AM_HAL_GPIO_INPEN);
//
// Set SDA GPIO data bit high so we aren't pulling down the data line
@@ -201,7 +201,7 @@ am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
//
// Set up SDA GPIO configuration bi-direction, input
//
- am_hal_gpio_pin_config(sda_gpio_number, AM_HAL_PIN_OPENDRAIN);
+ am_hal_gpio_pin_config(sda_gpio_number, AM_HAL_PIN_OPENDRAIN | AM_HAL_GPIO_INPEN);
// Now make sure we have control of the clock line
//
@@ -284,7 +284,7 @@ am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
//! returns the byte received
//
//*****************************************************************************
-static am_hal_i2c_bit_bang_enum_t
+static __inline am_hal_i2c_bit_bang_enum_e
i2c_receive_byte(uint8_t *pRxByte, bool bNack)
{
int i;
@@ -389,7 +389,7 @@ i2c_receive_byte(uint8_t *pRxByte, bool bNack)
//! }
//
//*****************************************************************************
-static am_hal_i2c_bit_bang_enum_t
+static __inline am_hal_i2c_bit_bang_enum_e
i2c_send_byte(uint8_t one_byte)
{
int i;
@@ -478,13 +478,13 @@ i2c_send_byte(uint8_t one_byte)
//! returns ENUM{AM_HAL_I2C_BIT_BANG_SUCCESS,AM_HAL_I2C_BIT_BANG_ADDRESS_NAKED}
//
//*****************************************************************************
-am_hal_i2c_bit_bang_enum_t
+am_hal_i2c_bit_bang_enum_e
am_hal_i2c_bit_bang_receive(uint8_t address, uint32_t number_of_bytes,
uint8_t *pData, uint8_t ui8Offset,
bool bUseOffset, bool bNoStop)
{
uint32_t ui32I;
- am_hal_i2c_bit_bang_enum_t status = AM_HAL_I2C_BIT_BANG_SUCCESS;
+ am_hal_i2c_bit_bang_enum_e status = AM_HAL_I2C_BIT_BANG_SUCCESS;
if (i2c_pull_and_wait_scl_hi())
@@ -617,13 +617,13 @@ am_hal_i2c_bit_bang_receive(uint8_t address, uint32_t number_of_bytes,
//! AM_HAL_I2C_BIT_BANG_ADDRESS_NAKED}
//
//*****************************************************************************
-am_hal_i2c_bit_bang_enum_t
+am_hal_i2c_bit_bang_enum_e
am_hal_i2c_bit_bang_send(uint8_t address, uint32_t number_of_bytes,
uint8_t *pData, uint8_t ui8Offset,
bool bUseOffset, bool bNoStop)
{
uint32_t ui32I;
- am_hal_i2c_bit_bang_enum_t status;
+ am_hal_i2c_bit_bang_enum_e status;
bool data_naked = false;
if (i2c_pull_and_wait_scl_hi())
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.h b/bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.h
index a9571edbe5..bc2afa46fe 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_i2c_bit_bang.h
@@ -40,17 +40,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_I2C_BIT_BANG_H
#define AM_HAL_I2C_BIT_BANG_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
// Enumerated return constants
@@ -63,24 +58,30 @@ typedef enum
AM_HAL_I2C_BIT_BANG_DATA_NAKED,
AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT,
AM_HAL_I2C_BIT_BANG_DATA_TIMEOUT,
-}am_hal_i2c_bit_bang_enum_t;
+ AM_HAL_I2C_BIT_BANG_STATUS_MAX,
+}am_hal_i2c_bit_bang_enum_e;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
//*****************************************************************************
//
// External function definitions
//
//*****************************************************************************
-extern am_hal_i2c_bit_bang_enum_t am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
+extern am_hal_i2c_bit_bang_enum_e am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
uint32_t sda_gpio_number);
-extern am_hal_i2c_bit_bang_enum_t am_hal_i2c_bit_bang_send(uint8_t address,
+extern am_hal_i2c_bit_bang_enum_e am_hal_i2c_bit_bang_send(uint8_t address,
uint32_t number_of_bytes,
uint8_t *pData,
uint8_t ui8Offset,
bool bUseOffset,
bool bNoStop);
-extern am_hal_i2c_bit_bang_enum_t am_hal_i2c_bit_bang_receive(uint8_t address,
+extern am_hal_i2c_bit_bang_enum_e am_hal_i2c_bit_bang_receive(uint8_t address,
uint32_t number_of_bytes,
uint8_t *pData,
uint8_t ui8Offset,
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.c b/bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.c
index 2f93b09cfc..5a404211e1 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.c
@@ -44,7 +44,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -190,7 +190,7 @@ am_hal_interrupt_priority_set(uint32_t ui32Interrupt, uint32_t ui32Priority)
//
// OR in the new priority.
//
- *pui32PriorityReg |= (ui32Priority << ui32Shift);
+ *pui32PriorityReg = ui32OldPriority | (ui32Priority << ui32Shift);
}
//*****************************************************************************
@@ -210,7 +210,7 @@ void am_hal_interrupt_pend_set(uint32_t ui32Interrupt)
//
// Check to see if the specified interrupt is valid for this MCU
//
- if ( ui32Interrupt > 47 )
+ if ( ui32Interrupt > AM_HAL_INTERRUPT_MAX )
{
return;
}
@@ -247,7 +247,7 @@ void am_hal_interrupt_pend_clear(uint32_t ui32Interrupt)
//
// Check to see if the specified interrupt is valid for this MCU
//
- if ( ui32Interrupt > 47 )
+ if ( ui32Interrupt > AM_HAL_INTERRUPT_MAX )
{
return;
}
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.h b/bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.h
index a8523371eb..1ba1550271 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_interrupt.h
@@ -44,16 +44,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_INTERRUPT_H
#define AM_HAL_INTERRUPT_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
//*****************************************************************************
//
//! @name ISR number macros.
@@ -66,6 +62,7 @@ extern "C"
//
// Hardware interrupts
//
+#define AM_HAL_INTERRUPT_MAX (47) //AM_HAL_INTERRUPT_SOFTWARE3
#define AM_HAL_INTERRUPT_RESET 1
#define AM_HAL_INTERRUPT_NMI 2
#define AM_HAL_INTERRUPT_HARDFAULT 3
@@ -130,6 +127,10 @@ extern "C"
//*****************************************************************************
#define AM_HAL_INTERRUPT_PRIORITY(n) (((uint32_t)(n) & 0x7) << 5)
+#ifdef __cplusplus
+extern "C"
+{
+#endif
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_iom.c b/bsp/apollo2/libraries/drivers/hal/am_hal_iom.c
index 244c28732b..222aca352a 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_iom.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_iom.c
@@ -42,14 +42,13 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#include <stdint.h>
#include <stdbool.h>
#include "am_mcu_apollo.h"
-//#include "am_util_delay.h"
#ifdef __IAR_SYSTEMS_ICC__
#define AM_INSTR_CLZ(n) __CLZ(n)
@@ -62,22 +61,6 @@
#define AM_ASSERT_INVALID_THRESHOLD (1)
#endif
-uint32_t am_util_wait_status_change(uint32_t ui32Iterations, uint32_t ui32Address, uint32_t ui32Mask, uint32_t ui32Value)
-{
- int i;
- for (i = 0; i < ui32Iterations; i++)
- {
- // Check the status
- if (((*(uint32_t *)ui32Address) & ui32Mask) == ui32Value)
- {
- return 1;
- }
- // Call the BOOTROM cycle delay function to get about 1 usec @ 48MHz
- am_hal_flash_delay(16);
- }
- return 0;
-}
-
//*****************************************************************************
//
// Forcing optimizations
@@ -111,6 +94,8 @@ internal_am_hal_iom_spi_cmd_construct(uint32_t ui32Operation,
uint32_t ui32ChipSelect,
uint32_t ui32NumBytes,
uint32_t ui32Options);
+static am_hal_iom_status_e
+internal_iom_wait_i2c_scl_hi(uint32_t ui32Module);
//*****************************************************************************
//
@@ -127,11 +112,6 @@ internal_am_hal_iom_spi_cmd_construct(uint32_t ui32Operation,
//
//*****************************************************************************
//
-// Save error status from ISR, particularly for use in I2C queue mode.
-//
-uint32_t g_iom_error_status = 0;
-
-//
// Define a structure to map CE for IOM4 only.
//
typedef struct
@@ -149,6 +129,26 @@ const IOMPad_t g_IOMPads[] =
{5, 47, 6}, {6, 35, 4}, {7, 38, 6}
};
+typedef struct
+{
+ uint8_t module; // IOM module
+ uint8_t pad; // GPIO Pad
+ uint8_t funcsel; // FNCSEL value
+} I2CPad_t;
+
+// Define the mapping between I2C SCL Pads, and FNCSEL values for all IOMs.
+const I2CPad_t g_I2CPads[] =
+{
+ {0, 5, 0},
+ {1, 8, 0},
+ {2, 0, 7},
+ {3, 42, 4},
+ {4, 39, 4},
+ {5, 48, 4},
+ {2, 27, 4},
+};
+
+// Defines for IOM 4 Workaround
#define WORKAROUND_IOM 4
#define WORKAROUND_IOM_MOSI_PIN 44
#define WORKAROUND_IOM_MOSI_CFG AM_HAL_PIN_44_M4MOSI
@@ -174,10 +174,15 @@ am_hal_iom_nb_buffer;
//
// Global State to keep track if there is an ongoing transaction
//
-volatile bool g_bIomBusy[AM_REG_IOMSTR_NUM_MODULES] = {0};
+volatile bool g_bIomBusy[AM_REG_IOMSTR_NUM_MODULES + 1] = {0};
am_hal_iom_nb_buffer g_psIOMBuffers[AM_REG_IOMSTR_NUM_MODULES];
+//
+// Save error status from non-blocking calls
+//
+static am_hal_iom_status_e g_iom_error_status[AM_REG_IOMSTR_NUM_MODULES + 1];
+
//*****************************************************************************
//
// Computed timeout.
@@ -208,6 +213,19 @@ am_hal_iom_queue_flush_t am_hal_iom_queue_flush = am_hal_iom_sleeping_queue_flus
//*****************************************************************************
am_hal_iom_pwrsave_t am_hal_iom_pwrsave[AM_REG_IOMSTR_NUM_MODULES];
+//*****************************************************************************
+//
+// I2C BitBang to IOM error mapping
+//
+//*****************************************************************************
+const am_hal_iom_status_e i2c_bb_errmap[AM_HAL_I2C_BIT_BANG_STATUS_MAX] =
+ {
+ AM_HAL_IOM_SUCCESS, // AM_HAL_I2C_BIT_BANG_SUCCESS,
+ AM_HAL_IOM_ERR_I2C_NAK, // AM_HAL_I2C_BIT_BANG_ADDRESS_NAKED,
+ AM_HAL_IOM_ERR_I2C_NAK, // AM_HAL_I2C_BIT_BANG_DATA_NAKED,
+ AM_HAL_IOM_ERR_TIMEOUT, // AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT,
+ AM_HAL_IOM_ERR_TIMEOUT, // AM_HAL_I2C_BIT_BANG_DATA_TIMEOUT,
+ };
//*****************************************************************************
//
@@ -216,6 +234,50 @@ am_hal_iom_pwrsave_t am_hal_iom_pwrsave[AM_REG_IOMSTR_NUM_MODULES];
//*****************************************************************************
//*****************************************************************************
+//
+// Get the error interrupt staus
+//
+//*****************************************************************************
+//
+//! @brief Returns the error status based on interrupt bits
+//!
+//! @param ui32Module - IOM module
+//! ui32Status - Currently accumulated error status
+//!
+//! The function looks at the supplied interrupt error status bits and the
+//! the current INTSTAT and maps the same to the enum am_hal_iom_status_e.
+//!
+//! @return Returns the appropriate error status in the form of am_hal_iom_status_e
+//!
+//*****************************************************************************
+static am_hal_iom_status_e
+internal_iom_get_int_err(uint32_t ui32Module, uint32_t ui32IntStatus)
+{
+ am_hal_iom_status_e ui32Status = AM_HAL_IOM_SUCCESS;
+ //
+ // Let's accumulate the errors
+ //
+ ui32IntStatus |= am_hal_iom_int_status_get(ui32Module, false);
+
+ if (ui32IntStatus & AM_HAL_IOM_INT_SWERR)
+ {
+ // Error in hardware command issued or illegal access by SW
+ ui32Status = AM_HAL_IOM_ERR_INVALID_OPER;
+ }
+ else if (ui32IntStatus & AM_HAL_IOM_INT_I2CARBERR)
+ {
+ // Loss of I2C multi-master arbitration
+ ui32Status = AM_HAL_IOM_ERR_I2C_ARB;
+ }
+ else if (ui32IntStatus & AM_HAL_IOM_INT_NAK)
+ {
+ // I2C NAK
+ ui32Status = AM_HAL_IOM_ERR_I2C_NAK;
+ }
+ return ui32Status;
+}
+
+//*****************************************************************************
// onebit()
//*****************************************************************************
//
@@ -317,6 +379,128 @@ isRevB0(void)
//*****************************************************************************
//
+// Checks to see if this processor is a Rev B2 device.
+//
+// This is needed for the B2 I2C workaround.
+//
+//*****************************************************************************
+static bool
+isRevB2(void)
+{
+ //
+ // Check to make sure the major rev is B and the minor rev is zero.
+ //
+ if ( (AM_REG(MCUCTRL, CHIPREV) & 0xFF) ==
+ (AM_REG_MCUCTRL_CHIPREV_REVMAJ_B | AM_REG_MCUCTRL_CHIPREV_REVMIN_REV2) )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+//*****************************************************************************
+//
+// Checks and waits for the SCL line to be high
+// This is to ensure clock hi time specs are not violated in case slave did
+// clock stretching in previous transaction
+//
+//*****************************************************************************
+static am_hal_iom_status_e
+internal_iom_wait_i2c_scl_hi(uint32_t ui32Module)
+{
+ uint32_t ui32IOMGPIO = 0xDEADBEEF;
+ volatile uint32_t *pui32SCLPadreg;
+ uint32_t ui32SCLPadregVal;
+ uint32_t index;
+ uint8_t ui8PadRegVal;
+ uint8_t ui8FncSelVal;
+ uint32_t waitStatus;
+
+ // Need to change the SCL pin as a GPIO and poll till it is set to hi
+ // For all the IOM's except for IOM2, there is a single designated pin for SCL
+ // IOM2 has two choices and we need to determine which one
+
+ //
+ // Figure out which GPIO we are using for the SCL
+ //
+ for ( index = 0; index < (sizeof(g_I2CPads) / sizeof(I2CPad_t)); index++ )
+ {
+ //
+ // Is this for the IOM that we are using?
+ //
+ if ( g_I2CPads[index].module == ui32Module )
+ {
+ //
+ // Get the PAD register value
+ //
+ ui8PadRegVal = ((AM_REGVAL(AM_HAL_GPIO_PADREG(g_I2CPads[index].pad))) &
+ AM_HAL_GPIO_PADREG_M(g_I2CPads[index].pad)) >>
+ AM_HAL_GPIO_PADREG_S(g_I2CPads[index].pad);
+
+ //
+ // Get the FNCSEL field value
+ //
+ ui8FncSelVal = (ui8PadRegVal & 0x38) >> 3;
+
+ //
+ // Is the FNCSEL filed for this pad set to the expected value?
+ //
+ if ( ui8FncSelVal == g_I2CPads[index].funcsel )
+ {
+ // This is the GPIO we need to use.
+ ui32IOMGPIO = g_I2CPads[index].pad;
+ break;
+ }
+ }
+ }
+ if (0xDEADBEEF == ui32IOMGPIO)
+ {
+ // SCL has not been configured
+ return AM_HAL_IOM_ERR_INVALID_CFG;
+ }
+
+ //
+ // Save the locations and values of the SCL pin configuration
+ // information.
+ //
+ pui32SCLPadreg = (volatile uint32_t *)AM_HAL_GPIO_PADREG(ui32IOMGPIO);
+ ui32SCLPadregVal = *pui32SCLPadreg;
+ //
+ // Temporarily configure the override pin as an input.
+ //
+ am_hal_gpio_pin_config(ui32IOMGPIO, AM_HAL_PIN_INPUT);
+
+ //
+ // Make sure SCL is high within standard timeout
+ //
+ waitStatus = am_hal_flash_delay_status_change(ui32StatusTimeout[ui32Module],
+ AM_HAL_GPIO_RD_REG(ui32IOMGPIO), AM_HAL_GPIO_RD_M(ui32IOMGPIO),
+ AM_HAL_GPIO_RD_M(ui32IOMGPIO));
+
+ //
+ // Write the GPIO PADKEY register
+ //
+ AM_REGn(GPIO, 0, PADKEY) = AM_REG_GPIO_PADKEY_KEYVAL;
+ // Revert back the original settings
+ *pui32SCLPadreg = ui32SCLPadregVal;
+ //
+ // Re-lock the GPIO PADKEY register
+ //
+ AM_REGn(GPIO, 0, PADKEY) = 0;
+
+ if (waitStatus != 1)
+ {
+ return AM_HAL_IOM_ERR_TIMEOUT;
+ }
+
+ return AM_HAL_IOM_SUCCESS;
+}
+
+//*****************************************************************************
+//
//! @brief Returns the proper settings for the CLKCFG register.
//!
//! @param ui32FreqHz - The desired interface frequency in Hz.
@@ -477,6 +661,53 @@ uint64_t iom_get_interface_clock_cfg(uint32_t ui32FreqHz, uint32_t ui32Phase )
//*****************************************************************************
//
+//! @brief Clock setting for the I2C Clock Stretch Workaround
+//!
+//! This restricts the frequencies that can be used for I2C devices on
+//!
+//! @param ui32FreqHz - The desired interface frequency in Hz.
+//!
+//! @return None.
+//
+//*****************************************************************************
+static
+uint64_t iom_get_i2c_workaround_clock_cfg(uint32_t ui32FreqHz)
+{
+ uint32_t ui32Fsel;
+
+ // Only allow certain SCL frequencies for clock stretching devices.
+ if (ui32FreqHz == AM_HAL_IOM_800KHZ)
+ {
+ ui32Fsel = 2;
+ }
+ else if (ui32FreqHz == AM_HAL_IOM_400KHZ)
+ {
+ ui32Fsel = 3;
+ }
+ else if (ui32FreqHz == AM_HAL_IOM_200KHZ)
+ {
+ ui32Fsel = 4;
+ }
+ else if (ui32FreqHz == AM_HAL_IOM_100KHZ)
+ {
+ ui32Fsel = 5;
+ }
+ else // Default is 100KHz.
+ {
+ ui32Fsel = 5;
+ }
+
+ // Return the resulting CLKCFG register settings.
+ return (AM_REG_IOMSTR_CLKCFG_FSEL(ui32Fsel) |
+ AM_REG_IOMSTR_CLKCFG_DIV3(0) |
+ AM_REG_IOMSTR_CLKCFG_DIVEN(1) |
+ AM_REG_IOMSTR_CLKCFG_LOWPER(14) |
+ AM_REG_IOMSTR_CLKCFG_TOTPER(29));
+
+} // iom_get_i2c_workaround_clock_cfg
+
+//*****************************************************************************
+//
//! @brief Enable the IOM in the power control block.
//!
//! This function enables the desigated IOM module in the power control block.
@@ -777,27 +1008,42 @@ am_hal_iom_config(uint32_t ui32Module, const am_hal_iom_config_t *psConfig)
#error AM_ASSERT_INVALID_THRESHOLD must be 0 or 1.
#endif
- //
- // An exception occurs in the LOWPER computation when setting an interface
- // frequency (such as a divide by 5 frequency) which results in a 60/40
- // duty cycle. The 60% cycle must occur in the appropriate half-period,
- // as only one of the half-periods is active, depending on which phase
- // is being selected.
- // If SPHA=0 the low period must be 60%. If SPHA=1 high period must be 60%.
- // Note that the predetermined frequency parameters use the formula
- // lowper = (totper-1)/2, which results in a 60% low period.
- //
- ui32ClkCfg = iom_get_interface_clock_cfg(psConfig->ui32ClockFrequency,
- psConfig->bSPHA );
+ // Apply I2C clock stretching workaround if B2 silicon and IOM 1,2,3, or 5
+ // Note: Only I2C clock speeds of AM_HAL_IOM_800KHZ, AM_HAL_IOM_400KHZ,
+ // AM_HAL_IOM_200KHZ, and AM_HAL_IOM_100KHZ are allowed. Other values will
+ // result in the default of AM_HAL_IOM_100KHZ.
+ if ((0 != ui32Module) && (4 != ui32Module) && (6 != ui32Module) &&
+ isRevB2() && (AM_HAL_IOM_I2CMODE == psConfig->ui32InterfaceMode))
+ {
+ // Set SPHA field to 1 on B2 silicon to enable the feature;
+ AM_REGn(IOMSTR, ui32Module, CFG) |= AM_REG_IOMSTR_CFG_SPHA_M;
+ ui32ClkCfg = iom_get_i2c_workaround_clock_cfg(psConfig->ui32ClockFrequency);
+ }
+ else
+ {
+ //
+ // An exception occurs in the LOWPER computation when setting an interface
+ // frequency (such as a divide by 5 frequency) which results in a 60/40
+ // duty cycle. The 60% cycle must occur in the appropriate half-period,
+ // as only one of the half-periods is active, depending on which phase
+ // is being selected.
+ // If SPHA=0 the low period must be 60%. If SPHA=1 high period must be 60%.
+ // Note that the predetermined frequency parameters use the formula
+ // lowper = (totper-1)/2, which results in a 60% low period.
+ //
+ ui32ClkCfg = iom_get_interface_clock_cfg(psConfig->ui32ClockFrequency,
+ psConfig->bSPHA );
+ }
+
if ( ui32ClkCfg )
{
AM_REGn(IOMSTR, ui32Module, CLKCFG) = (uint32_t)ui32ClkCfg;
}
-
+
//
// Compute the status timeout value.
//
- ui32StatusTimeout[ui32Module] = MAX_IOM_BITS * AM_HAL_IOM_MAX_FIFO_SIZE *
+ ui32StatusTimeout[ui32Module] = MAX_IOM_BITS * AM_HAL_IOM_MAX_FIFO_SIZE *
IOM_OVERHEAD_FACTOR * (am_hal_clkgen_sysclk_get() / psConfig->ui32ClockFrequency);
}
@@ -1101,6 +1347,10 @@ am_hal_iom_workaround_word_write(uint32_t ui32ChipSelect,
pui32CSPadreg, ui32CSPadregVal,
ui32DelayTime, ui32ClkCfg,
ui32LowClkCfg, bRising);
+ //
+ // Re-lock the GPIO PADKEY register
+ //
+ AM_REGn(GPIO, 0, PADKEY) = 0;
//
// Update the pointer and data counter.
@@ -1274,21 +1524,29 @@ iom_workaround_loop(uint32_t ui32PadRegVal, volatile uint32_t *pui32PadReg,
//! last word with bytes of any value. The IOM hardware will only read the
//! first \e ui32NumBytes in the \e pui8Data array.
//!
-//! @return None.
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution.
//
//*****************************************************************************
-void
+am_hal_iom_status_e
am_hal_iom_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options)
{
+ am_hal_iom_status_e ui32Status;
//
// Validate parameters
//
- am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
- "Trying to use an IOM module that doesn't exist.");
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
+ if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+ {
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
//
// Check to see if queues have been enabled. If they are, we'll actually
@@ -1299,27 +1557,32 @@ am_hal_iom_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
//
// If the queue is on, go ahead and add this transaction to the queue.
//
- am_hal_iom_queue_spi_write(ui32Module, ui32ChipSelect, pui32Data,
+ ui32Status = am_hal_iom_queue_spi_write(ui32Module, ui32ChipSelect, pui32Data,
ui32NumBytes, ui32Options, 0);
- //
- // Wait until the transaction actually clears.
- //
- am_hal_iom_queue_flush(ui32Module);
+ if (ui32Status == AM_HAL_IOM_SUCCESS)
+ {
+ //
+ // Wait until the transaction actually clears.
+ //
+ am_hal_iom_queue_flush(ui32Module);
+ // g_iom_error_status gets set in the isr handling
+ ui32Status = g_iom_error_status[ui32Module];
+ }
//
// At this point, we've completed the transaction, and we can return.
//
- return;
}
else
{
//
// Otherwise, we'll just do a polled transaction.
//
- am_hal_iom_spi_write_nq(ui32Module, ui32ChipSelect, pui32Data,
+ ui32Status = am_hal_iom_spi_write_nq(ui32Module, ui32ChipSelect, pui32Data,
ui32NumBytes, ui32Options);
}
+ return ui32Status;
}
//*****************************************************************************
@@ -1341,26 +1604,38 @@ am_hal_iom_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
//! into 32-bit words, which are then placed into the \e pui32Data array. Only
//! the first \e ui32NumBytes bytes in this array will contain valid data.
//!
-//! @return None.
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution.
//
//*****************************************************************************
-void
+am_hal_iom_status_e
am_hal_iom_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options)
{
+ am_hal_iom_status_e ui32Status;
//
// Validate parameters
//
- am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
- "Trying to use an IOM module that doesn't exist.");
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
-
+ if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+ {
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ // Reset the error status
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
//
// Make sure the transfer isn't too long for the hardware to support.
//
- am_hal_debug_assert_msg(ui32NumBytes < 4096, "SPI transfer too big.");
+ if (ui32NumBytes >= 4096)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
//
// Check to see if queues have been enabled. If they are, we'll actually
@@ -1371,27 +1646,131 @@ am_hal_iom_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
//
// If the queue is on, go ahead and add this transaction to the queue.
//
- am_hal_iom_queue_spi_read(ui32Module, ui32ChipSelect, pui32Data,
+ ui32Status = am_hal_iom_queue_spi_read(ui32Module, ui32ChipSelect, pui32Data,
ui32NumBytes, ui32Options, 0);
- //
- // Wait until the transaction actually clears.
- //
- am_hal_iom_queue_flush(ui32Module);
+ if (ui32Status == AM_HAL_IOM_SUCCESS)
+ {
+ //
+ // Wait until the transaction actually clears.
+ //
+ am_hal_iom_queue_flush(ui32Module);
+ // g_iom_error_status gets set in the isr handling
+ ui32Status = g_iom_error_status[ui32Module];
+ }
//
// At this point, we've completed the transaction, and we can return.
//
- return;
}
else
{
//
// Otherwise, just perform a polled transaction.
//
- am_hal_iom_spi_read_nq(ui32Module, ui32ChipSelect, pui32Data,
+ ui32Status = am_hal_iom_spi_read_nq(ui32Module, ui32ChipSelect, pui32Data,
ui32NumBytes, ui32Options);
}
+ return ui32Status;
+}
+
+//*****************************************************************************
+//
+//! @brief Perform a simple full-duplex transaction to the SPI interface.
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32ChipSelect - Chip-select number for this transaction.
+//! @param pui32TxData - Pointer to the bytes that will be sent.
+//! @param pui32RxData - Pointer to the bytes that will be received.
+//! @param ui32NumBytes - Number of bytes to send.
+//! @param ui32Options - Additional SPI transfer options.
+//!
+//! This function performs SPI full-duplex operation to a selected SPI device.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This means that you will need to byte-pack the \e pui32TxData array with the
+//! data you intend to send over the interface. One easy way to do this is to
+//! declare the array as a 32-bit integer array, but use an 8-bit pointer to
+//! put your actual data into the array. If there are not enough bytes in your
+//! desired message to completely fill the last 32-bit word, you may pad that
+//! last word with bytes of any value. The IOM hardware will only read the
+//! first \e ui32NumBytes in the \e pui32TxData array.
+//!
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution.
+//
+//*****************************************************************************
+am_hal_iom_status_e
+am_hal_iom_spi_fullduplex(uint32_t ui32Module, uint32_t ui32ChipSelect,
+ uint32_t *pui32TxData, uint32_t *pui32RxData,
+ uint32_t ui32NumBytes, uint32_t ui32Options)
+{
+ am_hal_iom_status_e ui32Status;
+ //
+ // Validate parameters
+ //
+ if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+ {
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
+ //
+ // Full-Duplex operation is only supported for Apollo2 B2 Silicon.
+ //
+ if (!isRevB2())
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_OPER;
+ return ui32Status;
+ }
+
+ //
+ // Check to see if queues have been enabled. If they are, we'll actually
+ // switch to the queued interface.
+ //
+#if 0
+
+ // To be implemented!!!
+ if ( g_psIOMQueue[ui32Module].pui8Data != NULL )
+ {
+ //
+ // If the queue is on, go ahead and add this transaction to the queue.
+ //
+ ui32Status = am_hal_iom_queue_spi_write(ui32Module, ui32ChipSelect, pui32Data,
+ ui32NumBytes, ui32Options, 0);
+
+ if (ui32Status == AM_HAL_IOM_SUCCESS)
+ {
+ //
+ // Wait until the transaction actually clears.
+ //
+ am_hal_iom_queue_flush(ui32Module);
+ // g_iom_error_status gets set in the isr handling
+ ui32Status = g_iom_error_status[ui32Module];
+ }
+
+ //
+ // At this point, we've completed the transaction, and we can return.
+ //
+ }
+ else
+ {
+#endif
+ //
+ // Otherwise, we'll just do a polled transaction.
+ //
+ ui32Status = am_hal_iom_spi_fullduplex_nq(ui32Module, ui32ChipSelect,
+ pui32TxData, pui32RxData,
+ ui32NumBytes, ui32Options);
+#if 0
+ }
+#endif
+
+ return ui32Status;
}
//*****************************************************************************
@@ -1415,10 +1794,10 @@ am_hal_iom_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
//! last word with bytes of any value. The IOM hardware will only read the
//! first \e ui32NumBytes in the \e pui8Data array.
//!
-//! @return None.
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution.
//
//*****************************************************************************
-uint32_t
+am_hal_iom_status_e
am_hal_iom_spi_write_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options)
@@ -1427,34 +1806,47 @@ am_hal_iom_spi_write_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t ui32SpaceInFifo;
uint32_t ui32IntConfig;
uint32_t ui32MaxFifoSize;
- uint32_t ui32Status = 1;
+ am_hal_iom_status_e ui32Status;
+ uint32_t waitStatus;
//
// Validate parameters
//
- am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
- "Trying to use an IOM module that doesn't exist.");
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
+ if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+ {
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ //
+ // Wait until the bus is idle
+ //
+ am_hal_iom_poll_complete(ui32Module);
+
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
//
// Make sure the transfer isn't too long for the hardware to support.
//
- am_hal_debug_assert_msg(ui32NumBytes < 4096, "SPI transfer too big.");
+ if (ui32NumBytes >= 4096)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
ui32MaxFifoSize = ((0 == AM_BFRn(IOMSTR, ui32Module, CFG, FULLDUP)) ?
AM_HAL_IOM_MAX_FIFO_SIZE : AM_HAL_IOM_MAX_FIFO_SIZE / 2);
//
- // Wait until any earlier transactions have completed.
- //
- am_hal_iom_poll_complete(ui32Module);
- //
// Disable interrupts so that we don't get any undesired interrupts.
//
ui32IntConfig = AM_REGn(IOMSTR, ui32Module, INTEN);
AM_REGn(IOMSTR, ui32Module, INTEN) = 0;
- // Clear CMDCMP status
- AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
//
// If we're on a B0 part, and we're using IOM4, our first byte coule be
@@ -1545,23 +1937,27 @@ am_hal_iom_spi_write_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
//
// Make sure CMDCMP was raised with standard timeout
//
- ui32Status = am_util_wait_status_change(ui32StatusTimeout[ui32Module],
- AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
- AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
+ waitStatus = am_hal_flash_delay_status_change(ui32StatusTimeout[ui32Module],
+ AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
+ AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
+
+ if (waitStatus != 1)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_TIMEOUT;
+ }
+ else
+ {
+ g_iom_error_status[ui32Module] = ui32Status = internal_iom_get_int_err(ui32Module, 0);
+ }
//
- // Re-enable IOM interrupts. Make sure CMDCMP is cleared
+ // Re-enable IOM interrupts.
//
- AM_REGn(IOMSTR, ui32Module, INTCLR) = (ui32IntConfig | AM_REG_IOMSTR_INTSTAT_CMDCMP_M);
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
AM_REGn(IOMSTR, ui32Module, INTEN) = ui32IntConfig;
- am_hal_debug_assert_msg(ui32Status == 1,"IOM CMDCMP was not seen");
-
- //
- // Return the status (0 = timeout; 1 = success)
- //
return ui32Status;
-
}
//*****************************************************************************
@@ -1583,10 +1979,10 @@ am_hal_iom_spi_write_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
//! into 32-bit words, which are then placed into the \e pui32Data array. Only
//! the first \e ui32NumBytes bytes in this array will contain valid data.
//!
-//! @return None.
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution.
//
//*****************************************************************************
-uint32_t
+am_hal_iom_status_e
am_hal_iom_spi_read_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options)
@@ -1594,26 +1990,36 @@ am_hal_iom_spi_read_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t ui32BytesInFifo;
uint32_t ui32IntConfig;
uint32_t bCmdCmp = false;
- uint32_t ui32Status = 1;
+ am_hal_iom_status_e ui32Status;
+ uint32_t waitStatus;
//
// Validate parameters
//
- am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
- "Trying to use an IOM module that doesn't exist.");
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
-
+ if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+ {
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
//
- // Make sure the transfer isn't too long for the hardware to support.
+ // Wait until the bus is idle
//
- am_hal_debug_assert_msg(ui32NumBytes < 4096, "SPI transfer too big.");
+ am_hal_iom_poll_complete(ui32Module);
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
//
- // Wait until the bus is idle, then start the requested READ transfer on
- // the physical interface.
+ // Make sure the transfer isn't too long for the hardware to support.
//
- am_hal_iom_poll_complete(ui32Module);
+ if (ui32NumBytes >= 4096)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
//
// Disable interrupts so that we don't get any undesired interrupts.
@@ -1625,10 +2031,8 @@ am_hal_iom_spi_read_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
//
AM_REGn(IOMSTR, ui32Module, INTEN) = 0;
- //
- // Clear CMDCMP status
- //
- AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
//
// If we're on a B0 part, and we're using IOM4, our first byte coule be
@@ -1654,11 +2058,22 @@ am_hal_iom_spi_read_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
// Wait for the dummy word to go out over the bus.
//
// Make sure the command complete has also been raised
- ui32Status = am_util_wait_status_change(ui32StatusTimeout[ui32Module],
- AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
- AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
-
-
+ waitStatus = am_hal_flash_delay_status_change(ui32StatusTimeout[ui32Module],
+ AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
+ AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
+
+ if (waitStatus != 1)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_TIMEOUT;
+ //
+ // Re-enable IOM interrupts.
+ //
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
+ AM_REGn(IOMSTR, ui32Module, INTEN) = ui32IntConfig;
+ return ui32Status;
+ }
+
// Clear CMDCMP status
AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
}
@@ -1706,21 +2121,230 @@ am_hal_iom_spi_read_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
//
// Make sure CMDCMP was raised,
//
- ui32Status = am_util_wait_status_change(ui32StatusTimeout[ui32Module],
- AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
- AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
+ waitStatus = am_hal_flash_delay_status_change(ui32StatusTimeout[ui32Module],
+ AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
+ AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
+
+ if (waitStatus != 1)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_TIMEOUT;
+ }
+ else
+ {
+ g_iom_error_status[ui32Module] = ui32Status = internal_iom_get_int_err(ui32Module, 0);
+ }
//
// Re-enable IOM interrupts. Make sure CMDCMP is cleared
//
- AM_REGn(IOMSTR, ui32Module, INTCLR) = (ui32IntConfig | AM_REG_IOMSTR_INTSTAT_CMDCMP_M);
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
+ AM_REGn(IOMSTR, ui32Module, INTEN) = ui32IntConfig;
+
+ return ui32Status;
+
+}
+
+//*****************************************************************************
+//
+//! @brief Perform a simple full-duplex operation to the SPI interface (without queuing)
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32ChipSelect - Chip-select number for this transaction.
+//! @param pui32Data - Pointer to the bytes that will be sent.
+//! @param pui32Data - Pointer to the bytes that will be received.
+//! @param ui32NumBytes - Number of bytes to send.
+//! @param ui32Options - Additional SPI transfer options.
+//!
+//! This function performs SPI full-duplex operation to a selected SPI device.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This means that you will need to byte-pack the \e pui32TxData array with the
+//! data you intend to send over the interface. One easy way to do this is to
+//! declare the array as a 32-bit integer array, but use an 8-bit pointer to
+//! put your actual data into the array. If there are not enough bytes in your
+//! desired message to completely fill the last 32-bit word, you may pad that
+//! last word with bytes of any value. The IOM hardware will only read the
+//! first \e ui32NumBytes in the \e pui32TxData array.
+//!
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution.
+//
+//*****************************************************************************
+am_hal_iom_status_e
+am_hal_iom_spi_fullduplex_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
+ uint32_t *pui32TxData, uint32_t *pui32RxData,
+ uint32_t ui32NumBytes, uint32_t ui32Options)
+{
+ uint32_t ui32TransferSize;
+ uint32_t ui32SpaceInFifo;
+ uint32_t bCmdCmp = false;
+ uint32_t ui32IntConfig;
+ uint32_t ui32MaxFifoSize;
+ am_hal_iom_status_e ui32Status;
+ uint32_t waitStatus;
+
+ //
+ // Validate parameters
+ //
+ if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+ {
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ //
+ // Wait until the bus is idle
+ //
+ am_hal_iom_poll_complete(ui32Module);
+
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
+
+ //
+ // Make sure the transfer isn't too long for the hardware to support.
+ //
+ if (ui32NumBytes >= 4096)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
+
+ //
+ // Full-Duplex operation is only supported for Apollo2 B2 Silicon.
+ //
+ if (!isRevB2())
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_OPER;
+ return ui32Status;
+ }
+
+ //
+ // Put the IOM into Full-Duplex mode.
+ //
+ AM_REGn(IOMSTR, ui32Module, CFG) |= AM_REG_IOMSTR_CFG_FULLDUP_FULLDUP;
+
+ ui32MaxFifoSize = ((0 == AM_BFRn(IOMSTR, ui32Module, CFG, FULLDUP)) ?
+ AM_HAL_IOM_MAX_FIFO_SIZE : AM_HAL_IOM_MAX_FIFO_SIZE / 2);
+ //
+ // Disable interrupts so that we don't get any undesired interrupts.
+ //
+ ui32IntConfig = AM_REGn(IOMSTR, ui32Module, INTEN);
+ AM_REGn(IOMSTR, ui32Module, INTEN) = 0;
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
+
+ //
+ // Figure out how many bytes we can write to the FIFO immediately.
+ //
+ ui32TransferSize = (ui32NumBytes <= ui32MaxFifoSize ? ui32NumBytes :
+ ui32MaxFifoSize);
+ //
+ // write up to the maximum FIFO size into the fifo.
+ //
+ am_hal_iom_fifo_write(ui32Module, pui32TxData, ui32TransferSize);
+
+ //
+ // Start the write on the bus.
+ //
+ am_hal_iom_spi_cmd_run(AM_HAL_IOM_WRITE, ui32Module, ui32ChipSelect,
+ ui32NumBytes, ui32Options);
+
+ //
+ // Update the pointer and data counter.
+ //
+ pui32TxData += ui32TransferSize >> 2;
+
+ //
+ // Keep looping until we're out of bytes to receive or command complete (error).
+ //
+ while ( ui32NumBytes )
+ {
+ //
+ // Wait for FIFO to empty.
+ //
+ while (am_hal_iom_fifo_full_slots(ui32Module) > 0);
+
+ am_hal_iom_fifo_read(ui32Module, pui32RxData, ui32TransferSize);
+ ui32NumBytes -= ui32TransferSize;
+ pui32RxData += ui32TransferSize >> 2;
+
+ //
+ // Get the number of bytes that can be written (always a multiple of 4).
+ //
+ ui32SpaceInFifo = am_hal_iom_fifo_empty_slots(ui32Module);
+
+ if ( ui32NumBytes <= ui32SpaceInFifo )
+ {
+ //
+ // If the entire message will fit in the fifo, prepare to copy
+ // everything.
+ //
+ ui32TransferSize = ui32NumBytes;
+ }
+ else
+ {
+ //
+ // If only a portion of the message will fit in the fifo, prepare
+ // to copy the largest number of 4-byte blocks possible.
+ //
+ ui32TransferSize = ui32SpaceInFifo & ~(0x3);
+ }
+
+ //
+ // Write this chunk to the fifo.
+ //
+ am_hal_iom_fifo_write(ui32Module, pui32TxData, ui32TransferSize);
+
+ //
+ // Update the data pointer and bytes-left count.
+ //
+ pui32TxData += ui32TransferSize >> 2;
+
+ //
+ // Check for Command Complete condition.
+ if ( bCmdCmp == true )
+ {
+ //
+ // No more data expected. Get out of the loop
+ //
+ break;
+ }
+
+ bCmdCmp = AM_BFRn(IOMSTR, ui32Module, INTSTAT, CMDCMP);
+
+ }
+
+ //
+ // Make sure CMDCMP was raised with standard timeout
+ //
+ waitStatus = am_hal_flash_delay_status_change(ui32StatusTimeout[ui32Module],
+ AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
+ AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
+
+ if (waitStatus != 1)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_TIMEOUT;
+ }
+ else
+ {
+ g_iom_error_status[ui32Module] = ui32Status = internal_iom_get_int_err(ui32Module, 0);
+ }
+
+ //
+ // Re-enable IOM interrupts.
+ //
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
AM_REGn(IOMSTR, ui32Module, INTEN) = ui32IntConfig;
- am_hal_debug_assert_msg(ui32Status == 1,"IOM CMDCMP was not seen");
-
//
- // Return the status (0 = timeout; 1 = success)
+ // Take the IOM out of Full-Duplex mode.
//
+ AM_REGn(IOMSTR, ui32Module, CFG) &= ~AM_REG_IOMSTR_CFG_FULLDUP_FULLDUP;
+
return ui32Status;
}
@@ -1754,15 +2378,19 @@ am_hal_iom_spi_read_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
//! last word with bytes of any value. The IOM hardware will only read the
//! first \e ui32NumBytes in the \e pui8Data array.
//!
-//! @return None.
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution. Note that
+//! successful execution for non-blocking call only means the transaction was
+//! successfully initiated. The status of the transaction is not known till the
+//! callback is called on completion
//
//*****************************************************************************
-void
+am_hal_iom_status_e
am_hal_iom_spi_write_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options,
am_hal_iom_callback_t pfnCallback)
{
+ am_hal_iom_status_e ui32Status;
uint32_t ui32TransferSize;
uint32_t ui32MaxFifoSize;
@@ -1771,35 +2399,41 @@ am_hal_iom_spi_write_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
//
if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
{
- return;
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
}
+ //
+ // Wait until the bus is idle
+ //
+ am_hal_iom_poll_complete(ui32Module);
+ // Reset the error status for non-blocking transfer
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
//
// Make sure the transfer isn't too long for the hardware to support.
//
- am_hal_debug_assert_msg(ui32NumBytes < 4096, "SPI transfer too big.");
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
+ if (ui32NumBytes >= 4096)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
ui32MaxFifoSize = ((0 == AM_BFRn(IOMSTR, ui32Module, CFG, FULLDUP)) ?
AM_HAL_IOM_MAX_FIFO_SIZE : AM_HAL_IOM_MAX_FIFO_SIZE / 2);
//
- // Wait until the bus is idle
- //
- am_hal_iom_poll_complete(ui32Module);
-
- //
// Need to mark IOM busy to avoid another transaction to be scheduled.
// This is to take care of a race condition in Queue mode, where the IDLE
// set is not a guarantee that the CMDCMP has been received
//
g_bIomBusy[ui32Module] = true;
- //
- // Clear CMDCMP status
- //
- AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
//
// Check to see if we need to do the workaround.
@@ -1863,6 +2497,7 @@ am_hal_iom_spi_write_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
ui32NumBytes, ui32Options);
}
}
+ return ui32Status;
}
//*****************************************************************************
@@ -1892,51 +2527,62 @@ am_hal_iom_spi_write_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
//! into 32-bit words, which are then placed into the \e pui32Data array. Only
//! the first \e ui32NumBytes bytes in this array will contain valid data.
//!
-//! @return None.
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution. Note that
+//! successful execution for non-blocking call only means the transaction was
+//! successfully initiated. The status of the transaction is not known till the
+//! callback is called on completion
//
//*****************************************************************************
-uint32_t
+am_hal_iom_status_e
am_hal_iom_spi_read_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options,
am_hal_iom_callback_t pfnCallback)
{
+ am_hal_iom_status_e ui32Status;
uint32_t ui32IntConfig;
- uint32_t ui32Status = 1;
-
- //
- // Validate parameters
- //
- am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
- "Trying to use an IOM module that doesn't exist.");
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
+ uint32_t waitStatus;
//
- // Make sure the transfer isn't too long for the hardware to support.
+ // Validate parameters
//
- am_hal_debug_assert_msg(ui32NumBytes < 4096, "SPI transfer too big.");
-
+ if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+ {
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
//
// Wait until the bus is idle
//
am_hal_iom_poll_complete(ui32Module);
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
+ //
+ // Make sure the transfer isn't too long for the hardware to support.
+ //
+ if (ui32NumBytes >= 4096)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
+
//
// Need to mark IOM busy to avoid another transaction to be scheduled.
// This is to take care of a race condition in Queue mode, where the IDLE
// set is not a guarantee that the CMDCMP has been received
//
-
g_bIomBusy[ui32Module] = true;
- //
- // Clear CMDCMP status
- //
- AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
//
- // If we're on a B0 part, and we're using IOM4, our first byte coule be
+ // If we're on a B0 part, and we're using IOM4, our first byte could be
// corrupted, so we need to send a dummy word with chip-select held high to
// get that first byte out of the way. This is only true for spi reads with
// OFFSET values.
@@ -1968,9 +2614,15 @@ am_hal_iom_spi_read_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
// Wait for the dummy word to go out over the bus.
//
// Make sure the command complete has also been raised
- ui32Status = am_util_wait_status_change(ui32StatusTimeout[ui32Module],
- AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
- AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
+ waitStatus = am_hal_flash_delay_status_change(ui32StatusTimeout[ui32Module],
+ AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
+ AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
+
+ if (waitStatus != 1)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_TIMEOUT;
+ return ui32Status;
+ }
//
// Re-mark IOM as busy
@@ -1981,7 +2633,7 @@ am_hal_iom_spi_read_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
//
// Re-enable IOM interrupts. Make sure CMDCMP is cleared
//
- AM_REGn(IOMSTR, 4, INTCLR) = (ui32IntConfig | AM_REG_IOMSTR_INTSTAT_CMDCMP_M);
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
AM_REGn(IOMSTR, 4, INTEN) = ui32IntConfig;
}
@@ -1999,9 +2651,7 @@ am_hal_iom_spi_read_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
//
am_hal_iom_spi_cmd_run(AM_HAL_IOM_READ, ui32Module, ui32ChipSelect,
ui32NumBytes, ui32Options);
-
- am_hal_debug_assert_msg(ui32Status == 1,"IOM CMDCMP was not seen");
-
+
return ui32Status;
}
@@ -2097,10 +2747,10 @@ am_hal_iom_spi_cmd_run(uint32_t ui32Operation, uint32_t ui32Module,
//! last word with bytes of any value. The IOM hardware will only read the
//! first \e ui32NumBytes in the \e pui32Data array.
//!
-//! @return None.
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution.
//
//*****************************************************************************
-uint32_t
+am_hal_iom_status_e
am_hal_iom_i2c_write_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options)
@@ -2109,17 +2759,29 @@ am_hal_iom_i2c_write_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
uint32_t ui32SpaceInFifo;
uint32_t ui32IntConfig;
uint32_t ui32MaxFifoSize;
- uint32_t ui32Status = 1;
+ am_hal_iom_status_e ui32Status;
+ uint32_t waitStatus;
+ am_hal_i2c_bit_bang_enum_e i2cBBStatus;
//
// Validate parameters
//
if ( ui32Module > AM_REG_IOMSTR_NUM_MODULES )
{
- return 0;
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ //
+ // Wait until any earlier transactions have completed.
+ //
+ am_hal_iom_poll_complete(ui32Module);
+
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
}
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
//
// Redirect to the bit-bang interface if the module number matches the
@@ -2129,13 +2791,13 @@ am_hal_iom_i2c_write_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
{
if ( ui32Options & AM_HAL_IOM_RAW )
{
- am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
+ i2cBBStatus = am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
(uint8_t *)pui32Data, 0, false,
(ui32Options & AM_HAL_IOM_NO_STOP));
}
else
{
- am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
+ i2cBBStatus = am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
(uint8_t *)pui32Data,
((ui32Options & 0xFF00) >> 8),
true,
@@ -2143,34 +2805,32 @@ am_hal_iom_i2c_write_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
}
//
- // Return.
+ // Return. convert BB retCode to proper retCode here
//
- return 0;
+ g_iom_error_status[ui32Module] = ui32Status = i2c_bb_errmap[i2cBBStatus];
+ return ui32Status;
}
//
// Make sure the transfer isn't too long for the hardware to support.
//
- am_hal_debug_assert_msg(ui32NumBytes < 256, "I2C transfer too big.");
+ if (ui32NumBytes >= 256)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
ui32MaxFifoSize = ((0 == AM_BFRn(IOMSTR, ui32Module, CFG, FULLDUP)) ?
AM_HAL_IOM_MAX_FIFO_SIZE : AM_HAL_IOM_MAX_FIFO_SIZE / 2);
//
- // Wait until any earlier transactions have completed.
- //
- am_hal_iom_poll_complete(ui32Module);
-
- //
// Disable interrupts so that we don't get any undesired interrupts.
//
ui32IntConfig = AM_REGn(IOMSTR, ui32Module, INTEN);
AM_REGn(IOMSTR, ui32Module, INTEN) = 0;
- //
- // Clear CMDCMP status
- //
- AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
//
// Figure out how many bytes we can write to the FIFO immediately.
@@ -2183,9 +2843,20 @@ am_hal_iom_i2c_write_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
//
// Start the write on the bus.
//
- am_hal_iom_i2c_cmd_run(AM_HAL_IOM_WRITE, ui32Module, ui32BusAddress,
+ ui32Status = am_hal_iom_i2c_cmd_run(AM_HAL_IOM_WRITE, ui32Module, ui32BusAddress,
ui32NumBytes, ui32Options);
+ if (ui32Status != AM_HAL_IOM_SUCCESS)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = ui32Status;
+ //
+ // Re-enable IOM interrupts.
+ //
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
+ AM_REGn(IOMSTR, ui32Module, INTEN) = ui32IntConfig;
+ return ui32Status;
+ }
//
// Update the pointer and data counter.
//
@@ -2234,21 +2905,25 @@ am_hal_iom_i2c_write_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
//
// Make sure CMDCMP was raised,
//
- ui32Status = am_util_wait_status_change(ui32StatusTimeout[ui32Module],
- AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
- AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
+ waitStatus = am_hal_flash_delay_status_change(ui32StatusTimeout[ui32Module],
+ AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
+ AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
+
+ if (waitStatus != 1)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_TIMEOUT;
+ }
+ else
+ {
+ g_iom_error_status[ui32Module] = ui32Status = internal_iom_get_int_err(ui32Module, 0);
+ }
//
- // Re-enable IOM interrupts. Make sure CMDCMP is cleared
+ // Re-enable IOM interrupts.
//
- AM_REGn(IOMSTR, ui32Module, INTCLR) = (ui32IntConfig | AM_REG_IOMSTR_INTSTAT_CMDCMP_M);
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
AM_REGn(IOMSTR, ui32Module, INTEN) = ui32IntConfig;
-
- am_hal_debug_assert_msg(ui32Status == 1,"IOM CMDCMP was not seen");
-
- //
- // Return the status (0 = timeout; 1 = success)
- //
return ui32Status;
}
@@ -2273,10 +2948,10 @@ am_hal_iom_i2c_write_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
//! into 32-bit words, which are then placed into the \e pui32Data array. Only
//! the first \e ui32NumBytes bytes in this array will contain valid data.
//!
-//! @return None.
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution.
//
//*****************************************************************************
-uint32_t
+am_hal_iom_status_e
am_hal_iom_i2c_read_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options)
@@ -2284,17 +2959,29 @@ am_hal_iom_i2c_read_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
uint32_t ui32BytesInFifo;
uint32_t ui32IntConfig;
uint32_t bCmdCmp = false;
- uint32_t ui32Status = 1;
+ am_hal_iom_status_e ui32Status;
+ uint32_t waitStatus;
+ am_hal_i2c_bit_bang_enum_e i2cBBStatus;
//
// Validate parameters
//
if ( ui32Module > AM_REG_IOMSTR_NUM_MODULES )
{
- return 0;
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ //
+ // Wait until the bus is idle
+ //
+ am_hal_iom_poll_complete(ui32Module);
+
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
}
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
//
// Redirect to the bit-bang interface if the module number matches the
@@ -2304,13 +2991,13 @@ am_hal_iom_i2c_read_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
{
if ( ui32Options & AM_HAL_IOM_RAW )
{
- am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
+ i2cBBStatus = am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
(uint8_t *)pui32Data, 0, false,
(ui32Options & AM_HAL_IOM_NO_STOP));
}
else
{
- am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
+ i2cBBStatus = am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
(uint8_t *)pui32Data,
((ui32Options & 0xFF00) >> 8),
true,
@@ -2318,20 +3005,20 @@ am_hal_iom_i2c_read_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
}
//
- // Return.
+ // Return. convert i2c bb retCode
//
- return 0;
+ g_iom_error_status[ui32Module] = ui32Status = i2c_bb_errmap[i2cBBStatus];
+ return ui32Status;
}
//
// Make sure the transfer isn't too long for the hardware to support.
//
- am_hal_debug_assert_msg(ui32NumBytes < 256, "I2C transfer too big.");
-
- //
- // Wait until the bus is idle
- //
- am_hal_iom_poll_complete(ui32Module);
+ if (ui32NumBytes >= 256)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
//
// Disable interrupts so that we don't get any undesired interrupts.
@@ -2339,14 +3026,24 @@ am_hal_iom_i2c_read_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
ui32IntConfig = AM_REGn(IOMSTR, ui32Module, INTEN);
AM_REGn(IOMSTR, ui32Module, INTEN) = 0;
- //
- // Clear CMDCMP status
- //
- AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
- am_hal_iom_i2c_cmd_run(AM_HAL_IOM_READ, ui32Module, ui32BusAddress,
+ ui32Status = am_hal_iom_i2c_cmd_run(AM_HAL_IOM_READ, ui32Module, ui32BusAddress,
ui32NumBytes, ui32Options);
+ if (ui32Status != AM_HAL_IOM_SUCCESS)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = ui32Status;
+ //
+ // Re-enable IOM interrupts.
+ //
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
+ AM_REGn(IOMSTR, ui32Module, INTEN) = ui32IntConfig;
+ return ui32Status;
+ }
+
//
// Start a loop to catch the Rx data.
//
@@ -2387,21 +3084,24 @@ am_hal_iom_i2c_read_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
//
// Make sure CMDCMP was raised,
//
- ui32Status = am_util_wait_status_change(ui32StatusTimeout[ui32Module],
- AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
- AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
+ waitStatus = am_hal_flash_delay_status_change(ui32StatusTimeout[ui32Module],
+ AM_REG_IOMSTRn(ui32Module) + AM_REG_IOMSTR_INTSTAT_O,
+ AM_REG_IOMSTR_INTEN_CMDCMP_M, AM_REG_IOMSTR_INTEN_CMDCMP_M);
+ if (waitStatus != 1)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_TIMEOUT;
+ }
+ else
+ {
+ g_iom_error_status[ui32Module] = ui32Status = internal_iom_get_int_err(ui32Module, 0);
+ }
//
- // Re-enable IOM interrupts. Make sure CMDCMP is cleared
+ // Re-enable IOM interrupts.
//
- AM_REGn(IOMSTR, ui32Module, INTCLR) = (ui32IntConfig | AM_REG_IOMSTR_INTSTAT_CMDCMP_M);
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
AM_REGn(IOMSTR, ui32Module, INTEN) = ui32IntConfig;
-
- am_hal_debug_assert_msg(ui32Status == 1,"IOM CMDCMP was not seen");
-
- //
- // Return the status (0 = timeout; 1 = success)
- //
return ui32Status;
}
@@ -2420,23 +3120,35 @@ am_hal_iom_i2c_read_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
//! See the "Command Options" section for parameters that may be ORed together
//! and used in the \b ui32Options parameter.
//!
-//! @return None.
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution.
//
//*****************************************************************************
-void
+am_hal_iom_status_e
am_hal_iom_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options)
{
+ am_hal_iom_status_e ui32Status;
+ am_hal_i2c_bit_bang_enum_e i2cBBStatus;
//
// Validate parameters
//
if ( ui32Module > AM_REG_IOMSTR_NUM_MODULES )
{
- return;
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ //
+ // Wait until the bus is idle
+ //
+ am_hal_iom_poll_complete(ui32Module);
+
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
}
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
//
// Redirect to the bit-bang interface if the module number matches the
@@ -2446,13 +3158,13 @@ am_hal_iom_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
{
if ( ui32Options & AM_HAL_IOM_RAW )
{
- am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
+ i2cBBStatus = am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
(uint8_t *)pui32Data, 0, false,
(ui32Options & AM_HAL_IOM_NO_STOP));
}
else
{
- am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
+ i2cBBStatus = am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
(uint8_t *)pui32Data,
((ui32Options & 0xFF00) >> 8),
true,
@@ -2460,15 +3172,20 @@ am_hal_iom_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
}
//
- // Return.
+ // Return. convert i2c bb retCode
//
- return;
+ g_iom_error_status[ui32Module] = ui32Status = i2c_bb_errmap[i2cBBStatus];
+ return ui32Status;
}
//
// Make sure the transfer isn't too long for the hardware to support.
//
- am_hal_debug_assert_msg(ui32NumBytes < 256, "I2C transfer too big.");
+ if (ui32NumBytes >= 256)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
//
// Check to see if queues have been enabled. If they are, we'll actually
@@ -2479,27 +3196,32 @@ am_hal_iom_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
//
// If the queue is on, go ahead and add this transaction to the queue.
//
- am_hal_iom_queue_i2c_write(ui32Module, ui32BusAddress, pui32Data,
+ ui32Status = am_hal_iom_queue_i2c_write(ui32Module, ui32BusAddress, pui32Data,
ui32NumBytes, ui32Options, 0);
- //
- // Wait until the transaction actually clears.
- //
- am_hal_iom_queue_flush(ui32Module);
+ if (ui32Status == AM_HAL_IOM_SUCCESS)
+ {
+ //
+ // Wait until the transaction actually clears.
+ //
+ am_hal_iom_queue_flush(ui32Module);
+ // g_iom_error_status gets set in the isr handling
+ ui32Status = g_iom_error_status[ui32Module];
+ }
//
// At this point, we've completed the transaction, and we can return.
//
- return;
}
else
{
//
// Otherwise, we'll just do a polled transaction.
//
- am_hal_iom_i2c_write_nq(ui32Module, ui32BusAddress, pui32Data,
+ ui32Status = am_hal_iom_i2c_write_nq(ui32Module, ui32BusAddress, pui32Data,
ui32NumBytes, ui32Options);
}
+ return ui32Status;
}
//*****************************************************************************
@@ -2530,23 +3252,35 @@ am_hal_iom_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
//! into 32-bit words, which are then placed into the \e pui32Data array. Only
//! the first \e ui32NumBytes bytes in this array will contain valid data.
//!
-//! @return None.
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution.
//
//*****************************************************************************
-void
+am_hal_iom_status_e
am_hal_iom_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options)
{
+ am_hal_iom_status_e ui32Status;
+ am_hal_i2c_bit_bang_enum_e i2cBBStatus;
//
// Validate parameters
//
if ( ui32Module > AM_REG_IOMSTR_NUM_MODULES )
{
- return;
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ //
+ // Wait until the bus is idle
+ //
+ am_hal_iom_poll_complete(ui32Module);
+
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
}
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
//
// Redirect to the bit-bang interface if the module number matches the
@@ -2556,13 +3290,13 @@ am_hal_iom_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
{
if ( ui32Options & AM_HAL_IOM_RAW )
{
- am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
+ i2cBBStatus = am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
(uint8_t *)pui32Data, 0, false,
(ui32Options & AM_HAL_IOM_NO_STOP));
}
else
{
- am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
+ i2cBBStatus = am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
(uint8_t *)pui32Data,
((ui32Options & 0xFF00) >> 8),
true,
@@ -2570,15 +3304,20 @@ am_hal_iom_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
}
//
- // Return.
+ // Return. convert i2c bb retCode
//
- return;
+ g_iom_error_status[ui32Module] = ui32Status = i2c_bb_errmap[i2cBBStatus];
+ return ui32Status;
}
//
// Make sure the transfer isn't too long for the hardware to support.
//
- am_hal_debug_assert_msg(ui32NumBytes < 256, "I2C transfer too big.");
+ if (ui32NumBytes >= 256)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
//
// Check to see if queues have been enabled. If they are, we'll actually
@@ -2589,27 +3328,32 @@ am_hal_iom_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
//
// If the queue is on, go ahead and add this transaction to the queue.
//
- am_hal_iom_queue_i2c_read(ui32Module, ui32BusAddress, pui32Data,
+ ui32Status = am_hal_iom_queue_i2c_read(ui32Module, ui32BusAddress, pui32Data,
ui32NumBytes, ui32Options, 0);
- //
- // Wait until the transaction actually clears.
- //
- am_hal_iom_queue_flush(ui32Module);
+ if (ui32Status == AM_HAL_IOM_SUCCESS)
+ {
+ //
+ // Wait until the transaction actually clears.
+ //
+ am_hal_iom_queue_flush(ui32Module);
+ // g_iom_error_status gets set in the isr handling
+ ui32Status = g_iom_error_status[ui32Module];
+ }
//
// At this point, we've completed the transaction, and we can return.
//
- return;
}
else
{
//
// Otherwise, just perform a polled transaction.
//
- am_hal_iom_i2c_read_nq(ui32Module, ui32BusAddress, pui32Data,
+ ui32Status = am_hal_iom_i2c_read_nq(ui32Module, ui32BusAddress, pui32Data,
ui32NumBytes, ui32Options);
}
+ return ui32Status;
}
//*****************************************************************************
@@ -2642,27 +3386,42 @@ am_hal_iom_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
//! last word with bytes of any value. The IOM hardware will only read the
//! first \e ui32NumBytes in the \e pui32Data array.
//!
-//! @return None.
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution. Note that
+//! successful execution for non-blocking call only means the transaction was
+//! successfully initiated. The status of the transaction is not known till the
+//! callback is called on completion
//
//*****************************************************************************
-void
+am_hal_iom_status_e
am_hal_iom_i2c_write_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options,
am_hal_iom_callback_t pfnCallback)
{
+ am_hal_iom_status_e ui32Status;
uint32_t ui32TransferSize;
uint32_t ui32MaxFifoSize;
+ am_hal_i2c_bit_bang_enum_e i2cBBStatus;
//
// Validate parameters
//
if ( ui32Module > AM_REG_IOMSTR_NUM_MODULES )
{
- return;
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ //
+ // Wait until the bus is idle
+ //
+ am_hal_iom_poll_complete(ui32Module);
+
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
}
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
//
// Redirect to the bit-bang interface if the module number matches the
@@ -2670,15 +3429,17 @@ am_hal_iom_i2c_write_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
//
if ( ui32Module == AM_HAL_IOM_I2CBB_MODULE )
{
+ // Reset the error status for non-blocking transfer
+ g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
if ( ui32Options & AM_HAL_IOM_RAW )
{
- am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
+ i2cBBStatus = am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
(uint8_t *)pui32Data, 0, false,
(ui32Options & AM_HAL_IOM_NO_STOP));
}
else
{
- am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
+ i2cBBStatus = am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
(uint8_t *)pui32Data,
((ui32Options & 0xFF00) >> 8),
true,
@@ -2686,6 +3447,10 @@ am_hal_iom_i2c_write_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
}
//
+ // Return. convert i2c bb retCode
+ //
+ g_iom_error_status[ui32Module] = ui32Status = i2c_bb_errmap[i2cBBStatus];
+ //
// The I2C bit-bang interface is actually a blocking transfer, and it
// doesn't trigger the interrupt handler, so we have to call the
// callback function manually.
@@ -2694,16 +3459,17 @@ am_hal_iom_i2c_write_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
{
pfnCallback();
}
- //
- // Return.
- //
- return;
+ return ui32Status;
}
//
// Make sure the transfer isn't too long for the hardware to support.
//
- am_hal_debug_assert_msg(ui32NumBytes < 256, "I2C transfer too big.");
+ if (ui32NumBytes >= 256)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
ui32MaxFifoSize = ((0 == AM_BFRn(IOMSTR, ui32Module, CFG, FULLDUP)) ?
AM_HAL_IOM_MAX_FIFO_SIZE : AM_HAL_IOM_MAX_FIFO_SIZE / 2);
@@ -2714,21 +3480,13 @@ am_hal_iom_i2c_write_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
ui32TransferSize = (ui32NumBytes <= ui32MaxFifoSize ? ui32NumBytes :
ui32MaxFifoSize);
- //
- // Wait until any earlier transactions have completed, and then write our
- // first word to the fifo.
- //
- am_hal_iom_poll_complete(ui32Module);
-
// Need to mark IOM busy to avoid another transaction to be scheduled.
// This is to take care of a race condition in Queue mode, where the IDLE
// set is not a guarantee that the CMDCMP has been received
g_bIomBusy[ui32Module] = true;
- //
- // Clear CMDCMP status
- //
- AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
if ( am_hal_iom_fifo_write(ui32Module, pui32Data, ui32TransferSize) > 0 )
{
@@ -2750,9 +3508,14 @@ am_hal_iom_i2c_write_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
//
// Start the write on the bus.
//
- am_hal_iom_i2c_cmd_run(AM_HAL_IOM_WRITE, ui32Module, ui32BusAddress,
+ ui32Status = am_hal_iom_i2c_cmd_run(AM_HAL_IOM_WRITE, ui32Module, ui32BusAddress,
ui32NumBytes, ui32Options);
+ if (ui32Status != AM_HAL_IOM_SUCCESS)
+ {
+ g_iom_error_status[ui32Module] = ui32Status;
+ }
}
+ return ui32Status;
}
//*****************************************************************************
@@ -2782,24 +3545,39 @@ am_hal_iom_i2c_write_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
//! into 32-bit words, which are then placed into the \e pui32Data array. Only
//! the first \e ui32NumBytes bytes in this array will contain valid data.
//!
-//! @return None.
+//! @return returns AM_HAL_IOM_SUCCESS on successful execution. Note that
+//! successful execution for non-blocking call only means the transaction was
+//! successfully initiated. The status of the transaction is not known till the
+//! callback is called on completion
//
//*****************************************************************************
-void
+am_hal_iom_status_e
am_hal_iom_i2c_read_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options,
am_hal_iom_callback_t pfnCallback)
{
+ am_hal_iom_status_e ui32Status;
+ am_hal_i2c_bit_bang_enum_e i2cBBStatus;
//
// Validate parameters
//
if ( ui32Module > AM_REG_IOMSTR_NUM_MODULES )
{
- return;
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ //
+ // Wait until the bus is idle
+ //
+ am_hal_iom_poll_complete(ui32Module);
+
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if (ui32NumBytes == 0)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
}
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
//
// Redirect to the bit-bang interface if the module number matches the
@@ -2807,15 +3585,17 @@ am_hal_iom_i2c_read_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
//
if ( ui32Module == AM_HAL_IOM_I2CBB_MODULE )
{
+ // Reset the error status for non-blocking transfer
+ g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
if ( ui32Options & AM_HAL_IOM_RAW )
{
- am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
+ i2cBBStatus = am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
(uint8_t *)pui32Data, 0, false,
(ui32Options & AM_HAL_IOM_NO_STOP));
}
else
{
- am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
+ i2cBBStatus = am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
(uint8_t *)pui32Data,
((ui32Options & 0xFF00) >> 8),
true,
@@ -2823,6 +3603,10 @@ am_hal_iom_i2c_read_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
}
//
+ // Return. convert i2c bb retCode
+ //
+ g_iom_error_status[ui32Module] = ui32Status = i2c_bb_errmap[i2cBBStatus];
+ //
// The I2C bit-bang interface is actually a blocking transfer, and it
// doesn't trigger the interrupt handler, so we have to call the
// callback function manually.
@@ -2832,33 +3616,26 @@ am_hal_iom_i2c_read_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
pfnCallback();
}
- //
- // Return.
- //
- return;
+ return ui32Status;
}
//
// Make sure the transfer isn't too long for the hardware to support.
//
- am_hal_debug_assert_msg(ui32NumBytes < 256, "I2C transfer too big.");
-
- //
- // Wait until the bus is idle
- //
- am_hal_iom_poll_complete(ui32Module);
+ if (ui32NumBytes >= 256)
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
+ }
- //
// Need to mark IOM busy to avoid another transaction to be scheduled.
// This is to take care of a race condition in Queue mode, where the IDLE
// set is not a guarantee that the CMDCMP has been received
//
g_bIomBusy[ui32Module] = true;
- //
- // Clear CMDCMP status
- //
- AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+ // Clear interrupts
+ AM_REGn(IOMSTR, ui32Module, INTCLR) = AM_HAL_IOM_INT_ALL;
//
// Prepare the global IOM buffer structure.
@@ -2871,8 +3648,13 @@ am_hal_iom_i2c_read_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
//
// Start the read transaction on the bus.
//
- am_hal_iom_i2c_cmd_run(AM_HAL_IOM_READ, ui32Module, ui32BusAddress,
+ ui32Status = am_hal_iom_i2c_cmd_run(AM_HAL_IOM_READ, ui32Module, ui32BusAddress,
ui32NumBytes, ui32Options);
+ if (ui32Status != AM_HAL_IOM_SUCCESS)
+ {
+ g_iom_error_status[ui32Module] = ui32Status;
+ }
+ return ui32Status;
}
//*****************************************************************************
@@ -2887,28 +3669,32 @@ am_hal_iom_i2c_read_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
//! @param ui32Options - Additional I2C options to apply to this command.
//!
//! This function may be used along with am_hal_iom_fifo_write and
-//! am_hal_iom_fifo_read to perform more complex I2C reads and writes. This
-//! function
+//! am_hal_iom_fifo_read to perform more complex I2C reads and writes.
+//! This function has additional logic to make sure SCL is high before a new
+//! transaction is initiated.
//!
-//! @return None.
+//! @return 0 on success
//
//*****************************************************************************
-void
+am_hal_iom_status_e
am_hal_iom_i2c_cmd_run(uint32_t ui32Operation, uint32_t ui32Module,
uint32_t ui32BusAddress, uint32_t ui32NumBytes,
uint32_t ui32Options)
{
uint32_t ui32Command;
+ am_hal_iom_status_e ui32Status = AM_HAL_IOM_SUCCESS;
//
// Validate parameters
//
if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
{
- return;
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ if (ui32NumBytes == 0)
+ {
+ return AM_HAL_IOM_ERR_INVALID_PARAM;
}
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
//
// Start building the command from the operation parameter.
@@ -2933,9 +3719,20 @@ am_hal_iom_i2c_cmd_run(uint32_t ui32Operation, uint32_t ui32Module,
ui32Command |= (ui32Options & 0x5C00FF00);
//
- // Write the complete command word to the IOM command register.
+ // Wait for SCL to be high before initiating a new transaction
+ // This is to ensure clock hi time specs are not violated in case slave did
+ // clock stretching in previous transaction
//
- AM_REGn(IOMSTR, ui32Module, CMD) = ui32Command;
+ ui32Status = internal_iom_wait_i2c_scl_hi(ui32Module);
+
+ if (ui32Status == AM_HAL_IOM_SUCCESS)
+ {
+ //
+ // Write the complete command word to the IOM command register.
+ //
+ AM_REGn(IOMSTR, ui32Module, CMD) = ui32Command;
+ }
+ return ui32Status;
}
//*****************************************************************************
@@ -3099,9 +3896,13 @@ am_hal_iom_fifo_read(uint32_t ui32Module, uint32_t *pui32Data,
//
// Make sure we check the number of bytes we're reading from the FIFO.
+ // This doesn't make sense for Full-Duplex operations.
//
- am_hal_debug_assert_msg((am_hal_iom_fifo_full_slots(ui32Module) >= ui32NumBytes),
+ if ( AM_REG_IOMSTR_CFG_FULLDUP_NORMAL == (AM_REGn(IOMSTR, ui32Module, CFG) & AM_REG_IOMSTR_CFG_FULLDUP_M) )
+ {
+ am_hal_debug_assert_msg((am_hal_iom_fifo_full_slots(ui32Module) >= ui32NumBytes),
"The fifo doesn't contain the requested number of bytes.");
+ }
//
// Figure out how many whole words we're reading from the fifo, and how
@@ -3270,35 +4071,20 @@ am_hal_iom_status_get(uint32_t ui32Module)
//! @param ui32Module IOM instance to check the status of.
//!
//! This function returns status indicating whether the IOM has incurred any
-//! errors or not.
+//! errors or not for previous operation.
+//! This function can be called when the callback is invoked to determine the
+//! status of the transaction just completed.
+//! This function can also be called after a blocking call, though it would
+//! return the same status as returned from the call itself
+//! This function should not be called for an ongoing transaction, and the
+//! result of such operation is indeterministic
//!
-//! @return 0 if all is well.
-//! Otherwise error status as a bitmask of:
-//! AM_HAL_IOM_ERR_INVALID_MODULE
-//! AM_HAL_IOM_INT_ARB Another master initiated an operation
-//! simultaenously and the IOM lost. Or
-//! the IOM started an operation but found
-//! SDA already low.
-//! AM_HAL_IOM_INT_START A START from another master detected.
-//! SW must wait for STOP before continuing.
-//! AM_HAL_IOM_INT_ICMD Attempt to issue a CMD while another
-//! CMD was already in progress, or issue a
-//! non-zero-len write CMD with empty FIFO.
-//! AM_HAL_IOM_INT_IACC Attempt to read the FIFO on a write. Or
-//! an attempt to write the FIFO on a read.
-//! AM_HAL_IOM_INT_NAK Expected ACK from slave not received.
-//! AM_HAL_IOM_INT_FOVFL Attempt to write the FIFO while full
-//! (FIFOSIZ > 124).
-//! AM_HAL_IOM_INT_FUNDFL Attempt to read FIFO when empty (that is
-//! FIFOSIZ < 4).
-//! Note - see the datasheet text for full explanations of the INT errs.
+//! @return AM_HAL_IOM_SUCCESS if all is well.
//
//*****************************************************************************
-uint32_t
+am_hal_iom_status_e
am_hal_iom_error_status_get(uint32_t ui32Module)
{
- uint32_t ui32intstat = 0;
-
//
// Validate parameters
//
@@ -3310,27 +4096,7 @@ am_hal_iom_error_status_get(uint32_t ui32Module)
return AM_HAL_IOM_ERR_INVALID_MODULE;
}
- if ( AM_REGn(IOMSTR, ui32Module, STATUS) & AM_REG_IOMSTR_STATUS_ERR_ERROR )
- {
- //
- // The IOM is currently indicating an error condition.
- // Let's figure out what is going on.
- //
- ui32intstat = AM_REGn(IOMSTR, ui32Module, INTSTAT);
-
- //
- // Filter out non-error bits.
- //
- ui32intstat &= AM_REG_IOMSTR_INTSTAT_ARB_M |
- AM_REG_IOMSTR_INTSTAT_START_M |
- AM_REG_IOMSTR_INTSTAT_ICMD_M |
- AM_REG_IOMSTR_INTSTAT_IACC_M |
- AM_REG_IOMSTR_INTSTAT_NAK_M |
- AM_REG_IOMSTR_INTSTAT_FOVFL_M |
- AM_REG_IOMSTR_INTSTAT_FUNDFL_M;
- }
-
- return ui32intstat;
+ return (g_iom_error_status[ui32Module]);
}
//*****************************************************************************
@@ -3366,6 +4132,9 @@ am_hal_iom_int_service(uint32_t ui32Module, uint32_t ui32Status)
//
psBuffer = &g_psIOMBuffers[ui32Module];
+ // Keep accumulating any error indications
+ // This is to account for the case if the error indication comes before CMDCMP
+ g_iom_error_status[ui32Module] |= ui32Status;
//
// Figure out what type of interrupt this was.
//
@@ -3404,6 +4173,7 @@ am_hal_iom_int_service(uint32_t ui32Module, uint32_t ui32Status)
//
psBuffer->ui32State = BUFFER_IDLE;
+ g_iom_error_status[ui32Module] = internal_iom_get_int_err(ui32Module, g_iom_error_status[ui32Module]);
//
// If we have a callback, call it now.
//
@@ -3621,7 +4391,7 @@ am_hal_iom_queue_length_get(uint32_t ui32Module)
void
am_hal_iom_queue_start_next_msg(uint32_t ui32Module)
{
- am_hal_iom_queue_entry_t sIOMTransaction = {0};
+ am_hal_iom_queue_entry_t sIOMTransaction = {0};
uint32_t ui32ChipSelect;
uint32_t *pui32Data;
@@ -3629,6 +4399,7 @@ am_hal_iom_queue_start_next_msg(uint32_t ui32Module)
uint32_t ui32Options;
am_hal_iom_callback_t pfnCallback;
+ am_hal_iom_status_e ui32Status = AM_HAL_IOM_SUCCESS;
uint32_t ui32Critical;
//
@@ -3665,22 +4436,22 @@ am_hal_iom_queue_start_next_msg(uint32_t ui32Module)
switch ( sIOMTransaction.ui32Operation )
{
case AM_HAL_IOM_QUEUE_SPI_WRITE:
- am_hal_iom_spi_write_nb(ui32Module, ui32ChipSelect, pui32Data,
+ ui32Status = am_hal_iom_spi_write_nb(ui32Module, ui32ChipSelect, pui32Data,
ui32NumBytes, ui32Options, pfnCallback);
break;
case AM_HAL_IOM_QUEUE_SPI_READ:
- am_hal_iom_spi_read_nb(ui32Module, ui32ChipSelect, pui32Data,
+ ui32Status = am_hal_iom_spi_read_nb(ui32Module, ui32ChipSelect, pui32Data,
ui32NumBytes, ui32Options, pfnCallback);
break;
case AM_HAL_IOM_QUEUE_I2C_WRITE:
- am_hal_iom_i2c_write_nb(ui32Module, ui32ChipSelect, pui32Data,
+ ui32Status = am_hal_iom_i2c_write_nb(ui32Module, ui32ChipSelect, pui32Data,
ui32NumBytes, ui32Options, pfnCallback);
break;
case AM_HAL_IOM_QUEUE_I2C_READ:
- am_hal_iom_i2c_read_nb(ui32Module, ui32ChipSelect, pui32Data,
+ ui32Status = am_hal_iom_i2c_read_nb(ui32Module, ui32ChipSelect, pui32Data,
ui32NumBytes, ui32Options, pfnCallback);
break;
}
@@ -3690,6 +4461,14 @@ am_hal_iom_queue_start_next_msg(uint32_t ui32Module)
// Exit the critical section.
//
am_hal_interrupt_master_set(ui32Critical);
+
+ if (ui32Status != AM_HAL_IOM_SUCCESS)
+ {
+ // Preserve the error
+ g_iom_error_status[ui32Module] = ui32Status;
+ // Call the respective callback
+ pfnCallback();
+ }
}
//*****************************************************************************
@@ -3726,22 +4505,28 @@ am_hal_iom_queue_start_next_msg(uint32_t ui32Module)
//! first \e ui32NumBytes in the \e pui8Data array.
//
//*****************************************************************************
-void
+am_hal_iom_status_e
am_hal_iom_queue_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options, am_hal_iom_callback_t pfnCallback)
{
uint32_t ui32Critical;
+ am_hal_iom_status_e ui32Status;
//
// Validate parameters
//
if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
{
- return;
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if ( ui32NumBytes == 0 )
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
}
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
//
// Start a critical section.
@@ -3761,7 +4546,7 @@ am_hal_iom_queue_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
//
// Send the packet.
//
- am_hal_iom_spi_write_nb(ui32Module, ui32ChipSelect, pui32Data,
+ ui32Status = am_hal_iom_spi_write_nb(ui32Module, ui32ChipSelect, pui32Data,
ui32NumBytes, ui32Options, pfnCallback);
}
else
@@ -3787,17 +4572,19 @@ am_hal_iom_queue_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
//
// Didn't have enough memory.
//
- am_hal_debug_assert_msg(0,
- "The IOM queue is full. Allocate more"
- "memory to the IOM queue, or allow it more"
- "time to empty between transactions.");
+ ui32Status = AM_HAL_IOM_ERR_RESOURCE_ERR;
}
}
+ if (ui32Status != AM_HAL_IOM_SUCCESS)
+ {
+ g_iom_error_status[ui32Module] = ui32Status;
+ }
//
// Exit the critical section.
//
am_hal_interrupt_master_set(ui32Critical);
+ return ui32Status;
}
//*****************************************************************************
@@ -3834,22 +4621,28 @@ am_hal_iom_queue_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
//! first \e ui32NumBytes in the \e pui8Data array.
//
//*****************************************************************************
-void
+am_hal_iom_status_e
am_hal_iom_queue_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options, am_hal_iom_callback_t pfnCallback)
{
uint32_t ui32Critical;
+ am_hal_iom_status_e ui32Status;
//
// Validate parameters
//
if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
{
- return;
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if ( ui32NumBytes == 0 )
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
}
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
// Start a critical section.
//
@@ -3868,7 +4661,7 @@ am_hal_iom_queue_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
//
// Send the packet.
//
- am_hal_iom_spi_read_nb(ui32Module, ui32ChipSelect, pui32Data,
+ ui32Status = am_hal_iom_spi_read_nb(ui32Module, ui32ChipSelect, pui32Data,
ui32NumBytes, ui32Options, pfnCallback);
}
else
@@ -3894,17 +4687,19 @@ am_hal_iom_queue_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
//
// Didn't have enough memory.
//
- am_hal_debug_assert_msg(0,
- "The IOM queue is full. Allocate more"
- "memory to the IOM queue, or allow it more"
- "time to empty between transactions.");
+ ui32Status = AM_HAL_IOM_ERR_RESOURCE_ERR;
}
}
+ if (ui32Status != AM_HAL_IOM_SUCCESS)
+ {
+ g_iom_error_status[ui32Module] = ui32Status;
+ }
//
// Exit the critical section.
//
am_hal_interrupt_master_set(ui32Critical);
+ return ui32Status;
}
//*****************************************************************************
@@ -3941,11 +4736,12 @@ am_hal_iom_queue_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
//! first \e ui32NumBytes in the \e pui8Data array.
//
//*****************************************************************************
-void
+am_hal_iom_status_e
am_hal_iom_queue_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options, am_hal_iom_callback_t pfnCallback)
{
+ am_hal_iom_status_e ui32Status;
uint32_t ui32Critical;
//
@@ -3953,10 +4749,15 @@ am_hal_iom_queue_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
//
if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
{
- return;
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if ( ui32NumBytes == 0 )
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
}
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
//
// Start a critical section.
@@ -3976,7 +4777,7 @@ am_hal_iom_queue_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
//
// Send the packet.
//
- am_hal_iom_i2c_write_nb(ui32Module, ui32BusAddress, pui32Data,
+ ui32Status = am_hal_iom_i2c_write_nb(ui32Module, ui32BusAddress, pui32Data,
ui32NumBytes, ui32Options, pfnCallback);
}
else
@@ -4002,17 +4803,19 @@ am_hal_iom_queue_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
//
// Didn't have enough memory.
//
- am_hal_debug_assert_msg(0,
- "The IOM queue is full. Allocate more"
- "memory to the IOM queue, or allow it more"
- "time to empty between transactions.");
+ ui32Status = AM_HAL_IOM_ERR_RESOURCE_ERR;
}
}
+ if (ui32Status != AM_HAL_IOM_SUCCESS)
+ {
+ g_iom_error_status[ui32Module] = ui32Status;
+ }
//
// Exit the critical section.
//
am_hal_interrupt_master_set(ui32Critical);
+ return ui32Status;
}
//*****************************************************************************
@@ -4049,22 +4852,28 @@ am_hal_iom_queue_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
//! first \e ui32NumBytes in the \e pui8Data array.
//
//*****************************************************************************
-void
+am_hal_iom_status_e
am_hal_iom_queue_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options, am_hal_iom_callback_t pfnCallback)
{
uint32_t ui32Critical;
+ am_hal_iom_status_e ui32Status;
//
// Validate parameters
//
if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
{
- return;
+ return AM_HAL_IOM_ERR_INVALID_MODULE;
+ }
+ // Reset the error status
+ ui32Status = g_iom_error_status[ui32Module] = AM_HAL_IOM_SUCCESS;
+ if ( ui32NumBytes == 0 )
+ {
+ g_iom_error_status[ui32Module] = ui32Status = AM_HAL_IOM_ERR_INVALID_PARAM;
+ return ui32Status;
}
- am_hal_debug_assert_msg(ui32NumBytes > 0,
- "Trying to do a 0 byte transaction");
//
// Start a critical section.
@@ -4084,7 +4893,7 @@ am_hal_iom_queue_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
//
// Send the packet.
//
- am_hal_iom_i2c_read_nb(ui32Module, ui32BusAddress, pui32Data,
+ ui32Status = am_hal_iom_i2c_read_nb(ui32Module, ui32BusAddress, pui32Data,
ui32NumBytes, ui32Options, pfnCallback);
}
else
@@ -4110,16 +4919,19 @@ am_hal_iom_queue_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
//
// Didn't have enough memory.
//
- am_hal_debug_assert_msg(0, "The IOM queue is full. Allocate more"
- "memory to the IOM queue, or allow it more"
- "time to empty between transactions.");
+ ui32Status = AM_HAL_IOM_ERR_RESOURCE_ERR;
}
}
+ if (ui32Status != AM_HAL_IOM_SUCCESS)
+ {
+ g_iom_error_status[ui32Module] = ui32Status;
+ }
//
// Exit the critical section.
//
am_hal_interrupt_master_set(ui32Critical);
+ return ui32Status;
}
//*****************************************************************************
@@ -4222,16 +5034,17 @@ am_hal_iom_sleeping_queue_flush(uint32_t ui32Module)
//! ui32Status = am_hal_iom_int_status(0, true);
//!
//! //
+//! // Clear the interrupts. This should be done before calling service routine
+//! // as otherwise we may lose re-triggered interrupts
+//! //
+//! am_hal_iom_int_clear(ui32Status);
+//!
+//! //
//! // Fill or empty the FIFO, and either continue the current operation or
//! // start the next one in the queue. If there was a callback, it will be
//! // called here.
//! //
//! am_hal_iom_queue_service(0, ui32Status);
-//!
-//! //
-//! // Clear the interrupts before leaving the ISR.
-//! //
-//! am_hal_iom_int_clear(ui32Status);
//! }
//! @endcode
//!
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_iom.h b/bsp/apollo2/libraries/drivers/hal/am_hal_iom.h
index e5a450f15c..88cb34641e 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_iom.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_iom.h
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -79,11 +79,13 @@
#define AM_HAL_IOM_2MHZ 2000000
#define AM_HAL_IOM_1_5MHZ 1500000
#define AM_HAL_IOM_1MHZ 1000000
+#define AM_HAL_IOM_800KHZ 800000
#define AM_HAL_IOM_750KHZ 750000
#define AM_HAL_IOM_500KHZ 500000
#define AM_HAL_IOM_400KHZ 400000
#define AM_HAL_IOM_375KHZ 375000
#define AM_HAL_IOM_250KHZ 250000
+#define AM_HAL_IOM_200KHZ 200000
#define AM_HAL_IOM_125KHZ 125000
#define AM_HAL_IOM_100KHZ 100000
#define AM_HAL_IOM_50KHZ 50000
@@ -176,32 +178,69 @@
#define AM_HAL_IOM_INT_FUNDFL AM_REG_IOMSTR_INTEN_FUNDFL_M
#define AM_HAL_IOM_INT_THR AM_REG_IOMSTR_INTEN_THR_M
#define AM_HAL_IOM_INT_CMDCMP AM_REG_IOMSTR_INTEN_CMDCMP_M
+
+#define AM_HAL_IOM_INT_ALL ( \
+ AM_HAL_IOM_INT_ARB | \
+ AM_HAL_IOM_INT_STOP | \
+ AM_HAL_IOM_INT_START | \
+ AM_HAL_IOM_INT_ICMD | \
+ AM_HAL_IOM_INT_IACC | \
+ AM_HAL_IOM_INT_WTLEN | \
+ AM_HAL_IOM_INT_NAK | \
+ AM_HAL_IOM_INT_FOVFL | \
+ AM_HAL_IOM_INT_FUNDFL | \
+ AM_HAL_IOM_INT_THR | \
+ AM_HAL_IOM_INT_CMDCMP)
+
+#define AM_HAL_IOM_INT_SWERR ( \
+ AM_HAL_IOM_INT_ICMD | \
+ AM_HAL_IOM_INT_FOVFL | \
+ AM_HAL_IOM_INT_FUNDFL | \
+ AM_HAL_IOM_INT_IACC)
+
+#define AM_HAL_IOM_INT_I2CARBERR ( \
+ AM_HAL_IOM_INT_ARB | \
+ AM_HAL_IOM_INT_START | \
+ AM_HAL_IOM_INT_STOP)
//! @}
//*****************************************************************************
//
-//! @name IOM function errors
-//! @brief Return values for IOM HAL function errors, such as with the function
-//! am_hal_iom_error_status_get().
+//! @name Software IOM modules
+//! @brief Macro definitions for using the software I2C interface.
+//!
+//! Use this macro as the module number for standard IOM functions to emulate
+//! them using the bit-banged i2c interface.
//!
//! @{
//
//*****************************************************************************
-#define AM_HAL_IOM_ERR_INVALID_MODULE (1 << 30)
+#define AM_HAL_IOM_I2CBB_MODULE AM_REG_IOMSTR_NUM_MODULES
//! @}
//*****************************************************************************
//
-//! @name Software IOM modules
-//! @brief Macro definitions for using the software I2C interface.
+//! @name IOM Return Codes
+//! @brief Enum definitions for defining return values for IOM APIs
//!
-//! Use this macro as the module number for standard IOM functions to emulate
-//! them using the bit-banged i2c interface.
+//! This enum defines possible values for non-void IOM APIs
//!
//! @{
//
//*****************************************************************************
-#define AM_HAL_IOM_I2CBB_MODULE AM_REG_IOMSTR_NUM_MODULES
+typedef enum
+{
+ AM_HAL_IOM_SUCCESS = 0,
+ AM_HAL_IOM_ERR_TIMEOUT,
+ AM_HAL_IOM_ERR_INVALID_MODULE,
+ AM_HAL_IOM_ERR_INVALID_PARAM,
+ AM_HAL_IOM_ERR_INVALID_CFG,
+ AM_HAL_IOM_ERR_INVALID_OPER,
+ AM_HAL_IOM_ERR_I2C_NAK,
+ AM_HAL_IOM_ERR_I2C_ARB,
+ AM_HAL_IOM_ERR_RESOURCE_ERR,
+} am_hal_iom_status_e ;
+
//! @}
//*****************************************************************************
@@ -271,7 +310,7 @@ typedef struct
//! Select the SPI clock polarity (unused in I2C mode).
//
bool bSPOL;
-
+
//
//! @brief Select the FIFO write threshold.
//!
@@ -404,7 +443,11 @@ am_hal_iom_pwrsave_t;
//
//*****************************************************************************
extern am_hal_iom_pwrsave_t am_hal_iom_pwrsave[AM_REG_IOMSTR_NUM_MODULES];
-extern uint32_t g_iom_error_status;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
//*****************************************************************************
//
@@ -420,23 +463,30 @@ extern void am_hal_iom_config(uint32_t ui32Module,
extern uint32_t am_hal_iom_frequency_get(uint32_t ui32Module);
extern void am_hal_iom_enable(uint32_t ui32Module);
extern void am_hal_iom_disable(uint32_t ui32Module);
-extern void am_hal_iom_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options);
-extern void am_hal_iom_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options);
-extern uint32_t am_hal_iom_spi_write_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_spi_fullduplex(uint32_t ui32Module, uint32_t ui32ChipSelect,
+ uint32_t *pui32TxData, uint32_t *pui32RxData,
+ uint32_t ui32NumBytes, uint32_t ui32Options);
+
+extern am_hal_iom_status_e am_hal_iom_spi_write_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options);
-extern uint32_t am_hal_iom_spi_read_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_spi_read_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options);
-extern void am_hal_iom_spi_write_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_spi_fullduplex_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
+ uint32_t *pui32TxData, uint32_t *pui32RxData,
+ uint32_t ui32NumBytes, uint32_t ui32Options);
+extern am_hal_iom_status_e am_hal_iom_spi_write_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options,
am_hal_iom_callback_t pfnCallback);
-extern uint32_t am_hal_iom_spi_read_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_spi_read_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options,
am_hal_iom_callback_t pfnCallback);
@@ -445,39 +495,39 @@ extern void am_hal_iom_spi_cmd_run(uint32_t ui32Operation,
uint32_t ui32ChipSelect,
uint32_t ui32NumBytes,
uint32_t ui32Options);
-extern void am_hal_iom_i2c_write(uint32_t ui32Module,
+extern am_hal_iom_status_e am_hal_iom_i2c_write(uint32_t ui32Module,
uint32_t ui32BusAddress,
uint32_t *pui32Data,
uint32_t ui32NumBytes,
uint32_t ui32Options);
-extern void am_hal_iom_i2c_read(uint32_t ui32Module,
+extern am_hal_iom_status_e am_hal_iom_i2c_read(uint32_t ui32Module,
uint32_t ui32BusAddress,
uint32_t *pui32Data,
uint32_t ui32NumBytes,
uint32_t ui32Options);
-extern uint32_t am_hal_iom_i2c_write_nq(uint32_t ui32Module,
+extern am_hal_iom_status_e am_hal_iom_i2c_write_nq(uint32_t ui32Module,
uint32_t ui32BusAddress,
uint32_t *pui32Data,
uint32_t ui32NumBytes,
uint32_t ui32Options);
-extern uint32_t am_hal_iom_i2c_read_nq(uint32_t ui32Module,
+extern am_hal_iom_status_e am_hal_iom_i2c_read_nq(uint32_t ui32Module,
uint32_t ui32BusAddress,
uint32_t *pui32Data,
uint32_t ui32NumBytes,
uint32_t ui32Options);
-extern void am_hal_iom_i2c_write_nb(uint32_t ui32Module,
+extern am_hal_iom_status_e am_hal_iom_i2c_write_nb(uint32_t ui32Module,
uint32_t ui32BusAddress,
uint32_t *pui32Data,
uint32_t ui32NumBytes,
uint32_t ui32Options,
am_hal_iom_callback_t pfnCallback);
-extern void am_hal_iom_i2c_read_nb(uint32_t ui32Module,
+extern am_hal_iom_status_e am_hal_iom_i2c_read_nb(uint32_t ui32Module,
uint32_t ui32BusAddress,
uint32_t *pui32Data,
uint32_t ui32NumBytes,
uint32_t ui32Options,
am_hal_iom_callback_t pfnCallback);
-extern void am_hal_iom_i2c_cmd_run(uint32_t ui32Operation,
+extern am_hal_iom_status_e am_hal_iom_i2c_cmd_run(uint32_t ui32Operation,
uint32_t ui32Module,
uint32_t ui32BusAddress,
uint32_t ui32NumBytes,
@@ -485,7 +535,7 @@ extern void am_hal_iom_i2c_cmd_run(uint32_t ui32Operation,
extern void am_hal_iom_command_repeat_set(uint32_t ui32Module,
uint32_t ui32CmdCount);
extern uint32_t am_hal_iom_status_get(uint32_t ui32Module);
-extern uint32_t am_hal_iom_error_status_get(uint32_t ui32Module);
+extern am_hal_iom_status_e am_hal_iom_error_status_get(uint32_t ui32Module);
extern uint32_t am_hal_iom_fifo_write(uint32_t ui32Module, uint32_t *pui32Data,
uint32_t ui32NumBytes);
extern uint32_t am_hal_iom_fifo_read(uint32_t ui32Module, uint32_t *pui32Data,
@@ -505,19 +555,19 @@ extern void am_hal_iom_queue_init(uint32_t ui32ModuleNum,
uint32_t ui32QueueMemSize);
extern uint32_t am_hal_iom_queue_length_get(uint32_t ui32Module);
extern void am_hal_iom_sleeping_queue_flush(uint32_t ui32Module);
-extern void am_hal_iom_queue_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_queue_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options,
am_hal_iom_callback_t pfnCallback);
-extern void am_hal_iom_queue_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
+extern am_hal_iom_status_e am_hal_iom_queue_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options,
am_hal_iom_callback_t pfnCallback);
-extern void am_hal_iom_queue_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
+extern am_hal_iom_status_e am_hal_iom_queue_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options,
am_hal_iom_callback_t pfnCallback);
-extern void am_hal_iom_queue_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
+extern am_hal_iom_status_e am_hal_iom_queue_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
uint32_t *pui32Data, uint32_t ui32NumBytes,
uint32_t ui32Options,
am_hal_iom_callback_t pfnCallback);
@@ -533,7 +583,6 @@ extern void am_hal_iom_queue_service(uint32_t ui32Module, uint32_t ui32Statu
void am_iomaster##x##_isr(void) \
{ \
uint32_t ui32IntStatus; \
- g_iom_error_status = am_hal_iom_error_status_get(x); \
ui32IntStatus = am_hal_iom_int_status_get(x, false); \
am_hal_iom_int_clear(x, ui32IntStatus); \
am_hal_iom_queue_service(x, ui32IntStatus); \
@@ -543,12 +592,15 @@ void am_iomaster##x##_isr(void) \
void am_iomaster##x##_isr(void) \
{ \
uint32_t ui32IntStatus; \
- g_iom_error_status = am_hal_iom_error_status_get(x); \
ui32IntStatus = am_hal_iom_int_status_get(x, false); \
am_hal_iom_int_clear(x, ui32IntStatus); \
am_hal_iom_int_service(x, ui32IntStatus); \
}
+#ifdef __cplusplus
+}
+#endif
+
#endif // AM_HAL_IOM_H
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_ios.c b/bsp/apollo2/libraries/drivers/hal/am_hal_ios.c
index 0f34aa6efb..921d6eeade 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_ios.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_ios.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -61,6 +61,7 @@ typedef struct
volatile uint32_t ui32WriteIndex;
volatile uint32_t ui32ReadIndex;
volatile uint32_t ui32Length;
+ uint32_t ui32FifoInc;
uint32_t ui32Capacity;
}
am_hal_ios_buffer_t;
@@ -105,6 +106,23 @@ uint32_t g_ui32FifoBaseOffset = 0;
//*****************************************************************************
//
+// Checks to see if this processor is a Rev B2 device.
+//
+// This is needed to disable SHELBY-1654 workaround.
+//
+//*****************************************************************************
+bool
+isRevB2(void)
+{
+ //
+ // Check to make sure the major rev is B and the minor rev is 2.
+ //
+ return ( (AM_REG(MCUCTRL, CHIPREV) & 0xFF) == \
+ (AM_REG_MCUCTRL_CHIPREV_REVMAJ_B | (AM_REG_MCUCTRL_CHIPREV_REVMIN_REV0 + 2)) );
+}
+
+//*****************************************************************************
+//
//! @brief Enable the IOS in the power control block.
//!
//! This function enables the IOS module in the power control block.
@@ -957,7 +975,10 @@ am_hal_ios_fifo_service(uint32_t ui32Status)
}
}
}
- resync_fifoSize();
+ if (!isRevB2())
+ {
+ resync_fifoSize();
+ }
//
// Need to retake the FIFO space, after Threshold interrupt has been reenabled
@@ -1041,7 +1062,10 @@ am_hal_ios_fifo_write(uint8_t *pui8Data, uint32_t ui32NumBytes)
ui32NumBytes -= ui32FIFOSpace;
pui8Data += ui32FIFOSpace;
};
- resync_fifoSize();
+ if (!isRevB2())
+ {
+ resync_fifoSize();
+ }
}
//
@@ -1102,6 +1126,8 @@ am_hal_ios_fifo_write(uint8_t *pui8Data, uint32_t ui32NumBytes)
}
}
+ // Number of bytes written
+ g_sSRAMBuffer.ui32FifoInc += totalBytes - ui32NumBytes;
return (totalBytes - ui32NumBytes);
}
@@ -1114,7 +1140,7 @@ am_hal_ios_fifo_write(uint8_t *pui8Data, uint32_t ui32NumBytes)
//!
//! This function will write data from the caller-provided array to the IOS
//! LRAM FIFO. This simple routine does not use SRAM buffering for large
-//! messages.
+//! messages. This function also updates the FIFOCTR.
//!
//! The maximum message size for the IO Slave is 128 bytes.
//!
@@ -1140,6 +1166,8 @@ am_hal_ios_fifo_write_simple(uint8_t *pui8Data, uint32_t ui32NumBytes)
if ( ui32NumBytes <= ui32FIFOSpace )
{
fifo_write(pui8Data, ui32NumBytes);
+ // Write FIFOINC
+ AM_BFW(IOSLAVE, FIFOINC, FIFOINC, ui32NumBytes);
}
else
{
@@ -1209,6 +1237,7 @@ am_hal_ios_buffer_init(am_hal_ios_buffer_t *psBuffer, void *pvArray,
psBuffer->ui32ReadIndex = 0;
psBuffer->ui32Length = 0;
psBuffer->ui32Capacity = ui32Bytes;
+ psBuffer->ui32FifoInc = 0;
psBuffer->pui8Data = (uint8_t *)pvArray;
}
@@ -1273,12 +1302,19 @@ am_hal_ios_fifo_buffer_init(uint8_t *pui8Buffer, uint32_t ui32NumBytes)
//! @brief Update the FIFOCTR to inform host of available data to read.
//!
//! This function allows the application to indicate to HAL when it is safe to
-//! update the FIFOCTR.
+//! update the FIFOCTR. This function needs to be used in conjunction with
+//! am_hal_ios_fifo_write(), which itself does not update the FIFOCTR
//!
+//! CAUTION:
//! Application needs to implement some sort of
//! synchronization with the host to make sure host is not reading FIFOCTR while
//! it is being updated by the MCU, since the FIFOCTR read over
-//! IO is not an atomic operation.
+//! IO is not an atomic operation. Otherwise, some other logic could be implemented
+//! by the host to detect and disregard transient values of FIFOCTR (e.g. multiple
+//! reads till it gets a stable value).
+//! For Pre-B2 parts, it is necessary to have this synchronization guarantee that
+//! Host is not doing any READ operation - be it for FIFOCTR or FIFO itself when
+//! this call is made, as otherwise the FIFOCTR value may get corrupted.
//!
//!
//! @return None.
@@ -1287,11 +1323,9 @@ am_hal_ios_fifo_buffer_init(uint8_t *pui8Buffer, uint32_t ui32NumBytes)
void
am_hal_ios_update_fifoctr(void)
{
- uint32_t ui32Val;
- // Determine the available data
- ui32Val = am_hal_ios_fifo_space_used();
- // Update FIFOCTR
- AM_BFW(IOSLAVE, FIFOCTR, FIFOCTR, ui32Val);
+ // Write FIFOINC
+ AM_BFW(IOSLAVE, FIFOINC, FIFOINC, g_sSRAMBuffer.ui32FifoInc);
+ g_sSRAMBuffer.ui32FifoInc = 0;
return;
}
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_ios.h b/bsp/apollo2/libraries/drivers/hal/am_hal_ios.h
index b166c9c6e5..20af148d97 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_ios.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_ios.h
@@ -42,16 +42,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_IOS_H
#define AM_HAL_IOS_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
//*****************************************************************************
//
@@ -300,6 +296,10 @@ typedef struct
}
am_hal_ios_config_t;
+#ifdef __cplusplus
+extern "C"
+{
+#endif
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_itm.c b/bsp/apollo2/libraries/drivers/hal/am_hal_itm.c
index 0f57c0d417..8e7949edc7 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_itm.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_itm.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -58,30 +58,6 @@
//*****************************************************************************
//
-//! @brief Delays for a desired amount of microseconds.
-//!
-//! @note - This function is based on the similar function in am_util_delay.c,
-//! please see that module for implementation details. It was necessary to
-//! duplicate it here to avoid having to update every example to include the
-//! am_util_delay.c module in its build.
-//!
-//! @returns None
-//
-//*****************************************************************************
-void
-am_hal_itm_delay_us(uint32_t ui32MicroSeconds)
-{
- uint32_t ui32Iterations = ui32MicroSeconds *
- (am_hal_clkgen_sysclk_get() / 3000000);
-
- //
- // Call the BOOTROM cycle delay function
- //
- am_hal_flash_delay(ui32Iterations);
-}
-
-//*****************************************************************************
-//
//! @brief Enables the ITM
//!
//! This function enables the ARM ITM by setting the TRCENA bit in the DEMCR
@@ -118,7 +94,7 @@ am_hal_itm_enable(void)
AM_REGVAL(AM_REG_ITM_TER_O) = 0xffffffff;
//
- // Write to the ITM control and status register (don't enable yet).
+ // Write to the ITM control and status register.
//
AM_REGVAL(AM_REG_ITM_TCR_O) =
AM_WRITE_SM(AM_REG_ITM_TCR_ATB_ID, 0x15) |
@@ -129,6 +105,7 @@ am_hal_itm_enable(void)
AM_WRITE_SM(AM_REG_ITM_TCR_SYNC_ENABLE, 0) |
AM_WRITE_SM(AM_REG_ITM_TCR_TS_ENABLE, 0) |
AM_WRITE_SM(AM_REG_ITM_TCR_ITM_ENABLE, 1);
+
}
//*****************************************************************************
@@ -203,7 +180,7 @@ am_hal_itm_not_busy(void)
//
// wait for 50us for the data to flush out
//
- am_hal_itm_delay_us(50);
+ am_hal_flash_delay(FLASH_CYCLES_US(50));
}
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_itm.h b/bsp/apollo2/libraries/drivers/hal/am_hal_itm.h
index e747b0ab65..78f0b7a993 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_itm.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_itm.h
@@ -42,18 +42,13 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_ITM_H
#define AM_HAL_ITM_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
// Sync Packet Defines
@@ -71,12 +66,16 @@ extern "C"
#define AM_HAL_ITM_PRINT_NUM_REGS 1
extern uint32_t am_hal_itm_print_registers[AM_HAL_ITM_PRINT_NUM_REGS];
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// External function definitions
//
//*****************************************************************************
-extern void am_hal_itm_delay_us(uint32_t ui32MicroSeconds);
extern void am_hal_itm_enable(void);
extern void am_hal_itm_disable(void);
extern void am_hal_itm_not_busy(void);
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.c b/bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.c
index f7b60e3c1a..3e5eeb2c59 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.h b/bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.h
index 6811006fd6..b93515347d 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_mcuctrl.h
@@ -42,17 +42,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_MCUCTRL_H
#define AM_HAL_MCUCTRL_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//
// Deprecate the am_hal_mcuctrl_bucks_enable() and disable() functions.
// This functionality is now handled in pwrctrl.
@@ -188,6 +183,11 @@ typedef struct
}
am_hal_mcuctrl_fault_t;
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_otp.c b/bsp/apollo2/libraries/drivers/hal/am_hal_otp.c
index 67d08448da..99ce2493b3 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_otp.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_otp.c
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#include "am_mcu_apollo.h"
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_otp.h b/bsp/apollo2/libraries/drivers/hal/am_hal_otp.h
index d938e916fb..3ea13618d3 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_otp.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_otp.h
@@ -38,17 +38,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_OTP_H
#define AM_HAL_OTP_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
// Define some OTP values and macros.
@@ -82,6 +77,11 @@ extern "C"
#define AM_OTP_SRAM_LOCKOUT_S (2)
#define AM_OTP_SRAM_LOCKOUT_M (0x1 << AM_OTP_SRAM_LOCKOUT_S)
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// Function prototypes
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_pdm.c b/bsp/apollo2/libraries/drivers/hal/am_hal_pdm.c
index 45acfab995..b8ca3dde5c 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_pdm.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_pdm.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_pdm.h b/bsp/apollo2/libraries/drivers/hal/am_hal_pdm.h
index a6e23d2698..77c0ad9488 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_pdm.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_pdm.h
@@ -42,13 +42,18 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_PDM_H
#define AM_HAL_PDM_H
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// Macro definitions
@@ -655,6 +660,10 @@ extern void am_hal_pdm_disable(void);
extern uint32_t am_hal_pdm_int_status_get(bool bEnabledOnly);
+#ifdef __cplusplus
+}
+#endif
+
#endif // AM_HAL_PDM_H
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_pin.h b/bsp/apollo2/libraries/drivers/hal/am_hal_pin.h
index 8a1068f882..0173881bae 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_pin.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_pin.h
@@ -41,7 +41,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -55,7 +55,7 @@
//*****************************************************************************
#define AM_HAL_PIN_DIR_INPUT (AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_DIR_OUTPUT (AM_HAL_GPIO_OUT_PUSHPULL)
-#define AM_HAL_PIN_DIR_OPENDRAIN (AM_HAL_GPIO_OUT_OPENDRAIN | AM_HAL_GPIO_INPEN)
+#define AM_HAL_PIN_DIR_OPENDRAIN (AM_HAL_GPIO_OUT_OPENDRAIN)
#define AM_HAL_PIN_DIR_3STATE (AM_HAL_GPIO_OUT_3STATE)
//*****************************************************************************
@@ -81,25 +81,25 @@
#define AM_HAL_PIN_0_MxSCKLB (AM_HAL_GPIO_FUNC(4))
#define AM_HAL_PIN_0_M2SCK (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_0_MxSCLLB (AM_HAL_GPIO_FUNC(6))
-#define AM_HAL_PIN_0_M2SCL (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_0_M2SCL (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
-#define AM_HAL_PIN_1_SLSDA (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_1_SLSDA (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_1_SLMISO (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_1_UART0TX (AM_HAL_GPIO_FUNC(2))
#define AM_HAL_PIN_1_GPIO (AM_HAL_GPIO_FUNC(3))
#define AM_HAL_PIN_1_MxMISOLB (AM_HAL_GPIO_FUNC(4))
#define AM_HAL_PIN_1_M2MISO (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_1_MxSDALB (AM_HAL_GPIO_FUNC(6))
-#define AM_HAL_PIN_1_M2SDA (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_1_M2SDA (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
-#define AM_HAL_PIN_2_SLWIR3 (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_2_SLWIR3 (AM_HAL_GPIO_FUNC(0) | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_2_SLMOSI (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_2_UART0RX (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_2_GPIO (AM_HAL_GPIO_FUNC(3))
#define AM_HAL_PIN_2_MxMOSILB (AM_HAL_GPIO_FUNC(4))
#define AM_HAL_PIN_2_M2MOSI (AM_HAL_GPIO_FUNC(5))
#define AM_HAL_PIN_2_MxWIR3LB (AM_HAL_GPIO_FUNC(6))
-#define AM_HAL_PIN_2_M2WIR3 (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_2_M2WIR3 (AM_HAL_GPIO_FUNC(7) | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_3_UART0RTS (AM_HAL_GPIO_FUNC(0))
#define AM_HAL_PIN_3_SLnCE (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
@@ -109,7 +109,6 @@
#define AM_HAL_PIN_3_M2nCE0 (AM_HAL_GPIO_FUNC(5))
#define AM_HAL_PIN_3_TRIG1 (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_3_I2S_WCLK (AM_HAL_GPIO_FUNC(7))
-#define AM_HAL_PIN_3_PSOURCE (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OUTPUT | AM_HAL_GPIO_POWER)
#define AM_HAL_PIN_4_UART0CTS (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_4_SLINT (AM_HAL_GPIO_FUNC(1))
@@ -119,17 +118,18 @@
#define AM_HAL_PIN_4_M2nCE5 (AM_HAL_GPIO_FUNC(5))
#define AM_HAL_PIN_4_CLKOUT (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_4_32KHZ_XT (AM_HAL_GPIO_FUNC(7))
+// PSINK usage: GPIOWT=0 to activate the power switch, GPIOWT=1 to disable
+#define AM_HAL_PIN_4_PSINK (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_POWER)
-#define AM_HAL_PIN_5_M0SCL (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_5_M0SCL (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_5_M0SCK (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_5_UART0RTS (AM_HAL_GPIO_FUNC(2))
#define AM_HAL_PIN_5_GPIO (AM_HAL_GPIO_FUNC(3))
#define AM_HAL_PIN_5_M0SCKLB (AM_HAL_GPIO_FUNC(4))
-#define AM_HAL_PIN_5_EXTHFA (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_5_M0SCLLB (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_5_M1nCE2 (AM_HAL_GPIO_FUNC(7))
-#define AM_HAL_PIN_6_M0SDA (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_6_M0SDA (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_6_M0MISO (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_6_UART0CTS (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_6_GPIO (AM_HAL_GPIO_FUNC(3))
@@ -138,7 +138,7 @@
#define AM_HAL_PIN_6_SLSDALB (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_6_I2S_DAT (AM_HAL_GPIO_FUNC(7))
-#define AM_HAL_PIN_7_M0WIR3 (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_7_M0WIR3 (AM_HAL_GPIO_FUNC(0) | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_7_M0MOSI (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_7_CLKOUT (AM_HAL_GPIO_FUNC(2))
#define AM_HAL_PIN_7_GPIO (AM_HAL_GPIO_FUNC(3))
@@ -147,7 +147,7 @@
#define AM_HAL_PIN_7_SLWIR3LB (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_7_M1nCE1 (AM_HAL_GPIO_FUNC(7))
-#define AM_HAL_PIN_8_M1SCL (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_8_M1SCL (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_8_M1SCK (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_8_M0nCE4 (AM_HAL_GPIO_FUNC(2))
#define AM_HAL_PIN_8_GPIO (AM_HAL_GPIO_FUNC(3))
@@ -156,7 +156,7 @@
#define AM_HAL_PIN_8_UART1TX (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_8_M1SCLLB (AM_HAL_GPIO_FUNC(7))
-#define AM_HAL_PIN_9_M1SDA (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_9_M1SDA (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_9_M1MISO (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_9_M0nCE5 (AM_HAL_GPIO_FUNC(2))
#define AM_HAL_PIN_9_GPIO (AM_HAL_GPIO_FUNC(3))
@@ -165,7 +165,7 @@
#define AM_HAL_PIN_9_UART1RX (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_9_SLSDALB (AM_HAL_GPIO_FUNC(7))
-#define AM_HAL_PIN_10_M1WIR3 (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_10_M1WIR3 (AM_HAL_GPIO_FUNC(0) | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_10_M1MOSI (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_10_M0nCE6 (AM_HAL_GPIO_FUNC(2))
#define AM_HAL_PIN_10_GPIO (AM_HAL_GPIO_FUNC(3))
@@ -182,7 +182,6 @@
#define AM_HAL_PIN_11_UART1CTS (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_11_UART0RX (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_11_PDM_DATA (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
-#define AM_HAL_PIN_11_PSINK (AM_HAL_GPIO_FUNC(3))
#define AM_HAL_PIN_12_ADCD0NSE9 (AM_HAL_GPIO_FUNC(0))
#define AM_HAL_PIN_12_M1nCE0 (AM_HAL_GPIO_FUNC(1))
@@ -198,7 +197,6 @@
#define AM_HAL_PIN_13_TCTB0 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_13_GPIO (AM_HAL_GPIO_FUNC(3))
#define AM_HAL_PIN_13_M2nCE3 (AM_HAL_GPIO_FUNC(4))
-#define AM_HAL_PIN_13_EXTHFB (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_13_UART0RTS (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_13_UART1RX (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
@@ -207,7 +205,6 @@
#define AM_HAL_PIN_14_UART1TX (AM_HAL_GPIO_FUNC(2))
#define AM_HAL_PIN_14_GPIO (AM_HAL_GPIO_FUNC(3))
#define AM_HAL_PIN_14_M2nCE1 (AM_HAL_GPIO_FUNC(4))
-#define AM_HAL_PIN_14_EXTHFS (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_14_SWDCK (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_14_32KHZ_XT (AM_HAL_GPIO_FUNC(7))
@@ -216,7 +213,6 @@
#define AM_HAL_PIN_15_UART1RX (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_15_GPIO (AM_HAL_GPIO_FUNC(3))
#define AM_HAL_PIN_15_M2nCE2 (AM_HAL_GPIO_FUNC(4))
-#define AM_HAL_PIN_15_EXTXT (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_15_SWDIO (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_15_SWO (AM_HAL_GPIO_FUNC(7))
@@ -234,7 +230,6 @@
#define AM_HAL_PIN_17_TRIG1 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_17_GPIO (AM_HAL_GPIO_FUNC(3))
#define AM_HAL_PIN_17_M4nCE3 (AM_HAL_GPIO_FUNC(4))
-#define AM_HAL_PIN_17_EXTLF (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_17_UART0RX (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_17_UART1CTS (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
@@ -243,7 +238,6 @@
#define AM_HAL_PIN_18_TCTA1 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_18_GPIO (AM_HAL_GPIO_FUNC(3))
#define AM_HAL_PIN_18_M4nCE1 (AM_HAL_GPIO_FUNC(4))
-#define AM_HAL_PIN_18_ANATEST2 (AM_HAL_GPIO_FUNC(5))
#define AM_HAL_PIN_18_UART1TX (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_18_32KHZ_XT (AM_HAL_GPIO_FUNC(7))
@@ -252,7 +246,6 @@
#define AM_HAL_PIN_19_TCTB1 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_19_GPIO (AM_HAL_GPIO_FUNC(3))
#define AM_HAL_PIN_19_TCTA1 (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_INPUT)
-#define AM_HAL_PIN_19_ANATEST1 (AM_HAL_GPIO_FUNC(5))
#define AM_HAL_PIN_19_UART1RX (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_19_I2S_BCLK (AM_HAL_GPIO_FUNC(7))
@@ -277,6 +270,7 @@
#define AM_HAL_PIN_22_PDM_CLK (AM_HAL_GPIO_FUNC(4))
#define AM_HAL_PIN_22_TCTB1 (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_22_SWO (AM_HAL_GPIO_FUNC(7))
+// PSOURCE usage in pushpull: GPIOWT=1 to activate the power switch, GPIOWT=0 to disable
#define AM_HAL_PIN_22_PSOURCE (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OUTPUT | AM_HAL_GPIO_POWER)
#define AM_HAL_PIN_23_UART0RX (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
@@ -299,17 +293,15 @@
#endif // defined (AM_PACKAGE_BGA)
#if defined (AM_PACKAGE_BGA)
-#define AM_HAL_PIN_25_EXTXT (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_25_M0nCE2 (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_25_TCTA0 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_25_GPIO (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_25_M2SDA (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_25_M2SDA (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_25_M2MISO (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_25_SLMISOLB (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_25_SLSDALB (AM_HAL_GPIO_FUNC(7))
#endif // defined (AM_PACKAGE_BGA)
-#define AM_HAL_PIN_26_EXTLF (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_26_M0nCE3 (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_26_TCTB0 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_26_GPIO (AM_HAL_GPIO_FUNC(3))
@@ -319,11 +311,10 @@
#define AM_HAL_PIN_26_M3nCE0 (AM_HAL_GPIO_FUNC(7))
#if defined (AM_PACKAGE_BGA)
-#define AM_HAL_PIN_27_EXTHF (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_27_M1nCE4 (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_27_TCTA1 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_27_GPIO (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_27_M2SCL (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_27_M2SCL (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_27_M2SCK (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_27_M2SCKLB (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_27_M2SCLLB (AM_HAL_GPIO_FUNC(7))
@@ -333,7 +324,7 @@
#define AM_HAL_PIN_28_M1nCE5 (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_28_TCTB1 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_28_GPIO (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_28_M2WIR3 (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_28_M2WIR3 (AM_HAL_GPIO_FUNC(4) | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_28_M2MOSI (AM_HAL_GPIO_FUNC(5))
#define AM_HAL_PIN_28_M5nCE3 (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_28_SLWIR3LB (AM_HAL_GPIO_FUNC(7))
@@ -353,7 +344,6 @@
#define AM_HAL_PIN_30_GPIO (AM_HAL_GPIO_FUNC(3))
#define AM_HAL_PIN_30_UART0TX (AM_HAL_GPIO_FUNC(4))
#define AM_HAL_PIN_30_UART1RTS (AM_HAL_GPIO_FUNC(5))
-#define AM_HAL_PIN_30_SWO (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_30_I2S_DAT (AM_HAL_GPIO_FUNC(7))
#endif // defined (AM_PACKAGE_BGA)
@@ -433,7 +423,7 @@
#define AM_HAL_PIN_38_M1nCE3 (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_38_UART0CTS (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_38_GPIO (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_38_M3WIR3 (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_38_M3WIR3 (AM_HAL_GPIO_FUNC(4) | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_38_M3MOSI (AM_HAL_GPIO_FUNC(5))
#define AM_HAL_PIN_38_M4nCE7 (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_38_SLWIR3LB (AM_HAL_GPIO_FUNC(7))
@@ -443,7 +433,7 @@
#define AM_HAL_PIN_39_UART1TX (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_39_CLKOUT (AM_HAL_GPIO_FUNC(2))
#define AM_HAL_PIN_39_GPIO (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_39_M4SCL (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_39_M4SCL (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_39_M4SCK (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_39_M4SCKLB (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_39_M4SCLLB (AM_HAL_GPIO_FUNC(7))
@@ -452,7 +442,7 @@
#define AM_HAL_PIN_40_UART1RX (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_40_TRIG0 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_40_GPIO (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_40_M4SDA (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_40_M4SDA (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_40_M4MISO (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_40_SLMISOLB (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_40_SLSDALB (AM_HAL_GPIO_FUNC(7))
@@ -465,6 +455,7 @@
#define AM_HAL_PIN_41_M5nCE7 (AM_HAL_GPIO_FUNC(5))
#define AM_HAL_PIN_41_M4nCE2 (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_41_UART0RTS (AM_HAL_GPIO_FUNC(7))
+// PSOURCE usage in pushpull: GPIOWT=1 to activate the power switch, GPIOWT=0 to disable
#define AM_HAL_PIN_41_PSOURCE (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OUTPUT | AM_HAL_GPIO_POWER)
#if defined (AM_PACKAGE_BGA)
@@ -472,7 +463,7 @@
#define AM_HAL_PIN_42_M0nCE0 (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_42_TCTA0 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_42_GPIO (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_42_M3SCL (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_42_M3SCL (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_42_M3SCK (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_42_M3SCKLB (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_42_M3SCLLB (AM_HAL_GPIO_FUNC(7))
@@ -483,7 +474,7 @@
#define AM_HAL_PIN_43_M0nCE1 (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_43_TCTB0 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_43_GPIO (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_43_M3SDA (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_43_M3SDA (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_43_M3MISO (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_43_SLMISOLB (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_43_SLSDALB (AM_HAL_GPIO_FUNC(7))
@@ -493,7 +484,7 @@
#define AM_HAL_PIN_44_M0nCE2 (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_44_TCTA1 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_44_GPIO (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_44_M4WIR3 (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_44_M4WIR3 (AM_HAL_GPIO_FUNC(4) | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_44_M4MOSI (AM_HAL_GPIO_FUNC(5))
#define AM_HAL_PIN_44_M5nCE6 (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_44_SLWIR3LB (AM_HAL_GPIO_FUNC(7))
@@ -506,7 +497,7 @@
#define AM_HAL_PIN_45_M4nCE3 (AM_HAL_GPIO_FUNC(4))
#define AM_HAL_PIN_45_M3nCE6 (AM_HAL_GPIO_FUNC(5))
#define AM_HAL_PIN_45_M5nCE5 (AM_HAL_GPIO_FUNC(6))
-#define AM_HAL_PIN_45_TCTA1 (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_45_SWO (AM_HAL_GPIO_FUNC(7))
#endif // defined (AM_PACKAGE_BGA)
#if defined (AM_PACKAGE_BGA)
@@ -524,7 +515,7 @@
#define AM_HAL_PIN_47_M0nCE5 (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_47_TCTB2 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_47_GPIO (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_47_M5WIR3 (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_47_M5WIR3 (AM_HAL_GPIO_FUNC(4) | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_47_M5MOSI (AM_HAL_GPIO_FUNC(5))
#define AM_HAL_PIN_47_M4nCE5 (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_47_SLWIR3LB (AM_HAL_GPIO_FUNC(7))
@@ -533,7 +524,7 @@
#define AM_HAL_PIN_48_M0nCE6 (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_48_TCTA3 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_48_GPIO (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_48_M5SCL (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_48_M5SCL (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_48_M5SCK (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_48_M5SCKLB (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_48_M5SCLLB (AM_HAL_GPIO_FUNC(7))
@@ -542,7 +533,7 @@
#define AM_HAL_PIN_49_M0nCE7 (AM_HAL_GPIO_FUNC(1))
#define AM_HAL_PIN_49_TCTB3 (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_49_GPIO (AM_HAL_GPIO_FUNC(3))
-#define AM_HAL_PIN_49_M5SDA (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_49_M5SDA (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN | AM_HAL_GPIO_INPEN)
#define AM_HAL_PIN_49_M5MISO (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
#define AM_HAL_PIN_49_SLMISOLB (AM_HAL_GPIO_FUNC(6))
#define AM_HAL_PIN_49_SLSDALB (AM_HAL_GPIO_FUNC(7))
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.c b/bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.c
index cc91eeb159..b16b909308 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.h b/bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.h
index bc9adabf84..8068253900 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_pwrctrl.h
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -319,6 +319,11 @@
#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL \
AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_256K
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// Function prototypes
@@ -332,6 +337,10 @@ extern void am_hal_pwrctrl_bucks_enable(void);
extern void am_hal_pwrctrl_bucks_disable(void);
extern void am_hal_pwrctrl_low_power_init(void);
+#ifdef __cplusplus
+}
+#endif
+
#endif // AM_HAL_PWRCTRL_H
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_queue.c b/bsp/apollo2/libraries/drivers/hal/am_hal_queue.c
index 66a9846c29..f54b90a1e0 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_queue.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_queue.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_queue.h b/bsp/apollo2/libraries/drivers/hal/am_hal_queue.h
index 11e8ace90a..8cab7dd907 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_queue.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_queue.h
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_QUEUE_H
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_reset.c b/bsp/apollo2/libraries/drivers/hal/am_hal_reset.c
index 86d5cf10b7..19ef48dcd3 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_reset.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_reset.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_reset.h b/bsp/apollo2/libraries/drivers/hal/am_hal_reset.h
index a3273dad10..5e914f4d18 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_reset.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_reset.h
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_RSTGEN_H
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_rtc.c b/bsp/apollo2/libraries/drivers/hal/am_hal_rtc.c
index 4630d5a117..44fccb49db 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_rtc.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_rtc.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_rtc.h b/bsp/apollo2/libraries/drivers/hal/am_hal_rtc.h
index 9304a6c67f..c49cdf25de 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_rtc.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_rtc.h
@@ -42,17 +42,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_RTC_H
#define AM_HAL_RTC_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
//! @name OSC Start and Stop
@@ -149,6 +144,11 @@ typedef struct am_hal_rtc_time_struct
uint32_t ui32Hundredths;
}am_hal_rtc_time_t;
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_stimer.c b/bsp/apollo2/libraries/drivers/hal/am_hal_stimer.c
index 0cdd706c9e..ed94beb5a1 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_stimer.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_stimer.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -136,11 +136,14 @@ am_hal_stimer_counter_clear(void)
//!
//! @param ui32CmprInstance is the compare register instance number (0-7).
//! @param ui32Delta is the value to add to the STimer counter and load into
-//! the comparator register.
+//! the comparator register. It should be > 1
//!
//! NOTE: There is no way to set an absolute value into a comparator register.
//! Only deltas added to the STimer counter can be written to the compare
//! registers.
+//! CAUTION: The HAL implementation requires temporarily disabling the
+//! comparison. To avoid the remote possibility of losing an interrupt
+//! during that time, delta should always be set to a value greater than 1
//!
//! @return None.
//
@@ -148,12 +151,32 @@ am_hal_stimer_counter_clear(void)
void
am_hal_stimer_compare_delta_set(uint32_t ui32CmprInstance, uint32_t ui32Delta)
{
+ uint32_t cfgVal;
+ uint32_t ui32Critical = 0;
if ( ui32CmprInstance > 7 )
{
return;
}
+ cfgVal = AM_REG(CTIMER, STCFG);
+ // We need to disable the compare temporarily while setting the delta value
+ // That leaves a corner case where we could miss the trigger if setting a very
+ // small delta. To avoid this, we take critical section, and we should ensure
+ // that delta value is at least > 1
+
+ // Disable the compare if already enabled, when setting the new value
+ AM_REG(CTIMER, STCFG) &= ~((AM_HAL_STIMER_CFG_COMPARE_A_ENABLE << ui32CmprInstance));
+ //
+ // Start a critical section.
+ //
+ ui32Critical = am_hal_interrupt_master_disable();
AM_REGVAL(AM_REG_STIMER_COMPARE(0, ui32CmprInstance)) = ui32Delta;
+ // Restore Compare Enable bit
+ AM_REG(CTIMER, STCFG) |= cfgVal & (AM_HAL_STIMER_CFG_COMPARE_A_ENABLE << ui32CmprInstance);
+ //
+ // End the critical section.
+ //
+ am_hal_interrupt_master_set(ui32Critical);
}
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_stimer.h b/bsp/apollo2/libraries/drivers/hal/am_hal_stimer.h
index bd4b09feae..5368c4af81 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_stimer.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_stimer.h
@@ -42,17 +42,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_STIMER_H
#define AM_HAL_STIMER_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//
// Compute address of a given COMPARE or CAPTURE register.
// Note - For Apollo2, the parameter n should be 0 (as only 1 stimer module
@@ -204,6 +199,11 @@ am_hal_stimer_config_t;
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_sysctrl.c b/bsp/apollo2/libraries/drivers/hal/am_hal_sysctrl.c
index 50e0b67915..57cd34b95d 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_sysctrl.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_sysctrl.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -731,8 +731,6 @@ am_hal_sysctrl_buck_update_complete(void)
static void
am_hal_sysctrl_buckA_ctimer_isr(void)
{
- volatile uint32_t ui32BuckTimer = g_ui32BuckTimer - 1;
-
//
// Begin critical section.
// Although a relatively long time, the following 2us delay is critically
@@ -792,8 +790,6 @@ am_hal_sysctrl_buckA_ctimer_isr(void)
static void
am_hal_sysctrl_buckB_ctimer_isr(void)
{
- volatile uint32_t ui32BuckTimer = g_ui32BuckTimer - 1;
-
//
// Begin critical section.
// Although a relatively long time, the following 2us delay is critically
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_sysctrl.h b/bsp/apollo2/libraries/drivers/hal/am_hal_sysctrl.h
index 34c72b4173..17854f948b 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_sysctrl.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_sysctrl.h
@@ -42,16 +42,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_SYSCTRL_H
#define AM_HAL_SYSCTRL_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
//*****************************************************************************
//
@@ -86,6 +82,10 @@ extern "C"
//
#define AM_HAL_SYSCTRL_BUCK_CTIMER_ZX_CONSTANT 0x01000000 // No timer, apply a constant value
+#ifdef __cplusplus
+extern "C"
+{
+#endif
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_systick.c b/bsp/apollo2/libraries/drivers/hal/am_hal_systick.c
index 3654910495..b09ee47c83 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_systick.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_systick.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_systick.h b/bsp/apollo2/libraries/drivers/hal/am_hal_systick.h
index bd5e576938..8ecdf7fec2 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_systick.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_systick.h
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_SYSTICK_H
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_tpiu.c b/bsp/apollo2/libraries/drivers/hal/am_hal_tpiu.c
index 722f22fa13..151b0ce21d 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_tpiu.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_tpiu.c
@@ -44,7 +44,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -350,7 +350,7 @@ am_hal_tpiu_enable(am_hal_tpiu_config_t *psConfig)
//
// Wait for 50us for the data to flush out.
//
- am_hal_itm_delay_us(50);
+ am_hal_flash_delay(FLASH_CYCLES_US(50));
}
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_tpiu.h b/bsp/apollo2/libraries/drivers/hal/am_hal_tpiu.h
index 9739034a18..6ef6b1f542 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_tpiu.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_tpiu.h
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_TPIU_H
@@ -50,11 +50,6 @@
#include <stdint.h>
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
// TPIU bit rate defines.
@@ -165,6 +160,11 @@ typedef struct
}
am_hal_tpiu_config_t;
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_ttp.c b/bsp/apollo2/libraries/drivers/hal/am_hal_ttp.c
index 77bde67b87..22de5e782b 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_ttp.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_ttp.c
@@ -39,7 +39,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#include "am_mcu_apollo.h"
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_ttp.h b/bsp/apollo2/libraries/drivers/hal/am_hal_ttp.h
index b254c957a7..8879e98c83 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_ttp.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_ttp.h
@@ -39,7 +39,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_TTP_H
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_uart.c b/bsp/apollo2/libraries/drivers/hal/am_hal_uart.c
index 1a7e5aca31..4582cbb4e9 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_uart.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_uart.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_uart.h b/bsp/apollo2/libraries/drivers/hal/am_hal_uart.h
index 4aab828582..b6209d112e 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_uart.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_uart.h
@@ -42,17 +42,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_UART_H
#define AM_HAL_UART_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
//! @name UART Interrupts
@@ -270,6 +265,11 @@ am_hal_uart_pwrsave_t;
//*****************************************************************************
extern am_hal_uart_pwrsave_t am_hal_uart_pwrsave[AM_REG_UART_NUM_MODULES];
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_vcomp.c b/bsp/apollo2/libraries/drivers/hal/am_hal_vcomp.c
index 31e28855e4..37539c1d04 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_vcomp.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_vcomp.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_vcomp.h b/bsp/apollo2/libraries/drivers/hal/am_hal_vcomp.h
index a6ca991aae..cd0d81ad53 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_vcomp.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_vcomp.h
@@ -42,17 +42,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_VCOMP_H
#define AM_HAL_VCOMP_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
//*****************************************************************************
//
//! @name Positive Input Selection
@@ -145,6 +140,11 @@ typedef struct
}
am_hal_vcomp_config_t;
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
//*****************************************************************************
//
// External function definitions
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_wdt.c b/bsp/apollo2/libraries/drivers/hal/am_hal_wdt.c
index 4e80113fd1..9676f973ac 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_wdt.c
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_wdt.c
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/hal/am_hal_wdt.h b/bsp/apollo2/libraries/drivers/hal/am_hal_wdt.h
index 63766fa458..b719158b8a 100644
--- a/bsp/apollo2/libraries/drivers/hal/am_hal_wdt.h
+++ b/bsp/apollo2/libraries/drivers/hal/am_hal_wdt.h
@@ -42,7 +42,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_HAL_WDT_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_adc.h b/bsp/apollo2/libraries/drivers/regs/am_reg_adc.h
index 54d2d8620f..90d3531f0f 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_adc.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_adc.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_ADC_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_base_addresses.h b/bsp/apollo2/libraries/drivers/regs/am_reg_base_addresses.h
index 13a850d1c4..0a223b4a67 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_base_addresses.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_base_addresses.h
@@ -37,7 +37,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_BASE_ADDRESSES_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_cachectrl.h b/bsp/apollo2/libraries/drivers/regs/am_reg_cachectrl.h
index b933a08874..ac7e9d22d2 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_cachectrl.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_cachectrl.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_CACHECTRL_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_clkgen.h b/bsp/apollo2/libraries/drivers/regs/am_reg_clkgen.h
index c769673d65..d9dae13622 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_clkgen.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_clkgen.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_CLKGEN_H
@@ -66,7 +66,6 @@
#define AM_REG_CLKGEN_CCTRL_O 0x00000018
#define AM_REG_CLKGEN_STATUS_O 0x0000001C
#define AM_REG_CLKGEN_HFADJ_O 0x00000020
-#define AM_REG_CLKGEN_HFVAL_O 0x00000024
#define AM_REG_CLKGEN_CLOCKEN_O 0x00000028
#define AM_REG_CLKGEN_CLOCKEN2_O 0x0000002C
#define AM_REG_CLKGEN_CLOCKEN3_O 0x00000030
@@ -392,16 +391,6 @@
//*****************************************************************************
//
-// CLKGEN_HFVAL - HFADJ readback
-//
-//*****************************************************************************
-// Current HFTUNE value
-#define AM_REG_CLKGEN_HFVAL_HFTUNERB_S 0
-#define AM_REG_CLKGEN_HFVAL_HFTUNERB_M 0x000007FF
-#define AM_REG_CLKGEN_HFVAL_HFTUNERB(n) (((uint32_t)(n) << 0) & 0x000007FF)
-
-//*****************************************************************************
-//
// CLKGEN_CLOCKEN - Clock Enable Status
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_ctimer.h b/bsp/apollo2/libraries/drivers/regs/am_reg_ctimer.h
index 278849a74d..7bc30aa3f2 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_ctimer.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_ctimer.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_CTIMER_H
@@ -51,7 +51,7 @@
//*****************************************************************************
#define AM_REG_CTIMER_NUM_MODULES 1
#define AM_REG_CTIMERn(n) \
- (REG_CTIMER_BASEADDR + 0x00000000 * n)
+ (REG_CTIMER_BASEADDR + 0x00000010 * n)
//*****************************************************************************
//
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_flashctrl.h b/bsp/apollo2/libraries/drivers/regs/am_reg_flashctrl.h
index 0b103ea6fb..53cc2fb6d1 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_flashctrl.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_flashctrl.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_FLASHCTRL_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_gpio.h b/bsp/apollo2/libraries/drivers/regs/am_reg_gpio.h
index 4690cd6111..1e3d424151 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_gpio.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_gpio.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_GPIO_H
@@ -1348,7 +1348,7 @@
#define AM_REG_GPIO_PADREGB_PAD7FNCSEL_SLWIR3LB 0x30000000
#define AM_REG_GPIO_PADREGB_PAD7FNCSEL_M1nCE1 0x38000000
-// Pad 7 drive strentgh
+// Pad 7 drive strength
#define AM_REG_GPIO_PADREGB_PAD7STRNG_S 26
#define AM_REG_GPIO_PADREGB_PAD7STRNG_M 0x04000000
#define AM_REG_GPIO_PADREGB_PAD7STRNG(n) (((uint32_t)(n) << 26) & 0x04000000)
@@ -1514,7 +1514,7 @@
#define AM_REG_GPIO_PADREGC_PAD11FNCSEL_UART0RX 0x30000000
#define AM_REG_GPIO_PADREGC_PAD11FNCSEL_PDM_DATA 0x38000000
-// Pad 11 drive strentgh
+// Pad 11 drive strength
#define AM_REG_GPIO_PADREGC_PAD11STRNG_S 26
#define AM_REG_GPIO_PADREGC_PAD11STRNG_M 0x04000000
#define AM_REG_GPIO_PADREGC_PAD11STRNG(n) (((uint32_t)(n) << 26) & 0x04000000)
@@ -1673,7 +1673,7 @@
#define AM_REG_GPIO_PADREGD_PAD15FNCSEL_SWDIO 0x30000000
#define AM_REG_GPIO_PADREGD_PAD15FNCSEL_SWO 0x38000000
-// Pad 15 drive strentgh
+// Pad 15 drive strength
#define AM_REG_GPIO_PADREGD_PAD15STRNG_S 26
#define AM_REG_GPIO_PADREGD_PAD15STRNG_M 0x04000000
#define AM_REG_GPIO_PADREGD_PAD15STRNG(n) (((uint32_t)(n) << 26) & 0x04000000)
@@ -1814,7 +1814,7 @@
#define AM_REG_GPIO_PADREGE_PAD19FNCSEL_UART1RX 0x30000000
#define AM_REG_GPIO_PADREGE_PAD19FNCSEL_I2S_BCLK 0x38000000
-// Pad 19 drive strentgh
+// Pad 19 drive strength
#define AM_REG_GPIO_PADREGE_PAD19STRNG_S 26
#define AM_REG_GPIO_PADREGE_PAD19STRNG_M 0x04000000
#define AM_REG_GPIO_PADREGE_PAD19STRNG(n) (((uint32_t)(n) << 26) & 0x04000000)
@@ -1955,7 +1955,7 @@
#define AM_REG_GPIO_PADREGF_PAD23FNCSEL_TCTB1 0x30000000
#define AM_REG_GPIO_PADREGF_PAD23FNCSEL_UNDEF7 0x38000000
-// Pad 23 drive strentgh
+// Pad 23 drive strength
#define AM_REG_GPIO_PADREGF_PAD23STRNG_S 26
#define AM_REG_GPIO_PADREGF_PAD23STRNG_M 0x04000000
#define AM_REG_GPIO_PADREGF_PAD23STRNG(n) (((uint32_t)(n) << 26) & 0x04000000)
@@ -2112,7 +2112,7 @@
#define AM_REG_GPIO_PADREGG_PAD27FNCSEL_M2SCKLB 0x30000000
#define AM_REG_GPIO_PADREGG_PAD27FNCSEL_M2SCLLB 0x38000000
-// Pad 27 drive strentgh
+// Pad 27 drive strength
#define AM_REG_GPIO_PADREGG_PAD27STRNG_S 26
#define AM_REG_GPIO_PADREGG_PAD27STRNG_M 0x04000000
#define AM_REG_GPIO_PADREGG_PAD27STRNG(n) (((uint32_t)(n) << 26) & 0x04000000)
@@ -2262,7 +2262,7 @@
#define AM_REG_GPIO_PADREGH_PAD31FNCSEL_UNDEF6 0x30000000
#define AM_REG_GPIO_PADREGH_PAD31FNCSEL_UNDEF7 0x38000000
-// Pad 31 drive strentgh
+// Pad 31 drive strength
#define AM_REG_GPIO_PADREGH_PAD31STRNG_S 26
#define AM_REG_GPIO_PADREGH_PAD31STRNG_M 0x04000000
#define AM_REG_GPIO_PADREGH_PAD31STRNG(n) (((uint32_t)(n) << 26) & 0x04000000)
@@ -2403,7 +2403,7 @@
#define AM_REG_GPIO_PADREGI_PAD35FNCSEL_UA0RTS 0x30000000
#define AM_REG_GPIO_PADREGI_PAD35FNCSEL_M3nCE2 0x38000000
-// Pad 35 drive strentgh
+// Pad 35 drive strength
#define AM_REG_GPIO_PADREGI_PAD35STRNG_S 26
#define AM_REG_GPIO_PADREGI_PAD35STRNG_M 0x04000000
#define AM_REG_GPIO_PADREGI_PAD35STRNG(n) (((uint32_t)(n) << 26) & 0x04000000)
@@ -2553,7 +2553,7 @@
#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL_M4SCKLB 0x30000000
#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL_M4SCLLB 0x38000000
-// Pad 39 drive strentgh
+// Pad 39 drive strength
#define AM_REG_GPIO_PADREGJ_PAD39STRNG_S 26
#define AM_REG_GPIO_PADREGJ_PAD39STRNG_M 0x04000000
#define AM_REG_GPIO_PADREGJ_PAD39STRNG(n) (((uint32_t)(n) << 26) & 0x04000000)
@@ -2703,7 +2703,7 @@
#define AM_REG_GPIO_PADREGK_PAD43FNCSEL_SLMISOLB 0x30000000
#define AM_REG_GPIO_PADREGK_PAD43FNCSEL_SLSDALB 0x38000000
-// Pad 43 drive strentgh
+// Pad 43 drive strength
#define AM_REG_GPIO_PADREGK_PAD43STRNG_S 26
#define AM_REG_GPIO_PADREGK_PAD43STRNG_M 0x04000000
#define AM_REG_GPIO_PADREGK_PAD43STRNG(n) (((uint32_t)(n) << 26) & 0x04000000)
@@ -2869,7 +2869,7 @@
#define AM_REG_GPIO_PADREGL_PAD47FNCSEL_M4nCE5 0x30000000
#define AM_REG_GPIO_PADREGL_PAD47FNCSEL_SLWIR3LB 0x38000000
-// Pad 47 drive strentgh
+// Pad 47 drive strength
#define AM_REG_GPIO_PADREGL_PAD47STRNG_S 26
#define AM_REG_GPIO_PADREGL_PAD47STRNG_M 0x04000000
#define AM_REG_GPIO_PADREGL_PAD47STRNG(n) (((uint32_t)(n) << 26) & 0x04000000)
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_iomstr.h b/bsp/apollo2/libraries/drivers/regs/am_reg_iomstr.h
index c04cd2c04a..b33ed9b666 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_iomstr.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_iomstr.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_IOMSTR_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_ioslave.h b/bsp/apollo2/libraries/drivers/regs/am_reg_ioslave.h
index 4a1c96ae3c..6e9f47b002 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_ioslave.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_ioslave.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_IOSLAVE_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_itm.h b/bsp/apollo2/libraries/drivers/regs/am_reg_itm.h
index c007aa629a..91554948b7 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_itm.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_itm.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_ITM_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_jedec.h b/bsp/apollo2/libraries/drivers/regs/am_reg_jedec.h
index 61560dc099..7f883a8333 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_jedec.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_jedec.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_JEDEC_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_macros.h b/bsp/apollo2/libraries/drivers/regs/am_reg_macros.h
index e9662958c1..5378f1a858 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_macros.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_macros.h
@@ -1,6 +1,7 @@
//*****************************************************************************
//
-//! @file am_reg_macros.h
+// am_reg_macros.h
+//! @file
//!
//! @brief Helper macros for using hardware registers.
//
@@ -37,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
@@ -106,10 +107,15 @@ extern "C"
// Register access macros for single-instance modules
// AM_REG - Write a register of a module.
// AM_BFW - Write a value to a bitfield of a register.
-// AM_BFWe - Use a defined enum value to write a value to a bitfield.
+// AM_BFWe - Use a defined enum value to write a value to a register bitfield.
// AM_BFR - Read a bitfield value from a register.
-// AM_BFM - Read and mask a bitfield, but leave the value in its bit position.
-// (Useful for comparing with enums.)
+// AM_BFM - Read and mask a bitfield from a register, but leave the value in
+// its bit position. Useful for comparing with enums.
+//
+// AM_BFV - Move a value to a bitfield. This macro is used for creating a
+// value, it does not modify any register.
+// AM_BFX - Extract the value of a bitfield from a 32-bit value, such as that
+// read from a register. Does not read or modify any register.
//
//*****************************************************************************
#define AM_REG(module, reg) \
@@ -139,16 +145,19 @@ extern "C"
//*****************************************************************************
//
// Register access macros for multi-instance modules
+// AM_REGADDRn - Calc the register address inside a multiple instance module.
// AM_REGn - Write a register of a multiple instance module.
// AM_BFWn - Write a value to a bitfield of a register in a multiple instance.
// AM_BFWen - Use a defined enum value to write a value to a bitfield of a
// register in a multiple instance.
// AM_BFRn - Read a bitfield value from a register in a multiple instance.
-// AM_BFMn - Read a bitfield, but leave the value in its bitfield position.
// AM_BFMn - Read and mask a bitfield, but leave the value in its bit position.
// (Useful for comparing with enums.)
//
//*****************************************************************************
+#define AM_REGADDRn(module, instance, reg) \
+ (AM_REG_##module##n(instance) + AM_REG_##module##_##reg##_O)
+
#define AM_REGn(module, instance, reg) \
AM_REGVAL(AM_REG_##module##n(instance) + AM_REG_##module##_##reg##_O)
@@ -187,9 +196,9 @@ extern "C"
// no operator to simply write the value atomically.
// AM_REGa_SET - Set bits in a single instance module according to the mask.
// AM_REGa_CLR - Clear bits in a single instance module according to the mask.
-// AM_REGna - Multiple module version of AM_REGa.
-// AM_REGna_SET - Multiple instance version of AM_REGa_SET.
-// AM_REGna_CLR - Multiple instance version of AM_REGa_CLR.
+// AM_REGan - Multiple module version of AM_REGa.
+// AM_REGan_SET - Multiple instance version of AM_REGa_SET.
+// AM_REGan_CLR - Multiple instance version of AM_REGa_CLR.
// AM_BFWa - Write a value to a register bitfield.
// AM_BFWae - Use a defined enum value to write a value to a bitfield.
// AM_BFWan - Write a value to a bitfield of a register in a multiple instance.
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_macros_asm.h b/bsp/apollo2/libraries/drivers/regs/am_reg_macros_asm.h
index f02624d8e3..854019d911 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_macros_asm.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_macros_asm.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_mcuctrl.h b/bsp/apollo2/libraries/drivers/regs/am_reg_mcuctrl.h
index ae066bf85d..b4b1e54428 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_mcuctrl.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_mcuctrl.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_MCUCTRL_H
@@ -143,6 +143,7 @@
#define AM_REG_MCUCTRL_CHIPREV_REVMIN_M 0x0000000F
#define AM_REG_MCUCTRL_CHIPREV_REVMIN(n) (((uint32_t)(n) << 0) & 0x0000000F)
#define AM_REG_MCUCTRL_CHIPREV_REVMIN_REV0 0x00000000
+#define AM_REG_MCUCTRL_CHIPREV_REVMIN_REV2 0x00000002
//*****************************************************************************
//
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_nvic.h b/bsp/apollo2/libraries/drivers/regs/am_reg_nvic.h
index 349991e28f..c2657660f2 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_nvic.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_nvic.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_NVIC_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_pdm.h b/bsp/apollo2/libraries/drivers/regs/am_reg_pdm.h
index 6a7c6aa3cf..042dfd2ce3 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_pdm.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_pdm.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_PDM_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_pwrctrl.h b/bsp/apollo2/libraries/drivers/regs/am_reg_pwrctrl.h
index cac7cab36c..b4929ff39a 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_pwrctrl.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_pwrctrl.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_PWRCTRL_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_rstgen.h b/bsp/apollo2/libraries/drivers/regs/am_reg_rstgen.h
index 1e76519744..0554bdd465 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_rstgen.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_rstgen.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_RSTGEN_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_rtc.h b/bsp/apollo2/libraries/drivers/regs/am_reg_rtc.h
index 9da5bc816c..b830445c22 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_rtc.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_rtc.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_RTC_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_sysctrl.h b/bsp/apollo2/libraries/drivers/regs/am_reg_sysctrl.h
index 4a00cc21d5..b82cd0dd70 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_sysctrl.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_sysctrl.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_SYSCTRL_H
@@ -58,6 +58,8 @@
// Register offsets.
//
//*****************************************************************************
+#define AM_REG_SYSCTRL_ICTR_O 0xE000E004
+#define AM_REG_SYSCTRL_ACTLR_O 0xE000E008
#define AM_REG_SYSCTRL_ICSR_O 0xE000ED04
#define AM_REG_SYSCTRL_VTOR_O 0xE000ED08
#define AM_REG_SYSCTRL_AIRCR_O 0xE000ED0C
@@ -80,6 +82,47 @@
//*****************************************************************************
//
+// SYSCTRL_ICTR - Interrupt Controller Type Register (NVIC)
+//
+//*****************************************************************************
+// Total number of interrupt lines in groups of 32.
+#define AM_REG_SYSCTRL_ICTR_INTLINESNUM_S 0
+#define AM_REG_SYSCTRL_ICTR_INTLINESNUM_M 0x0000000F
+#define AM_REG_SYSCTRL_ICTR_INTLINESNUM(n) (((uint32_t)(n) << 0) & 0x0000000F)
+
+//*****************************************************************************
+//
+// SYSCTRL_ACTLR - Auxilliary Control Register
+//
+//*****************************************************************************
+// Disables lazy stacking of floating point context.
+#define AM_REG_SYSCTRL_ACTLR_DISFPCA_S 9
+#define AM_REG_SYSCTRL_ACTLR_DISFPCA_M 0x00000200
+#define AM_REG_SYSCTRL_ACTLR_DISFPCA(n) (((uint32_t)(n) << 9) & 0x00000200)
+
+// Disables floating point instructions completing out of order with respect to
+// integer instructions.
+#define AM_REG_SYSCTRL_ACTLR_DISOOFP_S 8
+#define AM_REG_SYSCTRL_ACTLR_DISOOFP_M 0x00000100
+#define AM_REG_SYSCTRL_ACTLR_DISOOFP(n) (((uint32_t)(n) << 8) & 0x00000100)
+
+// Disables folding of IT instructions.
+#define AM_REG_SYSCTRL_ACTLR_DISFOLD_S 2
+#define AM_REG_SYSCTRL_ACTLR_DISFOLD_M 0x00000004
+#define AM_REG_SYSCTRL_ACTLR_DISFOLD(n) (((uint32_t)(n) << 2) & 0x00000004)
+
+// Disables write buffer use during default memory map accesses.
+#define AM_REG_SYSCTRL_ACTLR_DISDEFWBUF_S 1
+#define AM_REG_SYSCTRL_ACTLR_DISDEFWBUF_M 0x00000002
+#define AM_REG_SYSCTRL_ACTLR_DISDEFWBUF(n) (((uint32_t)(n) << 1) & 0x00000002)
+
+// Disables interruption of multi-cycle instructions.
+#define AM_REG_SYSCTRL_ACTLR_DISMCYCINT_S 0
+#define AM_REG_SYSCTRL_ACTLR_DISMCYCINT_M 0x00000001
+#define AM_REG_SYSCTRL_ACTLR_DISMCYCINT(n) (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
// SYSCTRL_ICSR - Interrupt Control and State Register
//
//*****************************************************************************
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_systick.h b/bsp/apollo2/libraries/drivers/regs/am_reg_systick.h
index d68a8c4063..0d427dabe2 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_systick.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_systick.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_SYSTICK_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_tpiu.h b/bsp/apollo2/libraries/drivers/regs/am_reg_tpiu.h
index e3719b60f8..f1822a74d5 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_tpiu.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_tpiu.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_TPIU_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_uart.h b/bsp/apollo2/libraries/drivers/regs/am_reg_uart.h
index 493a947630..eabf749939 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_uart.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_uart.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_UART_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_vcomp.h b/bsp/apollo2/libraries/drivers/regs/am_reg_vcomp.h
index 93c610e123..2df6cc8479 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_vcomp.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_vcomp.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_VCOMP_H
diff --git a/bsp/apollo2/libraries/drivers/regs/am_reg_wdt.h b/bsp/apollo2/libraries/drivers/regs/am_reg_wdt.h
index f95ddc1e8d..96fefd898f 100644
--- a/bsp/apollo2/libraries/drivers/regs/am_reg_wdt.h
+++ b/bsp/apollo2/libraries/drivers/regs/am_reg_wdt.h
@@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
-// This is part of revision 1.2.9 of the AmbiqSuite Development Package.
+// This is part of revision 1.2.11 of the AmbiqSuite Development Package.
//
//*****************************************************************************
#ifndef AM_REG_WDT_H
diff --git a/bsp/apollo2/libraries/startup/SConscript b/bsp/apollo2/libraries/startup/SConscript
index bbaef37870..865befb6e9 100644
--- a/bsp/apollo2/libraries/startup/SConscript
+++ b/bsp/apollo2/libraries/startup/SConscript
@@ -18,6 +18,7 @@ elif rtconfig.CROSS_TOOL == 'iar':
src = src + ['iar/' + 'startup_iar.c']
path = [cwd]
+path += [cwd + '/cmsis/include']
CPPDEFINES = ['AM_PACKAGE_BGA', 'AM_PART_APOLLO2']
diff --git a/bsp/apollo2/project.uvoptx b/bsp/apollo2/project.uvoptx
index a546ada74f..5578f1480e 100644
--- a/bsp/apollo2/project.uvoptx
+++ b/bsp/apollo2/project.uvoptx
@@ -161,4 +161,1228 @@
</TargetOption>
</Target>
+ <Group>
+ <GroupName>Applications</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>1</GroupNumber>
+ <FileNumber>1</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>applications\main.c</PathWithFileName>
+ <FilenameWithoutPath>main.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>Board</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>2</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\adc.c</PathWithFileName>
+ <FilenameWithoutPath>adc.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>3</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\board.c</PathWithFileName>
+ <FilenameWithoutPath>board.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>4</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\flash.c</PathWithFileName>
+ <FilenameWithoutPath>flash.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>5</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\gpio.c</PathWithFileName>
+ <FilenameWithoutPath>gpio.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>6</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\i2c.c</PathWithFileName>
+ <FilenameWithoutPath>i2c.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>7</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\led.c</PathWithFileName>
+ <FilenameWithoutPath>led.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>8</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\pdm.c</PathWithFileName>
+ <FilenameWithoutPath>pdm.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>9</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\pwm.c</PathWithFileName>
+ <FilenameWithoutPath>pwm.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>10</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\rtc.c</PathWithFileName>
+ <FilenameWithoutPath>rtc.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>11</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\smbus.c</PathWithFileName>
+ <FilenameWithoutPath>smbus.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>12</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\spi.c</PathWithFileName>
+ <FilenameWithoutPath>spi.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>13</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\uart.c</PathWithFileName>
+ <FilenameWithoutPath>uart.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>Libraries</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>14</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_clkgen.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_clkgen.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>15</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_debug.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_debug.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>16</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_cachectrl.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_cachectrl.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>17</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_pwrctrl.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_pwrctrl.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>18</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_mcuctrl.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_mcuctrl.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>19</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_sysctrl.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_sysctrl.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>20</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_reset.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_reset.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>21</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_stimer.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_stimer.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>22</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_ctimer.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_ctimer.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>23</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_rtc.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_rtc.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>24</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_interrupt.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_interrupt.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>25</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_queue.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_queue.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>26</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_iom.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_iom.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>27</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_ios.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_ios.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>28</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_vcomp.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_vcomp.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>29</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_flash.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_flash.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>30</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_gpio.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_gpio.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>31</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_uart.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_uart.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>32</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_adc.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_adc.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>33</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_pdm.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_pdm.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>34</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\drivers\hal\am_hal_i2c_bit_bang.c</PathWithFileName>
+ <FilenameWithoutPath>am_hal_i2c_bit_bang.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>35</FileNumber>
+ <FileType>2</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>libraries\startup\arm\startup_keil.s</PathWithFileName>
+ <FilenameWithoutPath>startup_keil.s</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>Kernel</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>36</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\clock.c</PathWithFileName>
+ <FilenameWithoutPath>clock.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>37</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\components.c</PathWithFileName>
+ <FilenameWithoutPath>components.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>38</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\device.c</PathWithFileName>
+ <FilenameWithoutPath>device.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>39</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\idle.c</PathWithFileName>
+ <FilenameWithoutPath>idle.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>40</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\ipc.c</PathWithFileName>
+ <FilenameWithoutPath>ipc.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>41</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\irq.c</PathWithFileName>
+ <FilenameWithoutPath>irq.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>42</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\kservice.c</PathWithFileName>
+ <FilenameWithoutPath>kservice.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>43</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\mem.c</PathWithFileName>
+ <FilenameWithoutPath>mem.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>44</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\mempool.c</PathWithFileName>
+ <FilenameWithoutPath>mempool.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>45</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\object.c</PathWithFileName>
+ <FilenameWithoutPath>object.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>46</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\scheduler.c</PathWithFileName>
+ <FilenameWithoutPath>scheduler.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>47</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\signal.c</PathWithFileName>
+ <FilenameWithoutPath>signal.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>48</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\thread.c</PathWithFileName>
+ <FilenameWithoutPath>thread.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>49</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\timer.c</PathWithFileName>
+ <FilenameWithoutPath>timer.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>CORTEX-M4</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>50</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\libcpu\arm\cortex-m4\cpuport.c</PathWithFileName>
+ <FilenameWithoutPath>cpuport.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>51</FileNumber>
+ <FileType>2</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\libcpu\arm\cortex-m4\context_rvds.S</PathWithFileName>
+ <FilenameWithoutPath>context_rvds.S</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>52</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\libcpu\arm\common\backtrace.c</PathWithFileName>
+ <FilenameWithoutPath>backtrace.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>53</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\libcpu\arm\common\div0.c</PathWithFileName>
+ <FilenameWithoutPath>div0.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>54</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\libcpu\arm\common\showmem.c</PathWithFileName>
+ <FilenameWithoutPath>showmem.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>Filesystem</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>55</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\dfs\src\dfs.c</PathWithFileName>
+ <FilenameWithoutPath>dfs.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>56</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\dfs\src\dfs_file.c</PathWithFileName>
+ <FilenameWithoutPath>dfs_file.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>57</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\dfs\src\dfs_fs.c</PathWithFileName>
+ <FilenameWithoutPath>dfs_fs.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>58</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\dfs\src\dfs_posix.c</PathWithFileName>
+ <FilenameWithoutPath>dfs_posix.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>59</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\dfs\src\poll.c</PathWithFileName>
+ <FilenameWithoutPath>poll.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>60</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\dfs\src\select.c</PathWithFileName>
+ <FilenameWithoutPath>select.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>61</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\dfs\filesystems\devfs\devfs.c</PathWithFileName>
+ <FilenameWithoutPath>devfs.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>DeviceDrivers</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>62</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\i2c\i2c_core.c</PathWithFileName>
+ <FilenameWithoutPath>i2c_core.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>63</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\i2c\i2c_dev.c</PathWithFileName>
+ <FilenameWithoutPath>i2c_dev.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>64</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\misc\pin.c</PathWithFileName>
+ <FilenameWithoutPath>pin.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>65</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\rtc\rtc.c</PathWithFileName>
+ <FilenameWithoutPath>rtc_rtc.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>66</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\serial\serial.c</PathWithFileName>
+ <FilenameWithoutPath>serial.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>67</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\spi\spi_core.c</PathWithFileName>
+ <FilenameWithoutPath>spi_core.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>68</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\spi\spi_dev.c</PathWithFileName>
+ <FilenameWithoutPath>spi_dev.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>69</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\completion.c</PathWithFileName>
+ <FilenameWithoutPath>completion.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>70</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\dataqueue.c</PathWithFileName>
+ <FilenameWithoutPath>dataqueue.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>71</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\pipe.c</PathWithFileName>
+ <FilenameWithoutPath>pipe.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>72</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\ringblk_buf.c</PathWithFileName>
+ <FilenameWithoutPath>ringblk_buf.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>73</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\ringbuffer.c</PathWithFileName>
+ <FilenameWithoutPath>ringbuffer.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>74</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\waitqueue.c</PathWithFileName>
+ <FilenameWithoutPath>waitqueue.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>75</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\workqueue.c</PathWithFileName>
+ <FilenameWithoutPath>workqueue.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>finsh</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>76</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\shell.c</PathWithFileName>
+ <FilenameWithoutPath>shell.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>77</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\symbol.c</PathWithFileName>
+ <FilenameWithoutPath>symbol.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>78</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\cmd.c</PathWithFileName>
+ <FilenameWithoutPath>cmd.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>79</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\msh.c</PathWithFileName>
+ <FilenameWithoutPath>msh.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>80</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\msh_cmd.c</PathWithFileName>
+ <FilenameWithoutPath>msh_cmd.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>81</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\msh_file.c</PathWithFileName>
+ <FilenameWithoutPath>msh_file.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>82</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_compiler.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_compiler.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>83</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_error.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_error.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>84</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_heap.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_heap.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>85</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_init.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_init.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>86</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_node.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_node.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>87</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_ops.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_ops.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>88</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_parser.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_parser.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>89</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_var.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_var.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>90</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_vm.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_vm.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>8</GroupNumber>
+ <FileNumber>91</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_token.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_token.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>libc</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>9</GroupNumber>
+ <FileNumber>92</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\libc\compilers\armlibc\libc.c</PathWithFileName>
+ <FilenameWithoutPath>libc.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>9</GroupNumber>
+ <FileNumber>93</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\libc\compilers\armlibc\mem_std.c</PathWithFileName>
+ <FilenameWithoutPath>mem_std.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>9</GroupNumber>
+ <FileNumber>94</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\libc\compilers\armlibc\stdio.c</PathWithFileName>
+ <FilenameWithoutPath>stdio.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>9</GroupNumber>
+ <FileNumber>95</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\libc\compilers\armlibc\stubs.c</PathWithFileName>
+ <FilenameWithoutPath>stubs.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>9</GroupNumber>
+ <FileNumber>96</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\libc\compilers\armlibc\time.c</PathWithFileName>
+ <FilenameWithoutPath>time.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
</ProjectOpt>
diff --git a/bsp/apollo2/project.uvprojx b/bsp/apollo2/project.uvprojx
index 13c1c51fe6..4346b8d5e4 100644
--- a/bsp/apollo2/project.uvprojx
+++ b/bsp/apollo2/project.uvprojx
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
+
<SchemaVersion>2.1</SchemaVersion>
+
<Header>### uVision Project, (C) Keil Software</Header>
+
<Targets>
<Target>
<TargetName>rtthread-apollo2</TargetName>
@@ -15,28 +18,28 @@
<PackID>AmbiqMicro.Apollo_DFP.1.0.0</PackID>
<PackURL>http://s3.asia.ambiqmicro.com/pack/</PackURL>
<Cpu>IROM(0x00000000,0x100000) IRAM(0x10000000,0x40000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE</Cpu>
- <FlashUtilSpec />
- <StartupFile />
+ <FlashUtilSpec></FlashUtilSpec>
+ <StartupFile></StartupFile>
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD10000000 -FC4000 -FN1 -FF0Apollo2 -FS00 -FL010000 -FP0($$Device:AMAPH1KK-KBR$Flash\Apollo2.FLM))</FlashDriverDll>
<DeviceId>0</DeviceId>
<RegisterFile>$$Device:AMAPH1KK-KBR$Device\Include\apollo2.h</RegisterFile>
- <MemoryEnv />
- <Cmp />
- <Asm />
- <Linker />
- <OHString />
- <InfinionOptionDll />
- <SLE66CMisc />
- <SLE66AMisc />
- <SLE66LinkerMisc />
+ <MemoryEnv></MemoryEnv>
+ <Cmp></Cmp>
+ <Asm></Asm>
+ <Linker></Linker>
+ <OHString></OHString>
+ <InfinionOptionDll></InfinionOptionDll>
+ <SLE66CMisc></SLE66CMisc>
+ <SLE66AMisc></SLE66AMisc>
+ <SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile>$$Device:AMAPH1KK-KBR$SVD\apollo2.svd</SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
- <BinPath />
- <IncludePath />
- <LibPath />
- <RegisterFilePath />
- <DBRegisterFilePath />
+ <BinPath></BinPath>
+ <IncludePath></IncludePath>
+ <LibPath></LibPath>
+ <RegisterFilePath></RegisterFilePath>
+ <DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
@@ -58,8 +61,8 @@
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
- <UserProg1Name />
- <UserProg2Name />
+ <UserProg1Name></UserProg1Name>
+ <UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
@@ -68,8 +71,8 @@
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
- <UserProg1Name />
- <UserProg2Name />
+ <UserProg1Name></UserProg1Name>
+ <UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
@@ -79,14 +82,14 @@
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf --bin !L --output rtthread.bin</UserProg1Name>
- <UserProg2Name />
+ <UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
- <SVCSIdString />
+ <SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
@@ -100,8 +103,8 @@
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
- <CustomArgument />
- <IncludeLibraryModules />
+ <CustomArgument></CustomArgument>
+ <IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<DllOption>
@@ -149,18 +152,18 @@
<RunDebugAfterBuild>0</RunDebugAfterBuild>
<TargetSelection>6</TargetSelection>
<SimDlls>
- <CpuDll />
- <CpuDllArguments />
- <PeripheralDll />
- <PeripheralDllArguments />
- <InitializationFile />
+ <CpuDll></CpuDll>
+ <CpuDllArguments></CpuDllArguments>
+ <PeripheralDll></PeripheralDll>
+ <PeripheralDllArguments></PeripheralDllArguments>
+ <InitializationFile></InitializationFile>
</SimDlls>
<TargetDlls>
- <CpuDll />
- <CpuDllArguments />
- <PeripheralDll />
- <PeripheralDllArguments />
- <InitializationFile />
+ <CpuDll></CpuDll>
+ <CpuDllArguments></CpuDllArguments>
+ <PeripheralDll></PeripheralDll>
+ <PeripheralDllArguments></PeripheralDllArguments>
+ <InitializationFile></InitializationFile>
<Driver>Segger\JL2CM3.dll</Driver>
</TargetDlls>
</DebugOption>
@@ -176,10 +179,10 @@
<bUseTDR>1</bUseTDR>
<Flash2>BIN\UL2CM3.DLL</Flash2>
<Flash3>"" ()</Flash3>
- <Flash4 />
- <pFcarmOut />
- <pFcarmGrp />
- <pFcArmRoot />
+ <Flash4></Flash4>
+ <pFcarmOut></pFcarmOut>
+ <pFcarmGrp></pFcarmGrp>
+ <pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<TargetArmAds>
@@ -212,7 +215,7 @@
<RvctClst>0</RvctClst>
<GenPPlst>0</GenPPlst>
<AdsCpuType>"Cortex-M4"</AdsCpuType>
- <RvctDeviceName />
+ <RvctDeviceName></RvctDeviceName>
<mOS>0</mOS>
<uocRom>0</uocRom>
<uocRam>0</uocRam>
@@ -344,7 +347,7 @@
<Size>0x0</Size>
</OCR_RVCT10>
</OnChipMemories>
- <RvctStartVector />
+ <RvctStartVector></RvctStartVector>
</ArmAdsMisc>
<Cads>
<interw>1</interw>
@@ -367,10 +370,10 @@
<vShortEn>1</vShortEn>
<vShortWch>1</vShortWch>
<VariousControls>
- <MiscControls />
- <Define>AM_PART_APOLLO2, RT_USING_ARM_LIBC, AM_PACKAGE_BGA, keil</Define>
- <Undefine />
- <IncludePath>board;libraries/drivers;libraries/startup;applications;.;../../include;../../libcpu/arm/cortex-m4;../../libcpu/arm/common;../../components/drivers/include;../../components/drivers/include;../../components/drivers/include;../../components/drivers/include;../../components/drivers/spi;../../components/drivers/include;../../components/drivers/include;../../components/libc/compilers/armlibc;../../components/finsh;../../components/dfs/include;../../components/dfs/filesystems/devfs</IncludePath>
+ <MiscControls></MiscControls>
+ <Define>AM_PART_APOLLO2, RT_USING_ARM_LIBC, AM_PACKAGE_BGA</Define>
+ <Undefine></Undefine>
+ <IncludePath>applications;.;board;libraries\drivers;libraries\startup;libraries\startup\cmsis\include;..\..\include;..\..\libcpu\arm\cortex-m4;..\..\libcpu\arm\common;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\spi;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\armlibc</IncludePath>
</VariousControls>
</Cads>
<Aads>
@@ -384,10 +387,10 @@
<uSurpInc>0</uSurpInc>
<useXO>0</useXO>
<VariousControls>
- <MiscControls />
- <Define />
- <Undefine />
- <IncludePath />
+ <MiscControls></MiscControls>
+ <Define></Define>
+ <Undefine></Undefine>
+ <IncludePath></IncludePath>
</VariousControls>
</Aads>
<LDads>
@@ -399,101 +402,89 @@
<useFile>0</useFile>
<TextAddressRange>0x00000000</TextAddressRange>
<DataAddressRange>0x20000000</DataAddressRange>
- <pXoBase />
+ <pXoBase></pXoBase>
<ScatterFile>.\build\rtthread.sct</ScatterFile>
- <IncludeLibs />
- <IncludeLibsPath />
+ <IncludeLibs></IncludeLibs>
+ <IncludeLibsPath></IncludeLibsPath>
<Misc> --keep *.o(.rti_fn.*) --keep *.o(FSymTab) --keep *.o(VSymTab) </Misc>
- <LinkerInputFile />
- <DisabledWarnings />
+ <LinkerInputFile></LinkerInputFile>
+ <DisabledWarnings></DisabledWarnings>
</LDads>
</TargetArmAds>
</TargetOption>
<Groups>
<Group>
- <GroupName>Board</GroupName>
+ <GroupName>Applications</GroupName>
<Files>
<File>
- <FileName>adc.c</FileName>
+ <FileName>main.c</FileName>
<FileType>1</FileType>
- <FilePath>board/adc.c</FilePath>
+ <FilePath>applications\main.c</FilePath>
</File>
</Files>
+ </Group>
+ <Group>
+ <GroupName>Board</GroupName>
<Files>
<File>
+ <FileName>adc.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>board\adc.c</FilePath>
+ </File>
+ <File>
<FileName>board.c</FileName>
<FileType>1</FileType>
- <FilePath>board/board.c</FilePath>
+ <FilePath>board\board.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>flash.c</FileName>
<FileType>1</FileType>
- <FilePath>board/flash.c</FilePath>
+ <FilePath>board\flash.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>gpio.c</FileName>
<FileType>1</FileType>
- <FilePath>board/gpio.c</FilePath>
+ <FilePath>board\gpio.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>i2c.c</FileName>
<FileType>1</FileType>
- <FilePath>board/i2c.c</FilePath>
+ <FilePath>board\i2c.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>led.c</FileName>
<FileType>1</FileType>
- <FilePath>board/led.c</FilePath>
+ <FilePath>board\led.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>pdm.c</FileName>
<FileType>1</FileType>
- <FilePath>board/pdm.c</FilePath>
+ <FilePath>board\pdm.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>pwm.c</FileName>
<FileType>1</FileType>
- <FilePath>board/pwm.c</FilePath>
+ <FilePath>board\pwm.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>rtc.c</FileName>
<FileType>1</FileType>
- <FilePath>board/rtc.c</FilePath>
+ <FilePath>board\rtc.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>smbus.c</FileName>
<FileType>1</FileType>
- <FilePath>board/smbus.c</FilePath>
+ <FilePath>board\smbus.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>spi.c</FileName>
<FileType>1</FileType>
- <FilePath>board/spi.c</FilePath>
+ <FilePath>board\spi.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>uart.c</FileName>
<FileType>1</FileType>
- <FilePath>board/uart.c</FilePath>
+ <FilePath>board\uart.c</FilePath>
</File>
</Files>
</Group>
@@ -503,157 +494,112 @@
<File>
<FileName>am_hal_clkgen.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_clkgen.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_clkgen.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_debug.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_debug.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_debug.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_cachectrl.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_cachectrl.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_cachectrl.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_pwrctrl.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_pwrctrl.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_pwrctrl.c</FilePath>
+ </File>
+ <File>
+ <FileName>am_hal_mcuctrl.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>libraries\drivers\hal\am_hal_mcuctrl.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_sysctrl.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_sysctrl.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_sysctrl.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_reset.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_reset.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_reset.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_stimer.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_stimer.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_stimer.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_ctimer.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_ctimer.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_ctimer.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_rtc.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_rtc.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_rtc.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_interrupt.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_interrupt.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_interrupt.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_queue.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_queue.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_queue.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_iom.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_iom.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_iom.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_ios.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_ios.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_ios.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_vcomp.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_vcomp.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_vcomp.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_flash.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_flash.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_flash.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_gpio.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_gpio.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_gpio.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_uart.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_uart.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_uart.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_adc.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_adc.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_adc.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_pdm.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_pdm.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_pdm.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>am_hal_i2c_bit_bang.c</FileName>
<FileType>1</FileType>
- <FilePath>libraries/drivers/hal/am_hal_i2c_bit_bang.c</FilePath>
+ <FilePath>libraries\drivers\hal\am_hal_i2c_bit_bang.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>startup_keil.s</FileName>
<FileType>2</FileType>
- <FilePath>libraries/startup/arm/startup_keil.s</FilePath>
- </File>
- </Files>
- </Group>
- <Group>
- <GroupName>Applications</GroupName>
- <Files>
- <File>
- <FileName>main.c</FileName>
- <FileType>1</FileType>
- <FilePath>applications/main.c</FilePath>
+ <FilePath>libraries\startup\arm\startup_keil.s</FilePath>
</File>
</Files>
</Group>
@@ -663,98 +609,72 @@
<File>
<FileName>clock.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/clock.c</FilePath>
+ <FilePath>..\..\src\clock.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>components.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/components.c</FilePath>
+ <FilePath>..\..\src\components.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>device.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/device.c</FilePath>
+ <FilePath>..\..\src\device.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>idle.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/idle.c</FilePath>
+ <FilePath>..\..\src\idle.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>ipc.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/ipc.c</FilePath>
+ <FilePath>..\..\src\ipc.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>irq.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/irq.c</FilePath>
+ <FilePath>..\..\src\irq.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>kservice.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/kservice.c</FilePath>
+ <FilePath>..\..\src\kservice.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>mem.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/mem.c</FilePath>
+ <FilePath>..\..\src\mem.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>mempool.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/mempool.c</FilePath>
+ <FilePath>..\..\src\mempool.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>object.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/object.c</FilePath>
+ <FilePath>..\..\src\object.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>scheduler.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/scheduler.c</FilePath>
+ <FilePath>..\..\src\scheduler.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>signal.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/signal.c</FilePath>
+ <FilePath>..\..\src\signal.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>thread.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/thread.c</FilePath>
+ <FilePath>..\..\src\thread.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>timer.c</FileName>
<FileType>1</FileType>
- <FilePath>../../src/timer.c</FilePath>
+ <FilePath>..\..\src\timer.c</FilePath>
</File>
</Files>
</Group>
@@ -764,186 +684,206 @@
<File>
<FileName>cpuport.c</FileName>
<FileType>1</FileType>
- <FilePath>../../libcpu/arm/cortex-m4/cpuport.c</FilePath>
+ <FilePath>..\..\libcpu\arm\cortex-m4\cpuport.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>context_rvds.S</FileName>
<FileType>2</FileType>
- <FilePath>../../libcpu/arm/cortex-m4/context_rvds.S</FilePath>
+ <FilePath>..\..\libcpu\arm\cortex-m4\context_rvds.S</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>backtrace.c</FileName>
<FileType>1</FileType>
- <FilePath>../../libcpu/arm/common/backtrace.c</FilePath>
+ <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>div0.c</FileName>
<FileType>1</FileType>
- <FilePath>../../libcpu/arm/common/div0.c</FilePath>
+ <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>showmem.c</FileName>
<FileType>1</FileType>
- <FilePath>../../libcpu/arm/common/showmem.c</FilePath>
+ <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
</File>
</Files>
</Group>
<Group>
- <GroupName>DeviceDrivers</GroupName>
+ <GroupName>Filesystem</GroupName>
<Files>
<File>
- <FileName>pin.c</FileName>
+ <FileName>dfs.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/misc/pin.c</FilePath>
+ <FilePath>..\..\components\dfs\src\dfs.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>i2c_core.c</FileName>
+ <FileName>dfs_file.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/i2c/i2c_core.c</FilePath>
+ <FilePath>..\..\components\dfs\src\dfs_file.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>i2c_dev.c</FileName>
+ <FileName>dfs_fs.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/i2c/i2c_dev.c</FilePath>
+ <FilePath>..\..\components\dfs\src\dfs_fs.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>serial.c</FileName>
+ <FileName>dfs_posix.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/serial/serial.c</FilePath>
+ <FilePath>..\..\components\dfs\src\dfs_posix.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>rtc_rtc.c</FileName>
+ <FileName>poll.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/rtc/rtc.c</FilePath>
+ <FilePath>..\..\components\dfs\src\poll.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>spi_core.c</FileName>
+ <FileName>select.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/spi/spi_core.c</FilePath>
+ <FilePath>..\..\components\dfs\src\select.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>spi_dev.c</FileName>
+ <FileName>devfs.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/spi/spi_dev.c</FilePath>
+ <FilePath>..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
</File>
</Files>
+ </Group>
+ <Group>
+ <GroupName>DeviceDrivers</GroupName>
+ <GroupOption>
+ <CommonProperty>
+ <UseCPPCompiler>0</UseCPPCompiler>
+ <RVCTCodeConst>0</RVCTCodeConst>
+ <RVCTZI>0</RVCTZI>
+ <RVCTOtherData>0</RVCTOtherData>
+ <ModuleSelection>0</ModuleSelection>
+ <IncludeInBuild>1</IncludeInBuild>
+ <AlwaysBuild>0</AlwaysBuild>
+ <GenerateAssemblyFile>0</GenerateAssemblyFile>
+ <AssembleAssemblyFile>0</AssembleAssemblyFile>
+ <PublicsOnly>0</PublicsOnly>
+ <StopOnExitCode>3</StopOnExitCode>
+ <CustomArgument></CustomArgument>
+ <IncludeLibraryModules></IncludeLibraryModules>
+ <ComprImg>0</ComprImg>
+ </CommonProperty>
+ <GroupArmAds>
+ <Cads>
+ <interw>2</interw>
+ <Optim>0</Optim>
+ <oTime>2</oTime>
+ <SplitLS>2</SplitLS>
+ <OneElfS>2</OneElfS>
+ <Strict>2</Strict>
+ <EnumInt>2</EnumInt>
+ <PlainCh>2</PlainCh>
+ <Ropi>2</Ropi>
+ <Rwpi>2</Rwpi>
+ <wLevel>2</wLevel>
+ <uThumb>2</uThumb>
+ <uSurpInc>2</uSurpInc>
+ <uC99>2</uC99>
+ <useXO>2</useXO>
+ <v6Lang>0</v6Lang>
+ <v6LangP>0</v6LangP>
+ <vShortEn>0</vShortEn>
+ <vShortWch>0</vShortWch>
+ <VariousControls>
+ <MiscControls></MiscControls>
+ <Define> </Define>
+ <Undefine> </Undefine>
+ <IncludePath></IncludePath>
+ </VariousControls>
+ </Cads>
+ <Aads>
+ <interw>2</interw>
+ <Ropi>2</Ropi>
+ <Rwpi>2</Rwpi>
+ <thumb>2</thumb>
+ <SplitLS>2</SplitLS>
+ <SwStkChk>2</SwStkChk>
+ <NoWarn>2</NoWarn>
+ <uSurpInc>2</uSurpInc>
+ <useXO>2</useXO>
+ <VariousControls>
+ <MiscControls></MiscControls>
+ <Define></Define>
+ <Undefine></Undefine>
+ <IncludePath></IncludePath>
+ </VariousControls>
+ </Aads>
+ </GroupArmAds>
+ </GroupOption>
<Files>
<File>
- <FileName>completion.c</FileName>
+ <FileName>i2c_core.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/src/completion.c</FilePath>
+ <FilePath>..\..\components\drivers\i2c\i2c_core.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>dataqueue.c</FileName>
+ <FileName>i2c_dev.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/src/dataqueue.c</FilePath>
+ <FilePath>..\..\components\drivers\i2c\i2c_dev.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>pipe.c</FileName>
+ <FileName>pin.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/src/pipe.c</FilePath>
+ <FilePath>..\..\components\drivers\misc\pin.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>ringbuffer.c</FileName>
+ <FileName>rtc_rtc.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/src/ringbuffer.c</FilePath>
+ <FilePath>..\..\components\drivers\rtc\rtc.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>waitqueue.c</FileName>
+ <FileName>serial.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/src/waitqueue.c</FilePath>
+ <FilePath>..\..\components\drivers\serial\serial.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>workqueue.c</FileName>
+ <FileName>spi_core.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/drivers/src/workqueue.c</FilePath>
+ <FilePath>..\..\components\drivers\spi\spi_core.c</FilePath>
</File>
- </Files>
- <GroupOption>
- <GroupArmAds>
- <Cads>
- <VariousControls>
- <MiscControls />
- <Define> </Define>
- <Undefine> </Undefine>
- <IncludePath> </IncludePath>
- </VariousControls>
- </Cads>
- </GroupArmAds>
- </GroupOption>
- </Group>
- <Group>
- <GroupName>libc</GroupName>
- <Files>
<File>
- <FileName>libc.c</FileName>
+ <FileName>spi_dev.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/libc/compilers/armlibc/libc.c</FilePath>
+ <FilePath>..\..\components\drivers\spi\spi_dev.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>libc_syms.c</FileName>
+ <FileName>completion.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/libc/compilers/armlibc/libc_syms.c</FilePath>
+ <FilePath>..\..\components\drivers\src\completion.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>mem_std.c</FileName>
+ <FileName>dataqueue.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/libc/compilers/armlibc/mem_std.c</FilePath>
+ <FilePath>..\..\components\drivers\src\dataqueue.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>stdio.c</FileName>
+ <FileName>pipe.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/libc/compilers/armlibc/stdio.c</FilePath>
+ <FilePath>..\..\components\drivers\src\pipe.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>stubs.c</FileName>
+ <FileName>ringblk_buf.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/libc/compilers/armlibc/stubs.c</FilePath>
+ <FilePath>..\..\components\drivers\src\ringblk_buf.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>time.c</FileName>
+ <FileName>ringbuffer.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\drivers\src\ringbuffer.c</FilePath>
+ </File>
+ <File>
+ <FileName>waitqueue.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\drivers\src\waitqueue.c</FilePath>
+ </File>
+ <File>
+ <FileName>workqueue.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/libc/compilers/armlibc/time.c</FilePath>
+ <FilePath>..\..\components\drivers\src\workqueue.c</FilePath>
</File>
</Files>
</Group>
@@ -953,168 +893,117 @@
<File>
<FileName>shell.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/shell.c</FilePath>
+ <FilePath>..\..\components\finsh\shell.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>symbol.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/symbol.c</FilePath>
+ <FilePath>..\..\components\finsh\symbol.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>cmd.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/cmd.c</FilePath>
+ <FilePath>..\..\components\finsh\cmd.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>msh.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/msh.c</FilePath>
+ <FilePath>..\..\components\finsh\msh.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>msh_cmd.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/msh_cmd.c</FilePath>
+ <FilePath>..\..\components\finsh\msh_cmd.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>msh_file.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/msh_file.c</FilePath>
+ <FilePath>..\..\components\finsh\msh_file.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>finsh_compiler.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/finsh_compiler.c</FilePath>
+ <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>finsh_error.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/finsh_error.c</FilePath>
+ <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>finsh_heap.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/finsh_heap.c</FilePath>
+ <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>finsh_init.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/finsh_init.c</FilePath>
+ <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>finsh_node.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/finsh_node.c</FilePath>
+ <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>finsh_ops.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/finsh_ops.c</FilePath>
+ <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>finsh_parser.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/finsh_parser.c</FilePath>
+ <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>finsh_var.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/finsh_var.c</FilePath>
+ <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>finsh_vm.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/finsh_vm.c</FilePath>
+ <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
</File>
- </Files>
- <Files>
<File>
<FileName>finsh_token.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/finsh/finsh_token.c</FilePath>
+ <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
</File>
</Files>
</Group>
<Group>
- <GroupName>Filesystem</GroupName>
- <Files>
- <File>
- <FileName>dfs.c</FileName>
- <FileType>1</FileType>
- <FilePath>../../components/dfs/src/dfs.c</FilePath>
- </File>
- </Files>
- <Files>
- <File>
- <FileName>dfs_file.c</FileName>
- <FileType>1</FileType>
- <FilePath>../../components/dfs/src/dfs_file.c</FilePath>
- </File>
- </Files>
+ <GroupName>libc</GroupName>
<Files>
<File>
- <FileName>dfs_fs.c</FileName>
+ <FileName>libc.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/dfs/src/dfs_fs.c</FilePath>
+ <FilePath>..\..\components\libc\compilers\armlibc\libc.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>dfs_posix.c</FileName>
+ <FileName>mem_std.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/dfs/src/dfs_posix.c</FilePath>
+ <FilePath>..\..\components\libc\compilers\armlibc\mem_std.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>poll.c</FileName>
+ <FileName>stdio.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/dfs/src/poll.c</FilePath>
+ <FilePath>..\..\components\libc\compilers\armlibc\stdio.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>select.c</FileName>
+ <FileName>stubs.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/dfs/src/select.c</FilePath>
+ <FilePath>..\..\components\libc\compilers\armlibc\stubs.c</FilePath>
</File>
- </Files>
- <Files>
<File>
- <FileName>devfs.c</FileName>
+ <FileName>time.c</FileName>
<FileType>1</FileType>
- <FilePath>../../components/dfs/filesystems/devfs/devfs.c</FilePath>
+ <FilePath>..\..\components\libc\compilers\armlibc\time.c</FilePath>
</File>
</Files>
</Group>
</Groups>
</Target>
</Targets>
+
</Project>
diff --git a/bsp/apollo2/rtthread.sct b/bsp/apollo2/rtthread.sct
new file mode 100644
index 0000000000..507ebdca1a
--- /dev/null
+++ b/bsp/apollo2/rtthread.sct
@@ -0,0 +1,14 @@
+; *************************************************************
+; *** Scatter-Loading Description File generated by uVision ***
+; *************************************************************
+
+LR_IROM1 0x00006000 0x000FFFFF { ; load region size_region
+ ER_IROM1 0x00006000 0x000FFFFF { ; load address = execution address
+ *.o (RESET, +First)
+ *(InRoot$$Sections)
+ .ANY (+RO)
+ }
+ RW_IRAM1 0x10000000 0x00040000 { ; RW data
+ .ANY (+RW +ZI)
+ }
+}