Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rf_driver_storage.h Source File

rf_driver_storage.h

00001 /*
00002  * Copyright (c) 2016-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 
00018 #ifndef RF_DRIVER_STORAGE_H
00019 #define RF_DRIVER_STORAGE_H
00020 
00021 #include "ns_list.h"
00022 #include "mac_common_defines.h"
00023 #include "mlme.h"
00024 #include "platform/arm_hal_phy.h"
00025 #include "mac_api.h"
00026 
00027 struct protocol_interface_rf_mac_setup;
00028 
00029 /**
00030  *  PD-SAP data layer format
00031  */
00032 typedef enum {
00033     MAC15_4_PD_SAP_DATA_IND = 0,
00034     MAC15_4_PD_SAP_DATA_TX_CONFIRM,
00035     MAC802_PD_SAP_DATA_IND,
00036     MAC802_PD_SAP_DATA_TX_CONFIRM,
00037     MACTUN_PD_SAP_DATA_IND,
00038     MACTUN_PD_SAP_NAP_IND,
00039     MACTUN_PD_SAP_CONFIRM,
00040     MACTUN_MLME_NAP_EXTENSION,
00041 } arm_pd_sap_primitive_e;
00042 
00043 /**
00044  * @brief struct arm_pd_sap_generic_confirm_t PD Data confirm structure
00045  *
00046  * See IEEE standard 802.15.4-2006 (table 7) for more details
00047  */
00048 typedef struct arm_pd_sap_generic_confirm_s {
00049     phy_link_tx_status_e status;
00050 } arm_pd_sap_generic_confirm_t;
00051 
00052 /**
00053  * @brief struct arm_pd_sap_15_4_confirm_with_params_t PD Data confirm structure
00054  *
00055  * See IEEE standard 802.15.4-2006 (table 7) for more details
00056  */
00057 typedef struct arm_pd_sap_15_4_confirm_with_params_s {
00058     phy_link_tx_status_e status;
00059     uint8_t cca_retry; //Non-standard addition, 0 if not available
00060     uint8_t tx_retry; //Non-standard addition, 0 if not available
00061 } arm_pd_sap_15_4_confirm_with_params_t;
00062 
00063 /**
00064  * @brief struct arm_pd_sap_generic_ind_t PD Data confirm structure
00065  *
00066  * See IEEE standard 802.15.4-2006 (table 8) for more details
00067  */
00068 typedef struct arm_pd_sap_generic_ind_s {
00069     const uint8_t *data_ptr;
00070     uint16_t data_len;
00071     uint8_t link_quality;
00072     int8_t dbm; //Desibels; Non-standard addition
00073 } arm_pd_sap_generic_ind_t;
00074 
00075 /**
00076  * @brief struct arm_mlme_req_t Common MLME message data structure
00077  *
00078  */
00079 typedef struct arm_mlme_req_s {
00080     mlme_primitive primitive;
00081     const void *mlme_ptr;
00082     uint16_t ptr_length;
00083 } arm_mlme_req_t;
00084 
00085 typedef struct arm_phy_sap_msg_s {
00086     arm_pd_sap_primitive_e id;
00087     union {
00088         arm_pd_sap_15_4_confirm_with_params_t mac15_4_pd_sap_confirm;
00089         arm_pd_sap_generic_confirm_t generic_confirm;
00090         arm_pd_sap_generic_ind_t generic_data_ind;
00091         arm_mlme_req_t mlme_request;
00092     } message;
00093 } arm_phy_sap_msg_t;
00094 
00095 /**
00096  * @brief struct mac_ps_data_cb Typedef for upper layer callback function
00097  * @param identifier Upper layer identifier (set by upper layer)
00098  * @param message PD-SAP confirm or indication message
00099  */
00100 typedef int8_t mac_ps_data_cb(void *identifier, arm_phy_sap_msg_t *message);
00101 
00102 typedef void internal_mib_observer(const mlme_set_t * set_req);
00103 
00104 typedef struct arm_device_driver_list {
00105     int8_t id; /**< Event handler Tasklet ID */
00106     phy_device_driver_s *phy_driver;
00107     mac_ps_data_cb *phy_sap_upper_cb;
00108     void * phy_sap_identifier;
00109     internal_mib_observer *mlme_observer_cb;
00110     ns_list_link_t link;
00111 } arm_device_driver_list_s;
00112 
00113 arm_device_driver_list_s *arm_net_phy_driver_pointer(int8_t id);
00114 uint32_t dev_get_phy_datarate(phy_device_driver_s *phy_driver, channel_page_e channel_page);
00115 int8_t arm_net_phy_init(phy_device_driver_s *phy_driver, arm_net_phy_rx_fn *rx_cb, arm_net_phy_tx_done_fn *done_cb);
00116 void arm_net_observer_cb_set(int8_t id, internal_mib_observer *observer_cb);
00117 void arm_net_virtual_config_rx_cb_set(phy_device_driver_s *phy_driver, arm_net_virtual_config_rx_fn *virtual_config_rx);
00118 void arm_net_virtual_confirmation_rx_cb_set(phy_device_driver_s *phy_driver, arm_net_virtual_confirmation_rx_fn *virtual_confirmation_rx);
00119 #endif // RF_DRIVER_STORAGE_H