1 // Copyright (c) <2012> <Leif Asbrink> 2 // 3 // Permission is hereby granted, free of charge, to any person 4 // obtaining a copy of this software and associated documentation 5 // files (the "Software"), to deal in the Software without restriction, 6 // including without limitation the rights to use, copy, modify, 7 // merge, publish, distribute, sublicense, and/or sell copies of 8 // the Software, and to permit persons to whom the Software is 9 // furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be 12 // included in all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 16 // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 // OR OTHER DEALINGS IN THE SOFTWARE. 22 23 24 if(rxin_local_workload_reset != workload_reset_flag) 25 { 26 if(timing_loop_counter <= timing_loop_counter_max) 27 { 28 rxin_local_workload_reset=workload_reset_flag; 29 timing_loop_counter=timing_loop_counter_max; 30 initial_skip_flag=INITIAL_SKIP_FLAG_MAX; 31 } 32 } 33 timing_loop_counter--; 34 if(timing_loop_counter == 0) 35 { 36 timing_loop_counter=timing_loop_counter_max; 37 total_reads+=timing_loop_counter_max; 38 if(initial_skip_flag != 0) 39 { 40 initial_skip_flag--; 41 if(initial_skip_flag == INITIAL_SKIP_FLAG_MAX-2) 42 { 43 read_start_time=current_time(); 44 total_reads=0; 45 } 46 } 47 else 48 { 49 measured_ad_speed=(float)(total_reads*snd[RXAD].block_frames/ 50 (current_time()-read_start_time)); 51 } 52 } 53