|
|
@ -16,8 +16,10 @@ osThreadId xync_signal_report_thread_id; |
|
|
|
static uint32_t m_sync_count = 0; |
|
|
|
static uint32_t m_camera_sync_packet_report_period = 1; |
|
|
|
|
|
|
|
static uint32_t m_xsync_workstate_start_sig_irq_pin_off; |
|
|
|
static uint32_t m_timecode_trigger_input_off; |
|
|
|
static uint32_t m_xync_trigger_input_off; |
|
|
|
static uint32_t m_xync_trigger_input_off; |
|
|
|
#define TAG "timecode" |
|
|
|
/** |
|
|
|
* @brief 构建并发送时间码数据包 |
|
|
@ -26,12 +28,21 @@ static uint32_t m_xync_trigger_input_off; |
|
|
|
* @param timecode0 |
|
|
|
* @param timecode1 |
|
|
|
*/ |
|
|
|
|
|
|
|
static void create_and_send_timecode(uint32_t timecode0, uint32_t timecode1) { |
|
|
|
static uint8_t txbuf[256]; |
|
|
|
iflytop_timecode_report_packet_t *txpacket = (iflytop_timecode_report_packet_t *)txbuf; |
|
|
|
txpacket->timecode0 = timecode0; |
|
|
|
txpacket->timecode1 = timecode1; |
|
|
|
xs_udp_broadcast(&m_udp_camera_timecode_sender, IFLYTOP_XSYNC_TIMECODE_REPORT_PC_PORT, txbuf, sizeof(iflytop_timecode_report_packet_t)); |
|
|
|
static uint8_t txbuf[256]; |
|
|
|
iflytop_xsync_event_report_packet_t *txpacket = (iflytop_xsync_event_report_packet_t *)txbuf; |
|
|
|
txpacket->eventid = ktimecode_report_event; |
|
|
|
txpacket->data[0] = timecode0; |
|
|
|
txpacket->data[1] = timecode1; |
|
|
|
xs_udp_broadcast(&m_udp_camera_timecode_sender, IFLYTOP_XSYNC_EVENT_REPORT_PC_PORT, txbuf, sizeof(iflytop_xsync_event_report_packet_t) + 8); |
|
|
|
} |
|
|
|
static void create_and_send_sync_workstate_packet(uint32_t workstate) { |
|
|
|
static uint8_t txbuf[256]; |
|
|
|
iflytop_xsync_event_report_packet_t *txpacket = (iflytop_xsync_event_report_packet_t *)txbuf; |
|
|
|
txpacket->eventid = kxsync_work_state_report_event; |
|
|
|
txpacket->data[0] = workstate; |
|
|
|
xs_udp_broadcast(&m_udp_camera_timecode_sender, IFLYTOP_XSYNC_EVENT_REPORT_PC_PORT, txbuf, sizeof(iflytop_xsync_event_report_packet_t) + 4); |
|
|
|
} |
|
|
|
/** |
|
|
|
* @brief 构建并发送相机同步数据包 |
|
|
@ -54,13 +65,16 @@ static void create_and_send_camera_sync_msg(uint32_t count) { |
|
|
|
|
|
|
|
static void timecode_report_thread(void const *argument) { |
|
|
|
while (true) { |
|
|
|
osEvent signal = osSignalWait(0x01, osWaitForever); |
|
|
|
if (signal.value.signals == 0x01) { |
|
|
|
osEvent signal = osSignalWait(0x03, osWaitForever); |
|
|
|
if (signal.value.signals & 0x01) { |
|
|
|
uint32_t timecode0, timecode1; |
|
|
|
fpga_if_get_timecode(&timecode0, &timecode1); |
|
|
|
create_and_send_timecode(timecode0, timecode1); |
|
|
|
} else if (signal.value.signals & 0x02) { |
|
|
|
uint32_t workstate; |
|
|
|
fpga_if_get_workstate(&workstate); |
|
|
|
create_and_send_sync_workstate_packet(workstate); |
|
|
|
} |
|
|
|
// osSignalClear(timecode_report_thread_id, 0x01); |
|
|
|
} |
|
|
|
} |
|
|
|
static void xync_signal_report_thread(void const *argument) { |
|
|
@ -78,9 +92,11 @@ static void xync_signal_report_thread(void const *argument) { |
|
|
|
|
|
|
|
void ReportGeneratorService_irq_trigger(uint16_t gpiopin) { |
|
|
|
if (gpiopin == m_timecode_trigger_input_off) { |
|
|
|
// printf("1trigger\n"); |
|
|
|
osSignalSet(timecode_report_thread_id, 0x01); |
|
|
|
} |
|
|
|
if (m_xsync_workstate_start_sig_irq_pin_off == gpiopin) { |
|
|
|
osSignalSet(timecode_report_thread_id, 0x02); |
|
|
|
} |
|
|
|
if (gpiopin == m_xync_trigger_input_off) { |
|
|
|
// printf("2trigger\n"); |
|
|
|
osSignalSet(xync_signal_report_thread_id, 0x01); |
|
|
@ -89,8 +105,9 @@ void ReportGeneratorService_irq_trigger(uint16_t gpiopin) { |
|
|
|
|
|
|
|
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)); |
|
|
|
ZASSERT(xs_udp_broadcast_init(&m_udp_camera_timecode_sender, IFLYTOP_XSYNC_EVENT_REPORT_XSYNC_PORT)); |
|
|
|
|
|
|
|
// |
|
|
|
osThreadDef(timecode_report_thread, timecode_report_thread, TIMECODE_REPORT_TASK_LEVEL, 0, 512); |
|
|
|
timecode_report_thread_id = osThreadCreate(osThread(timecode_report_thread), NULL); |
|
|
|
|
|
|
@ -100,8 +117,9 @@ void ReportGeneratorService_init() { |
|
|
|
ZASSERT(timecode_report_thread_id != NULL); |
|
|
|
ZASSERT(xync_signal_report_thread_id != NULL); |
|
|
|
|
|
|
|
m_timecode_trigger_input_off = fpga_if_get_instance()->timecode_irq_io.pinoff; |
|
|
|
m_xync_trigger_input_off = fpga_if_get_instance()->camera_sync_code_irq_io.pinoff; |
|
|
|
m_timecode_trigger_input_off = fpga_if_get_instance()->timecode_irq_io.pinoff; |
|
|
|
m_xync_trigger_input_off = fpga_if_get_instance()->camera_sync_code_irq_io.pinoff; |
|
|
|
m_xsync_workstate_start_sig_irq_pin_off = fpga_if_get_instance()->xsync_workstate_start_sig_irq_io.pinoff; |
|
|
|
} |
|
|
|
|
|
|
|
void ReportGeneratorService_xsync_set_count(uint32_t count) { m_sync_count = count; } |
|
|
|