00001 /*-------------------------------------------------------------------- 00002 * 00003 * (C) Copyright Koninklijke Philips Electronics NV 2006. 00004 * All rights reserved. This software is licensed under the terms of 00005 * version 2.1 of the GNU Lesser General Public License as published 00006 * by the Free Software Foundation. For licensing and warranty 00007 * information, see the file COPYING in the main directory. 00008 * 00009 *------------------------------------------------------------------*/ 00010 00011 #ifndef COSYNETWORK_H 00012 #define COSYNETWORK_H 00013 00014 #include "rtenetwork.h" 00015 #include "cosyfifo.h" 00016 #include "rte.h" 00017 #include "table.h" 00018 #include <list> 00019 00020 //class cosyFifo; 00021 class cosyProcess; 00022 class rteInPort; 00023 class rteOutPort; 00024 00025 class Semaphore; 00026 class Task; 00027 class Os; 00028 00029 class cosyNetwork : public rteNetwork 00030 { 00031 public: 00032 cosyNetwork(NetworkImpl& n, Os& o, cosyRte& r); 00033 ~cosyNetwork(); 00034 00035 void start(); 00036 void printCommunicationWorkload(); 00037 void printComputationWorkload(); 00038 00039 private: 00040 Os& os; 00041 cosyRte* rte; 00042 00043 void run(); 00044 void join(); 00045 void kill(); 00046 bool growFifo(); 00047 bool deadlock(); 00048 00049 static bool growingFifos; 00050 static bool dd; 00051 00052 void printFifoMetrics(Table& t, const FifoMetric* m, 00053 unsigned int n, bool title=true); 00054 void printFifoStatus(); 00055 void printProcessStatus(Table& t); 00056 void printProcessStatus(); 00057 void printCommunicationWorkload(Table& t); 00058 void printComputationWorkload(Table& t); 00059 00060 friend void handler1(void* arg); 00061 friend void handler2(void* arg); 00062 friend void fatal_func(void* arg); 00063 friend void clean_func(void* arg); 00064 friend void zero0_func(void* arg); 00065 friend void zero1_func(void* arg); 00066 friend void zero2_func(void* arg); 00067 00068 typedef std::list<rteOutPort*> cosyOutPorts; 00069 typedef std::list<rteInPort*> cosyInPorts; 00070 typedef std::list<cosyFifo*> cosyFifos; 00071 typedef std::list<cosyProcess*> cosyProcesses; 00072 typedef std::list<cosyNetwork*> cosyNetworks; 00073 cosyInPorts ci; 00074 cosyOutPorts co; 00075 cosyFifos cf; 00076 cosyProcesses cp; 00077 cosyNetworks cn; 00078 00079 Task* task; // kills blocked processes 00080 Task* zero1; // null process 00081 Task* zero2; // null process 00082 }; 00083 00084 #endif