File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ typedef enum {
56
56
PHY_EXTENSION_READ_LINK_STATUS , /**< Net library could read link status. */
57
57
PHY_EXTENSION_CONVERT_SIGNAL_INFO , /**< Convert signal info. */
58
58
PHY_EXTENSION_ACCEPT_ANY_BEACON , /**< Set boolean true or false for accept beacon from other Pan-ID than configured. Default value should be false */
59
- PHY_EXTENSION_SET_TX_TIME , /**< Net library sets transmission time based on global time stamp. */
59
+ PHY_EXTENSION_SET_TX_TIME , /**< Net library sets transmission time based on global time stamp. Max. 65ms from setting to TX */
60
60
PHY_EXTENSION_READ_RX_TIME , /**< Read the time of last reception based on global time stamp. */
61
61
} phy_extension_type_e ;
62
62
Original file line number Diff line number Diff line change @@ -160,6 +160,33 @@ int8_t mac_pd_sap_req(protocol_interface_rf_mac_setup_s *rf_mac_setup)
160
160
return 0 ;
161
161
}
162
162
163
+ /**
164
+ * Set PHY TX time.
165
+ *
166
+ * \param rf_mac_setup pointer to MAC
167
+ * \param time_to_tx Time from present time to wanted TX time (us)
168
+ * \return 0 if success, -1 when FHSS not registered
169
+ *
170
+ */
171
+ static int mac_pd_sap_set_tx_time (protocol_interface_rf_mac_setup_s * rf_mac_setup , uint16_t time_to_tx )
172
+ {
173
+ if (rf_mac_setup -> fhss_api ) {
174
+ // Max. TX time is 65ms
175
+ if (time_to_tx > 65000 ) {
176
+ time_to_tx = 65000 ;
177
+ }
178
+ uint8_t tx_time_buffer [4 ];
179
+ uint32_t tx_time = rf_mac_setup -> fhss_api -> read_timestamp (rf_mac_setup -> fhss_api ) + time_to_tx ;
180
+ if (!tx_time ) {
181
+ tx_time ++ ;
182
+ }
183
+ common_write_32_bit (tx_time , tx_time_buffer );
184
+ rf_mac_setup -> dev_driver -> phy_driver -> extension (PHY_EXTENSION_SET_TX_TIME , tx_time_buffer );
185
+ return 0 ;
186
+ }
187
+ return -1 ;
188
+ }
189
+
163
190
/**
164
191
* Run Mac data interface state Machine for mac timer.
165
192
*
Original file line number Diff line number Diff line change @@ -95,6 +95,12 @@ int8_t arm_net_phy_register(phy_device_driver_s *phy_driver)
95
95
if (new -> phy_driver -> state_control ) {
96
96
new -> phy_driver -> state_control (PHY_INTERFACE_RESET , 0 );
97
97
}
98
+ if (new -> phy_driver -> extension ) {
99
+ uint8_t tx_time_buffer [4 ];
100
+ uint32_t tx_time = 0 ;
101
+ common_write_32_bit (tx_time , tx_time_buffer );
102
+ new -> phy_driver -> extension (PHY_EXTENSION_SET_TX_TIME , tx_time_buffer );
103
+ }
98
104
ns_list_add_to_end (& arm_device_driver_list , new );
99
105
100
106
return new -> id ;
You can’t perform that action at this time.
0 commit comments