#include #include #include #include #include #innclude #include #include #include #define FIFO 0 #define BASE 0x378 #define CPU_CLOCK 1675888202.0 /* Enter your Cpu clock frequency*/ #define Kp 3 #define Ki 0.01 #define set_point_speed 0 /* Enter set point speed*/ #define TIMERTICKS 5000000 /*5ms*/ volatile int stop = 0; static float cofk,Vm_sin=5,Vm_tri=10;/*Vm_=Vmax*//*n, no.of samples taken=400*/ sataic int eof[100],n=400,rt_speed; static RTIME tick_period,now; unsigned int cpu_clock_count; static float Vsin_k [100], Vtri_k [100]; static float Mag_level_Var_sin=64.0, Mag_level_Var_tri=256.0;/*Magnitude levels*/ int main () { RT_TASK *task; pthread_t th0,th1,th2,th3,th4; task = rt_task_init(nam2num("main"), 10, 4096, 0); if(task == 0) exit(1); rt_set_periodic_mode(); tick_period = start_rt_timer(nano2count(TIMERTICKS)); now = rt_get_time(); pthread_create(&th0, 0, rt_task_pid, 0); pthread_create(&th1, 0, rt_task_in_put, 0); pthread_create(&th2, 0, rt_task_out_put, 0); pthread_create(&th3, 0, rt_task_sin, 0); pthread_create(&th4, 0, rt_task_tri, 0); getchar(); stop = 1; pthread_join(th0, 0); pthread_join(th1, 0); pthread_join(th2, 0); pthread_join(th3, 0); pthread_join(th4, 0); stop_rt_timer(); rt_busy_sleep(10000000); rt_task_delete(task); return 0; }