1616 * limitations under the License.
1717 */
1818
19+ #include "data_in.h"
20+
21+ #ifndef SIMULATOR // If hardware target is selected
22+
1923#include <stddef.h>
2024#include <stdio.h>
2125#include <string.h>
22-
2326#include "cmsis_os2.h"
24-
25- #ifndef SIMULATOR
2627#include "cmsis_vstream.h"
27- #endif
28-
2928#include "sds.h"
3029#include "sds_main.h"
3130#include "algorithm_config.h"
32- #include "data_in.h"
33-
3431#include "app_setup.h"
3532#include "image_processing_func.h"
3633
37- #ifndef SIMULATOR
3834#ifdef USE_SEGGER_SYSVIEW
3935#include "SEGGER_SYSVIEW.h"
4036#include "sysview_markers.h"
@@ -72,7 +68,6 @@ void VideoIn_Event_Callback (uint32_t event) {
7268void VideoOut_Event_Callback (uint32_t event ) {
7369 (void )event ;
7470}
75- #endif
7671
7772/**
7873 \fn int32_t InitInputData (void)
@@ -81,7 +76,6 @@ void VideoOut_Event_Callback (uint32_t event) {
8176*/
8277int32_t InitInputData (void ) {
8378
84- #ifndef SIMULATOR
8579#ifdef USE_SEGGER_SYSVIEW
8680 // Set an initial marker with ID 0xFF to initialize marker tracking. This marker is ignored by SystemView.
8781 SEGGER_SYSVIEW_NameMarker (0xFFU , "Reserved" );
@@ -105,7 +99,6 @@ int32_t InitInputData (void) {
10599 SDS_PRINTF ("Failed to set buffer for video input\n" );
106100 return -1 ;
107101 }
108- #endif
109102
110103 return 0 ;
111104}
@@ -116,19 +109,17 @@ int32_t InitInputData (void) {
116109*/
117110void DiscardInputData (void ) {
118111
119- #ifndef SIMULATOR
120112 /* Check for new video input frame */
121- uint32_t flags = osThreadFlagsWait (0x01 , osFlagsWaitAny , 0U );
113+ uint32_t flags = osThreadFlagsWait (0x01U , osFlagsWaitAny , 0U );
122114
123115 if (((flags & osFlagsError ) == 0U ) && // If not an error and
124116 ((flags & 0x01 ) != 0U )) { // if flag is set
125117
126- /* Release input frame */
118+ /* Release video input frame */
127119 if (vStream_VideoIn -> ReleaseBlock () != VSTREAM_OK ) {
128120 SDS_PRINTF ("Failed to release video input frame\n" );
129121 }
130122 }
131- #endif
132123}
133124
134125/**
@@ -140,7 +131,6 @@ void DiscardInputData (void) {
140131 \return number of data bytes returned; -1 on error
141132*/
142133int32_t GetInputData (uint8_t * buf , uint32_t max_len ) {
143- #ifndef SIMULATOR
144134 int32_t ret ;
145135 uint8_t * inFrame ;
146136
@@ -234,13 +224,8 @@ int32_t GetInputData (uint8_t *buf, uint32_t max_len) {
234224#endif
235225
236226 return ALGO_DATA_IN_BLOCK_SIZE ;
237- #else
238- return 0 ;
239- #endif
240227}
241228
242-
243- #ifndef SIMULATOR
244229/*
245230 Converts camera frame and copies it to RGB image buffer.
246231
@@ -356,4 +341,9 @@ static void convert_frame_to_rgb(uint8_t *inFrame) {
356341 #endif
357342 #endif
358343}
359- #endif
344+
345+ #else // If simulator target is selected
346+ int32_t InitInputData (void ) { return -1 ; }
347+ void DiscardInputData (void ) { }
348+ int32_t GetInputData (uint8_t * buf , uint32_t max_len ) { return -1 ; }
349+ #endif
0 commit comments