]> rtime.felk.cvut.cz Git - frescor/fna.git/commitdiff
makefile with frsh
authorsangorrin <sangorrin@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Mon, 3 Sep 2007 17:38:38 +0000 (17:38 +0000)
committersangorrin <sangorrin@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Mon, 3 Sep 2007 17:38:38 +0000 (17:38 +0000)
git-svn-id: http://www.frescor.org/private/svn/frescor/fna/trunk@689 35b4ef3e-fd22-0410-ab77-dab3279adceb

src_rtep/tests/Makefile
src_rtep/tests/test_c_frsh.c [deleted file]
src_rtep/tests/test_c_rtep_fna.c.old [deleted file]

index c65dd574e83b7de34324061782ee80ca64c80420..281db379546627131621f9bc38cbb09cad117c6f 100644 (file)
@@ -11,7 +11,9 @@ C_FLAGS = -DRTEP -DMARTE_OS -g -Wall
 
 %:
        @exec echo -en "\n>> Compiling $@: ";
-       @if [ -f $@.c ]; then $(CC) $(C_FLAGS) $@.c $(C_INCLUDES) -L../../lib -lrtepfna -L$(MARTE_PATH)/drivers/rt-ep/ -lrtep 1> /dev/null; fi
+       @if [ -f $@.c ]; then $(CC) $(C_FLAGS) $@.c $(C_INCLUDES) \
+       -L../../lib -lrtepfna -L$(MARTE_PATH)/drivers/rt-ep/ -lrtep \
+       -L../../../frsh/lib -lfrsh -L../../../fosa/lib -lfosa_$(PLATFORM) -lm 1> /dev/null; fi
        @if [ -f $@.adb ]; then $(GNAT) $(ADA_FLAGS) $@.adb $(ADA_INCLUDES) 1> /dev/null; fi
        @exec echo "  [OK]";
 
