joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers net_fhss.h Source File

net_fhss.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2015 ARM Limited. All rights reserved.
00003  *
00004  * SPDX-License-Identifier: LicenseRef-PBL
00005  *
00006  * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  * https://www.mbed.com/licenses/PBL-1.0
00010  *
00011  * See the License for the specific language governing permissions and limitations under the License.
00012  *
00013  */
00014 
00015 /**
00016  * \file net_fhss.h
00017  * \brief FHSS API
00018  *
00019  */
00020 
00021 #ifndef NET_FHSS_H_
00022 #define NET_FHSS_H_
00023 
00024 #include <stdint.h>
00025 
00026 #ifndef RPL_SYNCHRONIZATION_INSTANCE_ID
00027 #define RPL_SYNCHRONIZATION_INSTANCE_ID 1
00028 #endif
00029 
00030 /** FHSS configuration structure */
00031 typedef struct fhss_configuration_s
00032 {
00033     /** Number of broadcast channels. */
00034     uint8_t fhss_number_of_bc_channels;
00035 
00036     /** TX slots per channel. */
00037     uint8_t fhss_number_of_tx_slots;
00038 
00039     /** Length of superframe, in microseconds. */
00040     uint16_t fhss_superframe_length;
00041 
00042     /** Number of superframes, after which the counter will start from zero. */
00043     uint8_t fhss_number_of_superframes;
00044 
00045     /**
00046      * Interval of beacon sending, in milliseconds.
00047      * Note1: Value 0 disables them.
00048      * Note2: This will likely be removed when beacons are sent only when needed.
00049      */
00050     uint32_t fhss_beacon_send_interval;
00051 } fhss_configuration_s;
00052 
00053 /** FHSS Platform callbacks */
00054 typedef struct
00055 {
00056     int (*fhss_timer_start)(uint32_t, void (*fhss_timer_callback)(int8_t, uint16_t), int8_t);
00057     int (*fhss_timer_stop)(void);
00058     uint32_t (*fhss_get_remaining_slots)(void);
00059     int (*fhss_time_measure_start)(void);
00060     uint32_t (*fhss_time_measure_read)(void);
00061     int (*fhss_time_measure_stop)(void);
00062     uint8_t fhss_resolution_divider;
00063 } fhss_platform_functions_s;
00064 
00065 /** FHSS tuning parameters */
00066 typedef struct
00067 {
00068     /** Processing delay between synch info written and TX start. */
00069     uint32_t synch_tx_processing_time;
00070     /** Processing delay between TX done and synch info read. */
00071     uint32_t synch_rx_processing_time;
00072     /** Processing delay between data pushed to driver and transmission started. */
00073     uint32_t data_tx_processing_time;
00074     /** Processing delay between TX done and Ack TX start. */
00075     uint32_t data_rx_processing_time;
00076 } fhss_platform_tuning_params_s;
00077 
00078 /** FHSS Channel mode */
00079 typedef enum fhss_channel_mode_e {
00080     SINGLE_CHANNEL,     //< Single channel
00081     FHSS,               //< Frequency hopping mode
00082 } fhss_channel_mode_e;
00083 
00084 #if 0
00085 /**
00086  * \brief Enable FHSS mode. Note: arm_nwk_interface_configure_6lowpan_bootstrap_set() must be called before enabling FHSS.
00087  *
00088  * \param interface_id Network interface ID.
00089  * \param fhss_platform_functions Platform functions.
00090  * \param fhss_configuration Given configuration.
00091  * \return 0 on success.
00092  * \return -1 in case of invalid input parameters.
00093  * \return -2 if no channels are available in channel list.
00094  * \return -3 if the broadcast channels or TX slots are 0 in the bootstrap mode Border Router/RF access point.
00095  * \return -4 if the number of super frames does not work with TX slots in bootstrap mode Border Router/RF access point.
00096  * \return -5 if FHSS tasklet creation fails.
00097  * \return -6 if PHY driver mode cannot be changed.
00098  * \return -7 if the used bootstrap mode is not supported.
00099  * \return -8 if FHSS is already enabled.
00100  * \return -9 if memory allocation failed.
00101  */
00102 extern int8_t arm_fhss_enable(int8_t interface_id, fhss_platform_functions_s *fhss_platform_functions,
00103                               const fhss_configuration_s *fhss_configuration);
00104 
00105 /**
00106  * \brief Disable FHSS mode.
00107  *
00108  * \param interface_id Network interface ID.
00109  * \return 0 on success, -1 on fail.
00110  */
00111 extern int8_t arm_fhss_disable(int8_t interface_id);
00112 
00113 /**
00114  * \brief Set platform tuning parameters.
00115  *
00116  * \param interface_id Network interface ID.
00117  * \param fhss_tuning_params Tuning parameters.
00118  * \return 0 on success, -1 on fail.
00119  */
00120 extern int8_t arm_fhss_set_tuning_params(int8_t interface_id, const fhss_platform_tuning_params_s *fhss_tuning_params);
00121 
00122 #else
00123 #define arm_fhss_enable(interface_id, fhss_platform_functions,fhss_configuration) (int8_t) -1
00124 #define arm_fhss_disable(interface_id) (int8_t) -1
00125 #define arm_fhss_set_tuning_params(interface_id, fhss_tuning_params) (int8_t) -1
00126 #endif
00127 
00128 #endif /* NET_FHSS_H_ */