URL
https://opencores.org/ocsvn/eco32/eco32/trunk
Subversion Repositories eco32
Compare Revisions
- This comparison shows the changes necessary to convert path
/eco32/trunk/hwtests/serial/sertest
- from Rev 39 to Rev 132
- ↔ Reverse comparison
Rev 39 → Rev 132
/echo1.s
2,7 → 2,7
; echo.s -- test the serial interface |
; |
|
.set sba,0xF0300010 ; serial base address |
.set sba,0xF0301000 ; serial base address |
|
add $8,$0,sba ; set serial base address |
L1: |
/sertest.c
12,8 → 12,6
#include <termios.h> |
|
|
#define SERIAL_PORT "/dev/ttyS0" |
|
#define NUM_TRIES 10 |
|
#define SYN 0x16 |
50,10 → 48,10
} |
|
|
void serialOpen(void) { |
sfd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY); |
void serialOpen(char *serialPort) { |
sfd = open(serialPort, O_RDWR | O_NOCTTY | O_NDELAY); |
if (sfd == -1) { |
error("cannot open serial port '%s'", SERIAL_PORT); |
error("cannot open serial port '%s'", serialPort); |
} |
tcgetattr(sfd, &origOptions); |
currOptions = origOptions; |
127,13 → 125,15
|
|
int main(int argc, char *argv[]) { |
char *serialPort; |
int i; |
|
if (argc != 1) { |
printf("Usage: %s\n", argv[0]); |
if (argc != 2) { |
printf("Usage: %s <serial port>\n", argv[0]); |
exit(1); |
} |
serialOpen(); |
serialPort = argv[1]; |
serialOpen(serialPort); |
errors = 0; |
for (i = 1; i <= 100; i++) { |
block(); |