Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ieee802154-radio-eval
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
ieee802154-radio-eval
Commits
9db63059
Commit
9db63059
authored
7 years ago
by
Robert Hartung
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup and increases stack size for dump thread
parent
967385a8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
software/main.c
+31
-23
31 additions, 23 deletions
software/main.c
with
31 additions
and
23 deletions
software/main.c
+
31
−
23
View file @
9db63059
...
...
@@ -43,11 +43,10 @@
#error NODE_ID undefined
#endif
char
dump_thread_stack
[
256
];
/// 512 required for samr21-xpro, 256 sufficuent for INGA and telosb
char
dump_thread_stack
[
512
];
char
send_thread_stack
[
512
];
static
msg_t
dump_thread_msg_queue
[
RCV_QUEUE_SIZE
];
static
kernel_pid_t
dump_thread_pid
;
char
send_thread_stack
[
256
];
static
gnrc_netif_t
*
ieee802154_netif
=
NULL
;
typedef
struct
{
char
magic_string
[
8
];
...
...
@@ -141,12 +140,9 @@ void *dump_thread(void *arg)
return
NULL
;
}
static
netopt_enable_t
enable
=
true
;
static
netopt_enable_t
disable
=
false
;
void
*
send_thread
(
void
*
arg
)
{
(
void
)
arg
;
gnrc_netif_t
*
ieee802154_netif
=
arg
;
/*
struct iovec vector[2];
...
...
@@ -171,22 +167,35 @@ void *send_thread(void *arg)
gnrc_pktsnip_t
*
pkt
,
*
hdr
;
gnrc_netif_hdr_t
*
nethdr
;
netopt_enable_t
enable
=
true
;
netopt_enable_t
disable
=
false
;
int
ret
;
ret
=
gnrc_netapi_set
(
ieee802154_netif
->
pid
,
NETOPT_PROMISCUOUSMODE
,
0
,
&
enable
,
sizeof
(
netopt_enable_t
));
if
(
ret
<
0
)
{
puts
(
"Unable to set promiscous mode"
);
}
ret
=
gnrc_netapi_set
(
ieee802154_netif
->
pid
,
NETOPT_AUTOACK
,
0
,
&
disable
,
sizeof
(
netopt_enable_t
));
if
(
ret
<
0
)
{
puts
(
"Unable to disable auto ack"
);
}
ret
=
gnrc_netapi_set
(
ieee802154_netif
->
pid
,
NETOPT_CSMA
,
0
,
&
disable
,
sizeof
(
netopt_enable_t
));
if
(
ret
<
0
)
{
puts
(
"Unable to disable CSMA"
);
}
uint8_t
retrans
=
0
;
ret
=
gnrc_netapi_set
(
ieee802154_netif
->
pid
,
NETOPT_RETRANS
,
0
,
&
retrans
,
sizeof
(
retrans
));
if
(
ret
<
0
)
{
puts
(
"Unable to set retrans = 0"
);
}
int8_t
retries
=
7
;
ret
=
gnrc_netapi_set
(
ieee802154_netif
->
pid
,
NETOPT_CSMA_RETRIES
,
0
,
&
retries
,
sizeof
(
retries
));
(
void
)
ret
;
if
(
ret
<
0
)
{
puts
(
"Unable to set CSMA retries = 0"
);
}
uint8_t
flags
=
0
|
GNRC_NETIF_HDR_FLAGS_BROADCAST
;
//uint8_t data[25];
//uint8_t size;
uint8_t
payload_length
=
sprintf
((
char
*
)
eval_message
.
payload
,
"Hello from %2d"
,
NODE_ID
);
while
(
1
)
{
...
...
@@ -194,8 +203,6 @@ void *send_thread(void *arg)
printf
(
"send... "
);
eval_message
.
seq_nr
++
;
/* put packet together */
pkt
=
gnrc_pktbuf_add
(
NULL
,
&
eval_message
,
sizeof
(
eval_message
)
-
MAX_PAYLOAD_LENGTH
+
payload_length
,
GNRC_NETTYPE_UNDEF
);
if
(
pkt
==
NULL
)
{
puts
(
"ERROR: packet buffer full"
);
...
...
@@ -211,9 +218,9 @@ void *send_thread(void *arg)
LL_PREPEND
(
pkt
,
hdr
);
nethdr
=
(
gnrc_netif_hdr_t
*
)
hdr
->
data
;
nethdr
->
flags
=
flags
;
/* and send it */
if
(
gnrc_netapi_send
(
ieee802154_netif
->
pid
,
pkt
)
<
1
)
{
p
uts
(
"ERROR: unable to send
"
);
ret
=
gnrc_netapi_send
(
ieee802154_netif
->
pid
,
pkt
);
if
(
ret
<
1
)
{
p
rintf
(
"ERROR: unable to send
: %d
\n
"
,
ret
);
gnrc_pktbuf_release
(
pkt
);
}
else
{
puts
(
"OK"
);
...
...
@@ -225,18 +232,19 @@ void *send_thread(void *arg)
int
main
(
void
)
{
/// +1 -> INGA working, but TelosB/Sky not
dump_thread_pid
=
thread_create
(
dump_thread_stack
,
sizeof
(
dump_thread_stack
),
THREAD_PRIORITY_MAIN
+
2
,
0
,
dump_thread
,
NULL
,
"dump_thread"
);
thread_create
(
dump_thread_stack
,
sizeof
(
dump_thread_stack
),
THREAD_PRIORITY_MAIN
+
2
,
0
,
dump_thread
,
NULL
,
"dump_thread"
);
gnrc_netif_t
*
netif
=
NULL
;
if
((
netif
=
gnrc_netif_iter
(
netif
)))
{
puts
(
"Found gnrc netif"
)
;
ieee802154_netif
=
netif
;
gnrc_netif_t
*
ieee802154_netif
=
netif
;
printf
(
"Found gnrc netif: %d %d"
,
netif
->
pid
,
ieee802154_netif
->
pid
)
;
/// +2 -> INGA working, but TelosB/Sky not
thread_create
(
send_thread_stack
,
sizeof
(
send_thread_stack
),
THREAD_PRIORITY_MAIN
+
1
,
THREAD_CREATE_STACKTEST
,
send_thread
,
NULL
,
"send_thread"
);
}
else
{
thread_create
(
send_thread_stack
,
sizeof
(
send_thread_stack
),
THREAD_PRIORITY_MAIN
+
1
,
0
,
send_thread
,
ieee802154_netif
,
"send_thread"
);
}
else
{
puts
(
"Unable to find netif"
);
}
(
void
)
puts
(
"Welcome to RIOT!"
);
printf
(
"This is node %d
\n
"
,
NODE_ID
);
char
line_buf
[
SHELL_DEFAULT_BUFSIZE
];
...
...
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