Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wicj_embeddedlab
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julia Scharsich
wicj_embeddedlab
Commits
3d740742
"README.rst" did not exist on "20c2503435c2914d291408a15c2d97fb57f00333"
Commit
3d740742
authored
5 years ago
by
Julia Wichmann
Browse files
Options
Downloads
Patches
Plain Diff
Update modules
parent
41cf8a23
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.DS_Store
+0
-0
0 additions, 0 deletions
.DS_Store
project/.DS_Store
+0
-0
0 additions, 0 deletions
project/.DS_Store
project/lay1+2_remastered.c
+8
-9
8 additions, 9 deletions
project/lay1+2_remastered.c
project/lay3.c
+7
-11
7 additions, 11 deletions
project/lay3.c
with
15 additions
and
20 deletions
.DS_Store
+
0
−
0
View file @
3d740742
No preview for this file type
This diff is collapsed.
Click to expand it.
project/.DS_Store
+
0
−
0
View file @
3d740742
No preview for this file type
This diff is collapsed.
Click to expand it.
project/lay1+2_remastered.c
+
8
−
9
View file @
3d740742
...
@@ -25,8 +25,6 @@
...
@@ -25,8 +25,6 @@
byte
send
[
MAXFRAMESIZE
]
=
{
0
};
// Testdata: 0xB3, 0x10 = 10110011, 00010000
byte
send
[
MAXFRAMESIZE
]
=
{
0
};
// Testdata: 0xB3, 0x10 = 10110011, 00010000
byte
frame
[
MAXFRAMESIZE
]
=
{
0
};
// 0 - Preambel, 1 to 4 - CRC checksum, 5 - size, 6 to n (n = max. 256) - Payload
byte
frame
[
MAXFRAMESIZE
]
=
{
0
};
// 0 - Preambel, 1 to 4 - CRC checksum, 5 - size, 6 to n (n = max. 256) - Payload
byte
state
=
0
;
byte
flag
=
1
;
byte
flag
=
1
;
byte
bufferIndex
=
0
;
// Zählvariable für ISR
byte
bufferIndex
=
0
;
// Zählvariable für ISR
byte
sendIndex
=
0
;
byte
sendIndex
=
0
;
...
@@ -97,7 +95,7 @@ int main(void){
...
@@ -97,7 +95,7 @@ int main(void){
byte
*
receivedFrame
=
malloc
(
MAXFRAMESIZE
*
sizeof
(
byte
));
byte
*
receivedFrame
=
malloc
(
MAXFRAMESIZE
*
sizeof
(
byte
));
byte
sizeToReceive
=
MAXFRAMESIZE
-
1
;
byte
sizeToReceive
=
MAXFRAMESIZE
-
1
;
byte
action
;
// 0 - broadcast successful, to layer 4; 1 - receive, to layer 4; 2 - relay
byte
action
;
// 0 - broadcast successful, to layer 4; 1 - receive, to layer 4; 2 - relay
byte
state
=
0
;
/*
/*
* puts("Getting ready to send.");
* puts("Getting ready to send.");
* byte sizeToSend = 4;
* byte sizeToSend = 4;
...
@@ -114,13 +112,14 @@ int main(void){
...
@@ -114,13 +112,14 @@ int main(void){
*/
*/
while
(
1
){
while
(
1
){
switch
(
state
){
/*
switch(state){
default:
default:
ATOMIC_BLOCK(ATOMIC_FORCEON){
ATOMIC_BLOCK(ATOMIC_FORCEON){
if(!readyToSend) sendZeroes();
if(!readyToSend) sendZeroes();
}
}
break;
break;
case 1: // receiving data
case 1: // receiving data
*/
ATOMIC_BLOCK
(
ATOMIC_FORCEON
){
ATOMIC_BLOCK
(
ATOMIC_FORCEON
){
// Data Package: 0 Preamble, 1 - 4 CRC, 5 Length, 6 Destination, 7 Source, 8 - n Data
// Data Package: 0 Preamble, 1 - 4 CRC, 5 Length, 6 Destination, 7 Source, 8 - n Data
if
(
readyToReceive
){
if
(
readyToReceive
){
...
@@ -168,15 +167,15 @@ int main(void){
...
@@ -168,15 +167,15 @@ int main(void){
}
}
}
}
case
2
:
//send / relay
//
case 2: //send / relay
l3_send
(
&
state
);
l3_send
(
&
state
);
break
;
//
break;
case
3
:
//USART Interrupt happened, add msg to queue
/*
case 3: //USART Interrupt happened, add msg to queue
l3_send(&state);
l3_send(&state);
break
;
*/
}
// vom switch
}
}
}
return
0
;
return
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
project/lay3.c
+
7
−
11
View file @
3d740742
...
@@ -71,23 +71,19 @@ void l3_exec(byte action, byte* frame){
...
@@ -71,23 +71,19 @@ void l3_exec(byte action, byte* frame){
puts
(
"Handing package to layer 4.
\n
"
);
puts
(
"Handing package to layer 4.
\n
"
);
break
;
break
;
case
2
:
//relay
case
2
:
//relay
//fillSend(frame+6, frame[5]);
//Achtung: z.B. bei 8-elementiger Queue: Fall tail ist 7, head ist 0 --> 0-1 != 7 trotzdem queue full
//Achtung: z.B. bei 8-elementiger Queue: Fall tail ist 7, head ist 0 --> 0-1 != 7 trotzdem queue full
if
(
tail
==
head
-
1
||
(
head
==
0
&&
tail
==
MAXQUEUESIZE
))
puts
(
"Message Queue full."
);
// Auskommentiert, weil erst in Lay4 Acks hinzukommen
else
{
//if(tail == head-1 || (head == 0 && tail == MAXQUEUESIZE)) puts("Message Queue full.");
//else{
if
(
head
==
0
)
head
=
MAXQUEUESIZE
-
1
;
if
(
head
==
0
)
head
=
MAXQUEUESIZE
-
1
;
else
head
--
;
else
head
--
;
//msgQueue = realloc(msgQueue, tail+1); //würde ich nicht machen. lieber einfach eine feste Größe für die Queue.
//msgQueue = realloc(msgQueue, tail+1); //würde ich nicht machen. lieber einfach eine feste Größe für die Queue.
msgQueue
[
head
]
=
realloc
(
msgQueue
[
head
],
sizeof
(
frame
));
msgQueue
[
head
]
=
realloc
(
msgQueue
[
head
],
sizeof
(
frame
));
copyFrame
(
frame
,
msgQueue
[
head
]);
copyFrame
(
frame
,
msgQueue
[
head
]);
//tail++;
//}
}
//evtl. state = 2 setzen für main -> weiß, dass jetzt priorisiert weitergeleitet werden muss
// hier noch head merken und/oder Index zum senden anpassen. -> Priority
break
;
break
;
default:
default:
break
;
break
;
...
...
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