2017-08-15 02:45:40 -04:00
|
|
|
/* Implementation of utility functions to verify
|
|
|
|
unit tests aren't performing SMP-unsafe DPORT reads.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "unity.h"
|
|
|
|
#include "sdkconfig.h"
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
#include "freertos/task.h"
|
2019-05-13 06:02:45 -04:00
|
|
|
#include "soc/uart_periph.h"
|
2017-08-15 02:45:40 -04:00
|
|
|
#include "test_apb_dport_access.h"
|
2018-10-25 00:52:32 -04:00
|
|
|
#include "test_utils.h"
|
2017-08-15 02:45:40 -04:00
|
|
|
|
|
|
|
#ifndef CONFIG_FREERTOS_UNICORE
|
|
|
|
|
|
|
|
static void apb_access_loop_task(void *ignore);
|
|
|
|
|
|
|
|
static volatile bool apb_access_corrupt;
|
|
|
|
static TaskHandle_t apb_task_handle;
|
|
|
|
|
2019-07-16 05:33:30 -04:00
|
|
|
void start_apb_access_loop(void)
|
2017-08-15 02:45:40 -04:00
|
|
|
{
|
|
|
|
apb_access_corrupt = false;
|
|
|
|
xTaskCreatePinnedToCore(apb_access_loop_task, "accessAPB", 2048, NULL,
|
|
|
|
UNITY_FREERTOS_PRIORITY - 1,
|
|
|
|
&apb_task_handle, !UNITY_FREERTOS_CPU);
|
|
|
|
}
|
|
|
|
|
2019-07-16 05:33:30 -04:00
|
|
|
void verify_apb_access_loop(void)
|
2017-08-15 02:45:40 -04:00
|
|
|
{
|
|
|
|
vTaskDelete(apb_task_handle);
|
|
|
|
apb_task_handle = NULL;
|
|
|
|
TEST_ASSERT_FALSE(apb_access_corrupt);
|
|
|
|
printf("Verified no APB corruption from operations\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void apb_access_loop_task(void *ignore)
|
|
|
|
{
|
|
|
|
uint32_t initial = REG_READ(UART_DATE_REG(0));
|
|
|
|
while(1) {
|
|
|
|
if (REG_READ(UART_DATE_REG(0)) != initial) {
|
|
|
|
apb_access_corrupt = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /*CONFIG_FREERTOS_UNICORE */
|
|
|
|
|
2019-07-16 05:33:30 -04:00
|
|
|
void start_apb_access_loop(void)
|
2017-08-15 02:45:40 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-07-16 05:33:30 -04:00
|
|
|
void verify_apb_access_loop(void)
|
2017-08-15 02:45:40 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|