master/domain.c
changeset 94 fa8e9f520589
parent 91 0120d6214948
child 96 080b46eb6e2d
equal deleted inserted replaced
93:021e9da11286 94:fa8e9f520589
   277 
   277 
   278     master = domain->master;
   278     master = domain->master;
   279     frame = &domain->frame;
   279     frame = &domain->frame;
   280     working_counter_sum = 0;
   280     working_counter_sum = 0;
   281 
   281 
   282     ec_output_lost_frames(master); // Evtl. verlorene Frames ausgeben
   282     ec_cyclic_output(master);
   283 
   283 
   284     rdtscl(start_ticks); // Sendezeit nehmen
   284     rdtscl(start_ticks); // Sendezeit nehmen
   285     timeout_ticks = domain->timeout_us * cpu_khz / 1000;
   285     timeout_ticks = domain->timeout_us * cpu_khz / 1000;
   286 
   286 
   287     offset = 0;
   287     offset = 0;
   307                         && end_ticks - start_ticks < timeout_ticks));
   307                         && end_ticks - start_ticks < timeout_ticks));
   308 
   308 
   309         master->bus_time = (end_ticks - start_ticks) * 1000 / cpu_khz;
   309         master->bus_time = (end_ticks - start_ticks) * 1000 / cpu_khz;
   310 
   310 
   311         if (unlikely(end_ticks - start_ticks >= timeout_ticks)) {
   311         if (unlikely(end_ticks - start_ticks >= timeout_ticks)) {
   312             master->device.state = EC_DEVICE_STATE_READY;
   312             if (master->device.state == EC_DEVICE_STATE_RECEIVED) {
   313             master->frames_lost++;
   313                 master->frames_delayed++;
   314             ec_output_lost_frames(master);
   314                 ec_cyclic_output(master);
   315             return -1;
   315             }
       
   316             else {
       
   317                 master->device.state = EC_DEVICE_STATE_READY;
       
   318                 master->frames_lost++;
       
   319                 ec_cyclic_output(master);
       
   320                 return -1;
       
   321             }
   316         }
   322         }
   317 
   323 
   318         if (unlikely(ec_frame_receive(frame) < 0)) {
   324         if (unlikely(ec_frame_receive(frame) < 0)) {
   319             EC_ERR("Receiving process data failed!\n");
   325             EC_ERR("Receiving process data failed!\n");
   320             return -1;
   326             return -1;