/*
 *  This Task is a periodic task example
 *
 *
 *
 */
#include <rtl_conf.h>
#include <time.h>
#include <pthread.h>
#include <rtl_ipc.h>
#include <rtl_printf.h>
#include <rtl_posixio.h>
#include <semaphore.h>
#include <rtl_barrier.h>
#include <unistd.h>
#include "examples.h"

#if PERIODIC_EXAMPLE 

#if CONFIG_XTRATUM
#include <arch/XtratuM_API.h>
#endif

static unsigned long valor1=0x0;
static unsigned long valor2=0x0;


pthread_t thread1;
pthread_t thread2;


void *task1(void *arg)
{
  int x=1;
  pthread_make_periodic_np (pthread_self(), gethrtime(),1000000000);
  while(1)
  {
    pthread_wait_np ();
    rtl_printf("Task 1\n");   
    valor1++;
  };
  
  return 0;
};

void *task2(void *arg)
{

  pthread_make_periodic_np (pthread_self(), gethrtime(),5000000000);
  
  while(1)
  {
    pthread_wait_np ();
    rtl_printf("Task 2\n");    
    valor2++;
  };
  
  return 0;
};






#endif
