Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fhss_statistics.c Source File

fhss_statistics.c

00001 /*
00002  * Copyright (c) 2017, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 #include "nsconfig.h"
00018 #include "ns_types.h"
00019 #include "fhss_api.h "
00020 #include "fhss_config.h "
00021 #include "fhss.h"
00022 #include "fhss_statistics.h"
00023 
00024 void fhss_stats_update(fhss_structure_t *fhss_structure, fhss_stats_type_t type, uint32_t update_val)
00025 {
00026     if (fhss_structure->fhss_stats_ptr) {
00027         switch (type) {
00028             case STATS_FHSS_DRIFT_COMP:
00029                 fhss_structure->fhss_stats_ptr->fhss_drift_compensation = update_val;
00030                 break;
00031             case STATS_FHSS_HOP_COUNT:
00032                 fhss_structure->fhss_stats_ptr->fhss_hop_count = update_val;
00033                 break;
00034             case STATS_FHSS_SYNCH_INTERVAL:
00035                 fhss_structure->fhss_stats_ptr->fhss_synch_interval = update_val;
00036                 break;
00037             case STATS_FHSS_AVG_SYNCH_FIX:
00038                 fhss_structure->fhss_stats_ptr->fhss_prev_avg_synch_fix = update_val;
00039                 break;
00040             case STATS_FHSS_SYNCH_LOST:
00041                 fhss_structure->fhss_stats_ptr->fhss_synch_lost += update_val;
00042                 break;
00043         }
00044     }
00045 }