Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
4597193d
Unverified
Commit
4597193d
authored
7 years ago
by
Martine Lenders
Browse files
Options
Downloads
Patches
Plain Diff
nrfmin: port for gnrc_netif2
parent
814dc955
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cpu/nrf5x_common/radio/nrfmin/nrfmin_gnrc.c
+37
-2
37 additions, 2 deletions
cpu/nrf5x_common/radio/nrfmin/nrfmin_gnrc.c
with
37 additions
and
2 deletions
cpu/nrf5x_common/radio/nrfmin/nrfmin_gnrc.c
+
37
−
2
View file @
4597193d
...
@@ -18,8 +18,13 @@
...
@@ -18,8 +18,13 @@
* @}
* @}
*/
*/
#include
"net/gnrc.h"
#include
"thread.h"
#include
"thread.h"
#ifdef MODULE_GNRC_NETIF2
#include
"net/gnrc/netif2.h"
#else
#include
"net/gnrc/netdev.h"
#include
"net/gnrc/netdev.h"
#endif
#include
"nrfmin_gnrc.h"
#include
"nrfmin_gnrc.h"
...
@@ -31,8 +36,12 @@
...
@@ -31,8 +36,12 @@
* @{
* @{
*/
*/
#ifndef NRFMIN_GNRC_THREAD_PRIO
#ifndef NRFMIN_GNRC_THREAD_PRIO
#ifdef MODULE_GNRC_NETIF2
#define NRFMIN_GNRC_THREAD_PRIO GNRC_NETIF2_PRIO
#else
#define NRFMIN_GNRC_THREAD_PRIO GNRC_NETDEV_MAC_PRIO
#define NRFMIN_GNRC_THREAD_PRIO GNRC_NETDEV_MAC_PRIO
#endif
#endif
#endif
#ifndef NRFMIN_GNRC_STACKSIZE
#ifndef NRFMIN_GNRC_STACKSIZE
#define NRFMIN_GNRC_STACKSIZE THREAD_STACKSIZE_DEFAULT
#define NRFMIN_GNRC_STACKSIZE THREAD_STACKSIZE_DEFAULT
...
@@ -49,10 +58,12 @@
...
@@ -49,10 +58,12 @@
*/
*/
static
char
stack
[
NRFMIN_GNRC_STACKSIZE
];
static
char
stack
[
NRFMIN_GNRC_STACKSIZE
];
#ifndef MODULE_GNRC_NETIF2
/**
/**
* @brief Allocate the GNRC netdev data structure.
* @brief Allocate the GNRC netdev data structure.
*/
*/
static
gnrc_netdev_t
plug
;
static
gnrc_netdev_t
plug
;
#endif
static
int
hdr_netif_to_nrfmin
(
nrfmin_hdr_t
*
nrfmin
,
gnrc_pktsnip_t
*
pkt
)
static
int
hdr_netif_to_nrfmin
(
nrfmin_hdr_t
*
nrfmin
,
gnrc_pktsnip_t
*
pkt
)
...
@@ -81,7 +92,11 @@ static int hdr_netif_to_nrfmin(nrfmin_hdr_t *nrfmin, gnrc_pktsnip_t *pkt)
...
@@ -81,7 +92,11 @@ static int hdr_netif_to_nrfmin(nrfmin_hdr_t *nrfmin, gnrc_pktsnip_t *pkt)
return
0
;
return
0
;
}
}
#ifdef MODULE_GNRC_NETIF2
static
int
gnrc_nrfmin_send
(
gnrc_netif2_t
*
dev
,
gnrc_pktsnip_t
*
pkt
)
#else
static
int
gnrc_nrfmin_send
(
gnrc_netdev_t
*
dev
,
gnrc_pktsnip_t
*
pkt
)
static
int
gnrc_nrfmin_send
(
gnrc_netdev_t
*
dev
,
gnrc_pktsnip_t
*
pkt
)
#endif
{
{
int
res
;
int
res
;
struct
iovec
*
vec
;
struct
iovec
*
vec
;
...
@@ -124,7 +139,11 @@ static int gnrc_nrfmin_send(gnrc_netdev_t *dev, gnrc_pktsnip_t *pkt)
...
@@ -124,7 +139,11 @@ static int gnrc_nrfmin_send(gnrc_netdev_t *dev, gnrc_pktsnip_t *pkt)
return
res
;
return
res
;
}
}
#ifdef MODULE_GNRC_NETIF2
static
gnrc_pktsnip_t
*
gnrc_nrfmin_recv
(
gnrc_netif2_t
*
dev
)
#else
static
gnrc_pktsnip_t
*
gnrc_nrfmin_recv
(
gnrc_netdev_t
*
dev
)
static
gnrc_pktsnip_t
*
gnrc_nrfmin_recv
(
gnrc_netdev_t
*
dev
)
#endif
{
{
int
pktsize
;
int
pktsize
;
nrfmin_hdr_t
*
nrfmin
;
nrfmin_hdr_t
*
nrfmin
;
...
@@ -175,7 +194,7 @@ static gnrc_pktsnip_t *gnrc_nrfmin_recv(gnrc_netdev_t *dev)
...
@@ -175,7 +194,7 @@ static gnrc_pktsnip_t *gnrc_nrfmin_recv(gnrc_netdev_t *dev)
}
}
netif
->
lqi
=
0
;
netif
->
lqi
=
0
;
netif
->
rssi
=
0
;
netif
->
rssi
=
0
;
netif
->
if_pid
=
plug
.
pid
;
netif
->
if_pid
=
dev
->
pid
;
pkt_snip
->
type
=
nrfmin
->
proto
;
pkt_snip
->
type
=
nrfmin
->
proto
;
/* finally: remove the nrfmin header and append the netif header */
/* finally: remove the nrfmin header and append the netif header */
...
@@ -185,11 +204,26 @@ static gnrc_pktsnip_t *gnrc_nrfmin_recv(gnrc_netdev_t *dev)
...
@@ -185,11 +204,26 @@ static gnrc_pktsnip_t *gnrc_nrfmin_recv(gnrc_netdev_t *dev)
return
pkt_snip
;
return
pkt_snip
;
}
}
#ifdef MODULE_GNRC_NETIF2
static
const
gnrc_netif2_ops_t
gnrc_nrfmin_ops
=
{
.
send
=
gnrc_nrfmin_send
,
.
recv
=
gnrc_nrfmin_recv
,
.
get
=
gnrc_netif2_get_from_netdev
,
.
set
=
gnrc_netif2_set_from_netdev
,
};
#endif
void
gnrc_nrfmin_init
(
void
)
void
gnrc_nrfmin_init
(
void
)
{
{
/* setup the NRFMIN driver */
/* setup the NRFMIN driver */
nrfmin_setup
();
nrfmin_setup
();
#ifdef MODULE_GNRC_NETIF2
if
(
!
gnrc_netif2_create
(
stack
,
sizeof
(
stack
),
NRFMIN_GNRC_THREAD_PRIO
,
"nrfmin"
,
(
netdev_t
*
)
&
nrfmin_dev
,
&
gnrc_nrfmin_ops
))
{
DEBUG
(
"[nrfmin_dev] error initializing GNRC interface for nrfmin radio
\n
"
);
}
#else
/* initialize the GNRC plug struct */
/* initialize the GNRC plug struct */
plug
.
send
=
gnrc_nrfmin_send
;
plug
.
send
=
gnrc_nrfmin_send
;
plug
.
recv
=
gnrc_nrfmin_recv
;
plug
.
recv
=
gnrc_nrfmin_recv
;
...
@@ -198,4 +232,5 @@ void gnrc_nrfmin_init(void)
...
@@ -198,4 +232,5 @@ void gnrc_nrfmin_init(void)
gnrc_netdev_init
(
stack
,
sizeof
(
stack
),
gnrc_netdev_init
(
stack
,
sizeof
(
stack
),
NRFMIN_GNRC_THREAD_PRIO
,
NRFMIN_GNRC_THREAD_PRIO
,
"nrfmin"
,
&
plug
);
"nrfmin"
,
&
plug
);
#endif
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment