2022-03-20 23:46:24 +01:00
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
/* Includes */
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
#define _DRUMMER_C_
|
2022-03-20 23:46:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <drummer.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
2022-04-20 12:37:32 +02:00
|
|
|
/* DR_Init */
|
2022-03-20 23:46:24 +01:00
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
|
2022-05-14 23:53:23 +02:00
|
|
|
DRT_Status DR_Init()
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
DRT_Status status;
|
2022-03-20 23:46:24 +01:00
|
|
|
|
|
|
|
|
2022-05-14 23:53:23 +02:00
|
|
|
if( ( status = DR_DataStruct_Init( DRD_LOG_WRITER_DEFAULT, DRD_SAMPLE_RATE_DEFAULT, DRD_THREAD_NUMBER_DEFAULT)) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
fprintf( stderr, "Can't init data structures (%d) !", status);
|
|
|
|
return( status);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
2022-03-23 22:57:26 +01:00
|
|
|
|
|
|
|
return( status);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
2022-04-20 12:37:32 +02:00
|
|
|
/* DR_DeInit */
|
2022-03-20 23:46:24 +01:00
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
|
2022-05-14 23:53:23 +02:00
|
|
|
DRT_Status DR_DeInit()
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
DRT_Status status;
|
2022-03-23 22:57:26 +01:00
|
|
|
|
2022-03-20 23:46:24 +01:00
|
|
|
|
2022-05-14 23:53:23 +02:00
|
|
|
if( ( status = DR_DataStruct_DeInit()) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
printf( "Can't deinit data structures (%d)!\n", status);
|
|
|
|
return( status);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return( status);
|
|
|
|
}
|
|
|
|
|
2022-03-23 22:57:26 +01:00
|
|
|
|
2022-03-20 23:46:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
2022-04-20 12:37:32 +02:00
|
|
|
/* main */
|
2022-03-20 23:46:24 +01:00
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
int main( int argc, char **argv)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
DRT_Status status;
|
|
|
|
DRT_Kit *kit_ptr;
|
2022-04-27 23:13:33 +02:00
|
|
|
DRT_Id i;
|
2022-03-23 22:57:26 +01:00
|
|
|
|
|
|
|
|
2022-05-14 23:53:23 +02:00
|
|
|
if( ( status = DR_Init()) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
exit( -1);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
2022-03-23 22:57:26 +01:00
|
|
|
|
2022-05-14 23:53:23 +02:00
|
|
|
if( ( status = DR_Kits_Load()) != DRS_OK)
|
2022-04-20 12:37:32 +02:00
|
|
|
{
|
|
|
|
exit( -1);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
2022-04-27 23:13:33 +02:00
|
|
|
/*
|
|
|
|
if( ( status = DR_Kit_Id_Find( &kit_ptr, base.Kit_DS_Ptr, 0)) != DRS_OK)
|
|
|
|
// if( ( status = DR_Kit_Logical_Id_Find( &kit_ptr, base.Kit_DS_Ptr, 31)) != DRS_OK)
|
|
|
|
// if( ( status = DR_Kit_Name_Find( &kit_ptr, base.Kit_DS_Ptr, "HardElectro1")) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
exit( -1);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-04-27 23:13:33 +02:00
|
|
|
if( ( status = DR_Kit_Sample_Load( kit_ptr)) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
exit( -1);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
2022-04-20 12:37:32 +02:00
|
|
|
/*
|
|
|
|
fprintf( stderr, "Before!\n");
|
2022-03-20 23:46:24 +01:00
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
if( ( status = DR_Kit_Sample_UnLoad( kit_ptr)) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
exit( -1);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
2022-04-27 23:13:33 +02:00
|
|
|
*/
|
|
|
|
/*
|
2022-04-20 12:37:32 +02:00
|
|
|
fprintf( stderr, "After!\n");
|
|
|
|
|
2022-04-27 23:13:33 +02:00
|
|
|
if( ( status = DR_Kit_Sample_Load( kit_ptr)) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
exit( -1);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
2022-04-27 23:13:33 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
// }
|
2022-03-20 23:46:24 +01:00
|
|
|
|
2022-05-14 23:53:23 +02:00
|
|
|
DR_Kits_Sample_Load();
|
2022-04-27 23:13:33 +02:00
|
|
|
|
|
|
|
/*
|
2022-04-29 20:48:54 +02:00
|
|
|
for( i = 0; i < 1; i++)
|
2022-04-27 23:13:33 +02:00
|
|
|
{
|
|
|
|
if( ( status = DR_Kit_Logical_Id_Find( &kit_ptr, base.Kit_DS_Ptr, i)) == DRS_OK)
|
|
|
|
{
|
|
|
|
printf( "Loading Logical Id: (%d)\n", i);
|
|
|
|
DR_Kit_Sample_Load( kit_ptr);
|
|
|
|
}
|
|
|
|
}
|
2022-04-29 20:48:54 +02:00
|
|
|
*/
|
2022-04-27 23:13:33 +02:00
|
|
|
/*
|
|
|
|
if( DR_Task_Wait( &base) != DRS_OK)
|
|
|
|
{
|
|
|
|
printf( "DR_Task_Wait failed (%d)!\n");
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2022-05-14 23:53:23 +02:00
|
|
|
DR_LOG_INFO_0( "hello world!");
|
2022-04-27 23:13:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// DR_Kits_Graph_Dump( &base);
|
2022-03-20 23:46:24 +01:00
|
|
|
|
2022-04-27 23:13:33 +02:00
|
|
|
/*
|
2022-03-20 23:46:24 +01:00
|
|
|
if( ( status = DR_Kits_Dump( &base)) != DRS_OK)
|
|
|
|
{
|
|
|
|
exit( -1);
|
|
|
|
}
|
2022-04-27 23:13:33 +02:00
|
|
|
*/
|
|
|
|
/*
|
|
|
|
DR_Task_Run( &base, (DRT_Instrument *)1);
|
|
|
|
DR_Task_Run( &base, (DRT_Instrument *)2);
|
|
|
|
DR_Task_Run( &base, (DRT_Instrument *)3);
|
|
|
|
*/
|
|
|
|
// sleep( 10);
|
|
|
|
|
|
|
|
/*
|
|
|
|
if( ( status = DR_Tasks_Dump( &base)) != DRS_OK)
|
|
|
|
{
|
|
|
|
exit( -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if( ( status = DR_Task_Wait( &base)) != DRS_OK)
|
|
|
|
{
|
|
|
|
exit( -1);
|
|
|
|
}
|
|
|
|
*/
|
2022-05-14 23:53:23 +02:00
|
|
|
if( ( status = DR_Tasks_Dump()) != DRS_OK)
|
2022-04-27 23:13:33 +02:00
|
|
|
{
|
|
|
|
exit( -1);
|
|
|
|
}
|
|
|
|
|
2022-05-14 23:53:23 +02:00
|
|
|
if( ( status = DR_Kits_Stats_Dump()) != DRS_OK)
|
2022-04-27 23:13:33 +02:00
|
|
|
{
|
|
|
|
exit( -1);
|
|
|
|
}
|
2022-03-20 23:46:24 +01:00
|
|
|
|
2022-05-14 23:53:23 +02:00
|
|
|
if( ( status = DR_DeInit()) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
|
|
|
exit( -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
exit( 0);
|
|
|
|
}
|