diff --git a/src_rtep/tests/test_c_frsh.c b/src_rtep/tests/test_c_frsh.c
deleted file mode 100644 (file)
index fa99861..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-#include <pthread.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <misc/error_checks.h>
-#include <misc/load.h>
-#include "../rtep.h"
-#include "../frsh/fna/include/fna.h"
-
-int main ()
-{
-   uint16_t me;
-   int ret;
-
-   adjust ();
-   rtep_adainit();
-
-   // ret = pthread_setschedprio (pthread_self(),5);
-
-   // FRSH_Distributed.Init;
-   rtep_fna_init();
-
-   // Ada.Text_Io.Put_Line ("I am "&RTEP.Station_ID'Image (RP.Get_Station_ID));
-   me = rtep_get_station_id();
-   printf ("I am: %u\n", me);
-
-   // FRSH_Distributed.Set_Basic_Parameters
-   //    (Contract, Budget_Min, Period_Max, Deadline);
-   ret = frsh_contract_set_basic_parameters
-      (&contract, b_min, per_max_sec, per_max_nsec, deadline);
-
-   // FRSH_Distributed.Set_Priority (Contract, Prio);
-   ret = rtep_frsh_contract_set_priority (&contract, prio);
-
-   // FRSH_Distributed.Negotiate_Contract
-   //    (Contract, Vres, Accepted);
-   ret = rtep_fna_vres_create (&contract, &vres, &acccepted);
-
-   // if not Accepted then
-   //    Ada.Text_Io.Put_Line ("Contract Not Accepted");
-   //    return;
-   // end if;
-   if (!accepted) {
-      printf ("contract not accepted\n");
-      return -1;
-   }
-
-   // Ada.Text_Io.Put_Line ("Contract Accepted");
-   printf ("contract accepted\n");
-
-   // S_Id := FRSH_Distributed.Get_Server_Id (Vres);
-   // loop
-   //    RP.Send_Info
-   //       (Destination_Station_ID  => Dest_Id,
-   //       Channel_ID              => Chan,
-   //       Data => RTEP_Streams.To_Stream_Element_Array ("Hello World"),
-   //       Id                      => S_Id,
-   //       Blocking                => True);
-   //    Next_Time := Ada.Real_Time."+" (Next_Time, Period_Max);
-   //    delay until Next_Time;
-   // end loop;
-   ret = rtep_frsh_create_send_endpoint (&endpoint, dest, chan, vres);
-
-   while (1) {
-      ret = rtep_fna_send_async (&endpoint, msg, size);
-      ret = rtep_fna_receive_sync (&endpoint, msg, size, &received_bytes);
-   }
-   // finalization
-   rtep_adafinal();
-   return 0;
-}
diff --git a/src_rtep/tests/test_c_rtep_fna.c.old b/src_rtep/tests/test_c_rtep_fna.c.old
deleted file mode 100644 (file)
index e36facf..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-#include <pthread.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <misc/error_checks.h>
-#include <unistd.h>
-#include "rtep.h"
-
-static uint16_t channel = 3;
-
-
-/* receiver_task */
-static void *receiver_task (void *arg)
-{
-   const int MAX_SIZE = 1500;
-   uint8_t buffer[MAX_SIZE+1];
-   size_t received_bytes;
-   frsh_endpoint_queueing_info_t queueing_info;
-   frsh_protocol_info_t protocol_info;
-   frsh_receive_endpoint_t endpoint;
-//    uint16_t station;
-//    uint8_t prio;
-
-   printf ("receiver_task\n");
-
-   /* create the receive endpoint (TODO: should be done using FRSH api) */
-   endpoint.network_id = 0;
-   endpoint.stream_id = (frsh_stream_id_t)channel;
-   endpoint.queueing_info = queueing_info;
-   endpoint.protocol_info = protocol_info;
-   CHKE_FATAL (rtep_fna_receive_endpoint_create_callback(&endpoint));
-
-   while (1) {
-      CHKE_FATAL (rtep_fna_receive_sync (&endpoint, (void *)buffer, MAX_SIZE,
-         &received_bytes));
-
-      buffer[received_bytes] = 0;
-//       printf ("received data from: %u  with prio: %u last: %d data: ",
-//               station, prio, last);
-//       printf ("received %s\n",buffer);
-      fputs ((char *)buffer, stdout);
-   }
-}
-
-int main ()
-{
-   uint16_t me;
-   uint16_t dest_station;
-   char dest_station_name[] = "broadcast";
-   char msg_broadcast[] = "Hi All!\n";
-   frsh_contract_t contract;
-   uint16_t budget_min = 3;
-   struct timespec period_max = {10, 0};
-   struct timespec deadline = period_max;
-   fna_vres_id_t vres;
-   fna_send_endpoint_t send_endpoint;
-   uint8_t prio = 8;
-   int accepted;
-   pthread_t th;
-   pthread_attr_t attr;
-
-   /* initialization */
-   rtep_adainit();
-   CHKE_FATAL (rtep_fna_init(0));
-
-   me = rtep_get_station_id();
-   printf ("I am: %u\n", me);
-
-   /* create a thread that receives messages */
-   CHKE_FATAL( pthread_attr_init (&attr) );
-   CHKE_FATAL( pthread_create (&th, &attr, receiver_task, NULL) );
-
-   /* set contract params (TODO: should be done using FRSH api) */
-   contract.budget_min = budget_min;
-   contract.period_max = period_max;
-   contract.deadline = deadline;
-   contract.prio = prio;
-
-   /* negotiate the contract */
-   accepted = rtep_fna_contract_negotiate (0, &contract, &vres);
-
-   if (accepted != 0) {
-      printf ("contract not accepted\n");
-      return -1;
-   }
-   printf ("contract accepted\n");
-
-   /* create the send endpoint (TODO: should be done using FRSH api) */
-   dest_station = rtep_get_station_id_by_name
-         ((uint8_t *)dest_station_name, sizeof(dest_station_name)-1);
-
-   send_endpoint.network_id = 0;
-   send_endpoint.destination = (frsh_network_address_t)dest_station;
-   send_endpoint.stream_id = (frsh_stream_id_t)channel;
-   send_endpoint.vres = vres;
-
-   /* send messages */
-   while (1) {
-      printf ("sending a message\n");
-      rtep_fna_send_async(&send_endpoint, msg_broadcast, sizeof(msg_broadcast));
-      sleep (2);
-   }
-
-   // finalization
-   rtep_adafinal();
-   return 0;
-}