|
|
@ -3,9 +3,9 @@ |
|
|
|
#include "project_dep.h" |
|
|
|
// |
|
|
|
#include "base_service/fpga_if.h" |
|
|
|
#include "base_service/task_level_config.h" |
|
|
|
#include "iflytop_xsync\xs_udp.h" |
|
|
|
#include "reg_manager.h" |
|
|
|
#include "base_service/task_level_config.h" |
|
|
|
|
|
|
|
static udp_broadcast_handler_t m_udp_camera_sync_sender; // |
|
|
|
static udp_broadcast_handler_t m_udp_camera_timecode_sender; // |
|
|
@ -13,7 +13,8 @@ static udp_broadcast_handler_t m_udp_camera_timecode_sender; // |
|
|
|
osThreadId timecode_report_thread_id; |
|
|
|
osThreadId xync_signal_report_thread_id; |
|
|
|
|
|
|
|
static uint32_t m_sync_count = 0; |
|
|
|
static uint32_t m_sync_count = 0; |
|
|
|
static uint32_t m_camera_sync_packet_report_period = 1; |
|
|
|
|
|
|
|
static uint32_t m_timecode_trigger_input_off; |
|
|
|
static uint32_t m_xync_trigger_input_off; |
|
|
@ -65,12 +66,17 @@ static void timecode_report_thread(void const *argument) { |
|
|
|
static void xync_signal_report_thread(void const *argument) { |
|
|
|
while (true) { |
|
|
|
osEvent signal = osSignalWait(0x01, osWaitForever); |
|
|
|
if (signal.value.signals == 0x01) create_and_send_camera_sync_msg(m_sync_count++); |
|
|
|
if (signal.value.signals == 0x01) { |
|
|
|
if (m_sync_count % m_camera_sync_packet_report_period == 0) { |
|
|
|
create_and_send_camera_sync_msg(m_sync_count); |
|
|
|
} |
|
|
|
m_sync_count++; |
|
|
|
} |
|
|
|
// osSignalClear(xync_signal_report_thread_id, 0x01); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void report_generator_service_irq_trigger(uint16_t gpiopin) { |
|
|
|
void ReportGeneratorService_irq_trigger(uint16_t gpiopin) { |
|
|
|
if (gpiopin == m_timecode_trigger_input_off) { |
|
|
|
// printf("1trigger\n"); |
|
|
|
osSignalSet(timecode_report_thread_id, 0x01); |
|
|
@ -81,7 +87,7 @@ void report_generator_service_irq_trigger(uint16_t gpiopin) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void report_generator_service_init() { |
|
|
|
void ReportGeneratorService_init() { |
|
|
|
ZASSERT(xs_udp_broadcast_init(&m_udp_camera_sync_sender, IFLYTOP_XSYNC_CAMERA_SYNC_PACKET_XSYNC_PORT)); |
|
|
|
ZASSERT(xs_udp_broadcast_init(&m_udp_camera_timecode_sender, IFLYTOP_XSYNC_TIMECODE_REPORT_XSYNC_PORT)); |
|
|
|
|
|
|
@ -98,7 +104,12 @@ void report_generator_service_init() { |
|
|
|
m_xync_trigger_input_off = fpga_if_get_instance()->camera_sync_code_irq_io.pinoff; |
|
|
|
} |
|
|
|
|
|
|
|
void report_generator_service_xsync_set_count(uint32_t count){ |
|
|
|
m_sync_count = count; |
|
|
|
void ReportGeneratorService_xsync_set_count(uint32_t count) { m_sync_count = count; } |
|
|
|
uint32_t ReportGeneratorService_xsync_get_count(void) { return m_sync_count; } |
|
|
|
uint32_t ReportGeneratorService_set_camera_sync_code_report_period(uint32_t period) { |
|
|
|
if (period == 0) period = 1; |
|
|
|
m_camera_sync_packet_report_period = period; |
|
|
|
return period; |
|
|
|
} |
|
|
|
uint32_t report_generator_service_xsync_get_count(void) { return m_sync_count; } |
|
|
|
|
|
|
|
uint32_t ReportGeneratorService_get_camera_sync_code_report_period(void) { return m_camera_sync_packet_report_period; } |