34
34
#include <net/l2_buf.h>
35
35
#include <packetbuf.h>
36
36
37
- #define CONFIG_NETWORKING_LEGACY_RADIO_DRIVER
38
-
39
- #ifdef CONFIG_NETWORKING_LEGACY_RADIO_DRIVER
40
37
#include <dev/radio.h>
41
38
#include <net_driver_15_4.h>
42
39
static struct device * cc2520_sglt ;
43
- #endif /* CONFIG_NETWORKING_LEGACY_RADIO_DRIVER */
44
40
45
41
#include "ieee802154_cc2520.h"
46
42
@@ -680,7 +676,7 @@ static void cc2520_rx(int arg, int unused2)
680
676
/********************
681
677
* Radio device API *
682
678
*******************/
683
- static int cc2520_set_channel (struct device * dev , uint16_t channel )
679
+ static inline int cc2520_set_channel (struct device * dev , uint16_t channel )
684
680
{
685
681
struct cc2520_context * cc2520 = dev -> driver_data ;
686
682
@@ -701,7 +697,7 @@ static int cc2520_set_channel(struct device *dev, uint16_t channel)
701
697
return 0 ;
702
698
}
703
699
704
- static int cc2520_set_pan_id (struct device * dev , uint16_t pan_id )
700
+ static inline int cc2520_set_pan_id (struct device * dev , uint16_t pan_id )
705
701
{
706
702
struct cc2520_context * cc2520 = dev -> driver_data ;
707
703
@@ -717,7 +713,7 @@ static int cc2520_set_pan_id(struct device *dev, uint16_t pan_id)
717
713
return 0 ;
718
714
}
719
715
720
- static int cc2520_set_short_addr (struct device * dev , uint16_t short_addr )
716
+ static inline int cc2520_set_short_addr (struct device * dev , uint16_t short_addr )
721
717
{
722
718
struct cc2520_context * cc2520 = dev -> driver_data ;
723
719
@@ -733,7 +729,8 @@ static int cc2520_set_short_addr(struct device *dev, uint16_t short_addr)
733
729
return 0 ;
734
730
}
735
731
736
- static int cc2520_set_ieee_addr (struct device * dev , const uint8_t * ieee_addr )
732
+ static inline int cc2520_set_ieee_addr (struct device * dev ,
733
+ const uint8_t * ieee_addr )
737
734
{
738
735
struct cc2520_context * cc2520 = dev -> driver_data ;
739
736
uint8_t ext_addr [8 ];
@@ -755,7 +752,7 @@ static int cc2520_set_ieee_addr(struct device *dev, const uint8_t *ieee_addr)
755
752
return 0 ;
756
753
}
757
754
758
- static int cc2520_tx (struct device * dev , struct net_buf * buf )
755
+ static inline int cc2520_tx (struct device * dev , struct net_buf * buf )
759
756
{
760
757
struct cc2520_context * cc2520 = dev -> driver_data ;
761
758
uint8_t retry = 2 ;
@@ -808,9 +805,9 @@ static int cc2520_tx(struct device *dev, struct net_buf *buf)
808
805
return - EIO ;
809
806
}
810
807
811
- static const uint8_t * cc2520_get_mac (struct device * dev )
808
+ static inline uint8_t * cc2520_get_mac (struct device * dev )
812
809
{
813
- struct cc2520_context * cc2520 = cc2520_sglt -> driver_data ;
810
+ struct cc2520_context * cc2520 = dev -> driver_data ;
814
811
815
812
if (cc2520 -> mac_addr [1 ] == 0x00 ) {
816
813
/* TI OUI */
@@ -828,9 +825,9 @@ static const uint8_t *cc2520_get_mac(struct device *dev)
828
825
return cc2520 -> mac_addr ;
829
826
}
830
827
831
- static int cc2520_start (struct device * dev )
828
+ static inline int cc2520_start (struct device * dev )
832
829
{
833
- struct cc2520_context * cc2520 = cc2520_sglt -> driver_data ;
830
+ struct cc2520_context * cc2520 = dev -> driver_data ;
834
831
835
832
SYS_LOG_DBG ("\n" );
836
833
@@ -848,9 +845,9 @@ static int cc2520_start(struct device *dev)
848
845
return 0 ;
849
846
}
850
847
851
- static int cc2520_stop (struct device * dev )
848
+ static inline int cc2520_stop (struct device * dev )
852
849
{
853
- struct cc2520_context * cc2520 = cc2520_sglt -> driver_data ;
850
+ struct cc2520_context * cc2520 = dev -> driver_data ;
854
851
855
852
SYS_LOG_DBG ("\n" );
856
853
@@ -871,7 +868,6 @@ static int cc2520_stop(struct device *dev)
871
868
/***************************
872
869
* Legacy Radio device API *
873
870
**************************/
874
- #ifdef CONFIG_NETWORKING_LEGACY_RADIO_DRIVER
875
871
/**
876
872
* NOTE: This legacy API DOES NOT FIT within Zephyr device driver model
877
873
* and, as such, will be made obsolete soon (well, hopefully...)
@@ -1021,8 +1017,6 @@ struct radio_driver cc2520_15_4_radio_driver = {
1021
1017
.get_object = cc2520_get_object ,
1022
1018
.set_object = cc2520_set_object ,
1023
1019
};
1024
- #endif /* CONFIG_NETWORKING_LEGACY_RADIO_DRIVER */
1025
-
1026
1020
1027
1021
/******************
1028
1022
* Initialization *
@@ -1157,9 +1151,7 @@ static int cc2520_init(struct device *dev)
1157
1151
cc2520_rx , POINTER_TO_INT (dev ),
1158
1152
0 , 0 , 0 );
1159
1153
1160
- #ifdef CONFIG_NETWORKING_LEGACY_RADIO_DRIVER
1161
1154
cc2520_sglt = dev ;
1162
- #endif
1163
1155
1164
1156
return 0 ;
1165
1157
}
0 commit comments