Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Killer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Vytor Calixto
Killer
Commits
6e50bd82
Commit
6e50bd82
authored
10 years ago
by
Israel Barreto Sant'Anna
Browse files
Options
Downloads
Patches
Plain Diff
Transmission almost complete. It works, but still has some problems
Signed-off-by:
Israel B. Sant'Anna
<
ibsa14@inf.ufpr.br
>
parent
eee0c716
No related branches found
No related tags found
1 merge request
!1
Transmission
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
cMIPS/serial.inp
+0
-1
0 additions, 1 deletion
cMIPS/serial.inp
cMIPS/tests/handlerUART.s
+12
-3
12 additions, 3 deletions
cMIPS/tests/handlerUART.s
cMIPS/tests/uart.c
+23
-25
23 additions, 25 deletions
cMIPS/tests/uart.c
with
35 additions
and
29 deletions
cMIPS/serial.inp
+
0
−
1
View file @
6e50bd82
...
@@ -4,4 +4,3 @@ ffffffff
...
@@ -4,4 +4,3 @@ ffffffff
7C2
7C2
This diff is collapsed.
Click to expand it.
cMIPS/tests/handlerUART.s
+
12
−
3
View file @
6e50bd82
...
@@ -31,9 +31,14 @@ RX:
...
@@ -31,9 +31,14 @@ RX:
nop
nop
sb
$k1
,
0
(
$a0
)
#
Put
data
on
RX_queue
tail
sb
$k1
,
0
(
$a0
)
#
Put
data
on
RX_queue
tail
lui
$a0
,
%
hi
(
x_IO_BASE_ADDR
)
#
lui
$a0
,
%
hi
(
x_IO_BASE_ADDR
)
ori
$a0
,
$a0
,
%
lo
(
x_IO_BASE_ADDR
)
#
ori
$a0
,
$a0
,
%
lo
(
x_IO_BASE_ADDR
)
sw
$k1
,
0
(
$a0
)
#
Print
for
debug
#
sw
$k1
,
0
(
$a0
)
#
Print
for
debug
lw
$k1
,
0
(
$a1
)
j
RX
nop
...
@@ -75,5 +80,9 @@ TX:
...
@@ -75,5 +80,9 @@ TX:
#
ori
$a0
,
$a0
,
%
lo
(
x_IO_BASE_ADDR
)
#
ori
$a0
,
$a0
,
%
lo
(
x_IO_BASE_ADDR
)
#
sw
$a1
,
0
(
$a0
)
#
Print
for
debug
#
sw
$a1
,
0
(
$a0
)
#
Print
for
debug
lw
$k1
,
0
(
$a0
)
j
RX
nop
END
:
END
:
This diff is collapsed.
Click to expand it.
cMIPS/tests/uart.c
+
23
−
25
View file @
6e50bd82
...
@@ -56,7 +56,7 @@ int probetx(void); // returns ntx
...
@@ -56,7 +56,7 @@ int probetx(void); // returns ntx
int
iostat
(
void
);
// returns integer with status at lsb
int
iostat
(
void
);
// returns integer with status at lsb
void
ioctl
(
int
);
// write lsb in control register
void
ioctl
(
int
);
// write lsb in control register
char
getc
(
void
);
// returns char in queue, decrements nrx
char
getc
(
void
);
// returns char in queue, decrements nrx
int
Putc
(
char
);
// inserts char in queue, decrements ntx
void
Putc
(
char
);
// inserts char in queue, decrements ntx
int
ctoi
(
char
);
// converts a character to an integer
int
ctoi
(
char
);
// converts a character to an integer
void
initUd
();
void
initUd
();
...
@@ -76,35 +76,27 @@ int main(){
...
@@ -76,35 +76,27 @@ int main(){
ctrl
.
ign
=
0
;
ctrl
.
ign
=
0
;
ctrl
.
intTX
=
1
;
ctrl
.
intTX
=
1
;
ctrl
.
intRX
=
1
;
ctrl
.
intRX
=
1
;
ctrl
.
speed
=
1
;
// operate at 1/2 of the highest data rate
ctrl
.
speed
=
2
;
// operate at 1/2 of the highest data rate
uart
->
cs
.
ctl
=
ctrl
;
uart
->
cs
.
ctl
=
ctrl
;
initUd
();
initUd
();
int
lol
;
char
last
=
EOF
;
char
last
=
EOF
;
char
first
=
EOF
;
// FIXME: Não tah saindo do while (por causa do ctrl.intTX =1)
while
(
!
((
c
=
getc
())
==
'\n'
&&
c
==
last
))
{
while
(
!
((
c
=
getc
())
==
'\n'
&&
c
==
last
))
{
last
=
c
;
print
(
c
);
if
(
c
!=
EOF
)
{
if
(
c
!=
EOF
)
{
if
(
!
Putc
(
c
)){
print
(
c
);
print
(
0
);
last
=
c
;
while
(
!
(
TXempty
&
uart
->
cs
.
stat
.
s
));
Putc
(
c
);
}
}
if
(
Ud
.
ntx
<
16
){
disableInterr
();
disableInterr
();
first
=
Ud
.
tx_q
[
Ud
.
tx_hd
];
uart
->
d
.
tx
=
Ud
.
tx_q
[
Ud
.
tx_hd
];
Ud
.
tx_hd
=
(
Ud
.
tx_hd
+
1
)
%
16
;
Ud
.
tx_hd
=
(
Ud
.
tx_hd
+
1
)
%
16
;
Ud
.
ntx
++
;
Ud
.
ntx
++
;
enableInterr
();
enableInterr
();
uart
->
d
.
tx
=
first
;
Putc
(
c
);
}
}
}
}
while
(
1
);
// for(i=0;i<Ud.ntx;i++){
// print(Ud.tx_q[i]);
// }
// to_stdout('\n');
//uart->d.tx = '\n'; //Send STX (Start of Text)
// while((c = getc()) != '\0') {
// while((c = getc()) != '\0') {
// if(c != EOF) {
// if(c != EOF) {
...
@@ -148,16 +140,22 @@ char getc(){
...
@@ -148,16 +140,22 @@ char getc(){
return
c
;
return
c
;
}
}
int
Putc
(
char
c
){
void
Putc
(
char
c
){
if
(
Ud
.
ntx
>
0
){
if
(
Ud
.
ntx
>
0
){
disableInterr
();
disableInterr
();
Ud
.
tx_q
[
Ud
.
tx_tl
]
=
c
;
Ud
.
tx_q
[
Ud
.
tx_tl
]
=
c
;
Ud
.
tx_tl
=
(
Ud
.
tx_tl
+
1
)
%
16
;
Ud
.
tx_tl
=
(
Ud
.
tx_tl
+
1
)
%
16
;
Ud
.
ntx
--
;
Ud
.
ntx
--
;
enableInterr
();
enableInterr
();
return
1
;
}
else
{
while
(
!
(
TXempty
&
uart
->
cs
.
stat
.
s
));
disableInterr
();
uart
->
d
.
tx
=
Ud
.
tx_q
[
Ud
.
tx_hd
];
Ud
.
tx_hd
=
(
Ud
.
tx_hd
+
1
)
%
16
;
Ud
.
ntx
++
;
enableInterr
();
Putc
(
c
);
}
}
return
0
;
}
}
int
proberx
(){
int
proberx
(){
...
...
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