examples/TestMasterSlave/TestMasterSlave.c
changeset 156 515d11cb496e
parent 149 fe50ada8020b
child 161 c4908cc776a9
equal deleted inserted replaced
155:746b49869cbc 156:515d11cb496e
    34 //#include <unistd.h>
    34 //#include <unistd.h>
    35 #include <stdlib.h>
    35 #include <stdlib.h>
    36 #include <signal.h>
    36 #include <signal.h>
    37 #endif
    37 #endif
    38 
    38 
    39 #include <applicfg.h>
    39 #include "canfestival.h"
    40 #include <can_driver.h>
    40 //#include <can_driver.h>
    41 #include <timers_driver.h>
    41 //#include <timers_driver.h>
    42 
    42 
    43 #include "Master.h"
    43 #include "Master.h"
    44 #include "Slave.h"
    44 #include "Slave.h"
    45 #include "TestMasterSlave.h"
    45 #include "TestMasterSlave.h"
    46 
       
    47 #define MyCase(fc) case fc: eprintf(#fc);break;
       
    48 void print_message(Message *m)
       
    49 {
       
    50 	int i;
       
    51 	switch(m->cob_id.w >> 7)
       
    52 	{
       
    53 		MyCase(SYNC)
       
    54 		MyCase(TIME_STAMP)
       
    55 		MyCase(PDO1tx)
       
    56 		MyCase(PDO1rx)
       
    57 		MyCase(PDO2tx)
       
    58 		MyCase(PDO2rx)
       
    59 		MyCase(PDO3tx)
       
    60 		MyCase(PDO3rx)
       
    61 		MyCase(PDO4tx)
       
    62 		MyCase(PDO4rx)
       
    63 		MyCase(SDOtx)
       
    64 		MyCase(SDOrx)
       
    65 		MyCase(NODE_GUARD)
       
    66 		MyCase(NMT)
       
    67 	}
       
    68 	eprintf(" rtr:%d", m->rtr);
       
    69 	eprintf(" len:%d", m->len);
       
    70 	for (i = 0 ; i < m->len ; i++)
       
    71 		eprintf(" %02x", m->data[i]);
       
    72 	eprintf("\n");
       
    73 }
       
    74 
    46 
    75 UNS32 OnMasterMap1Update(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex)
    47 UNS32 OnMasterMap1Update(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex)
    76 {
    48 {
    77 	eprintf("OnSlaveMap1Update:%d\n", SlaveMap1);
    49 	eprintf("OnSlaveMap1Update:%d\n", SlaveMap1);
    78 	return 0;
    50 	return 0;