55 lines
1.5 KiB
C
55 lines
1.5 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 2025 Kozmotronik Tech
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "test_common.h"
|
|
#include "freertos/semphr.h"
|
|
#include <stdarg.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// This is defined in the source file, we redefine it here for the test.
|
|
// The test build must have the same CONFIG_RELAY_CHN_COUNT.
|
|
#define TEST_RELAY_CHN_NOTIFY_QUEUE_LEN (16 + CONFIG_RELAY_CHN_COUNT * 4)
|
|
|
|
// --- Listener Test Globals ---
|
|
typedef struct {
|
|
uint8_t chn_id;
|
|
relay_chn_state_t old_state;
|
|
relay_chn_state_t new_state;
|
|
int call_count;
|
|
} listener_callback_info_t;
|
|
|
|
// --- Listener callback infos to be defined ---
|
|
extern listener_callback_info_t listener1_info;
|
|
extern listener_callback_info_t listener2_info;
|
|
|
|
// --- Globals for Advanced Tests ---
|
|
extern SemaphoreHandle_t blocking_listener_sem;
|
|
extern SemaphoreHandle_t log_check_sem;
|
|
extern volatile int blocking_listener_call_count;
|
|
extern vprintf_like_t original_vprintf;
|
|
|
|
|
|
// --- Listener Test Helper Functions ---
|
|
|
|
// Clear the memory from possible garbage values
|
|
void reset_listener_info(listener_callback_info_t* info);
|
|
|
|
// State listeners for notify module testing
|
|
void test_listener_1(uint8_t chn_id, relay_chn_state_t old_state, relay_chn_state_t new_state);
|
|
void test_listener_2(uint8_t chn_id, relay_chn_state_t old_state, relay_chn_state_t new_state);
|
|
void blocking_listener(uint8_t chn_id, relay_chn_state_t old_state, relay_chn_state_t new_state);
|
|
|
|
int log_check_vprintf(const char *format, va_list args);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|