1 #define ser_init init_interface
2 #define handle_serial_read handle_read
3 #define send_serial_ack send_ack
4 #define send_serial_string send_string
5 #define send_serial_hex send_hex
8 #include "sv_addr_ag.h"
14 REG_SET__R_SERIAL0_XOFF
21 REG_SET__R_SERIAL0_BAUD
27 REG_SET__R_SERIAL0_REC_CTRL
33 rec_stick_par
, normal
,
39 REG_SET__R_SERIAL0_TR_CTRL
54 #define SER_MASK (IO_MASK(R_SERIAL0_READ, data_avail) | IO_MASK(R_SERIAL0_READ, data_in))
57 handle_serial_read(void)
59 udword status_and_data_in
= *R_SERIAL0_READ
& SER_MASK
;
61 if (status_and_data_in
& IO_STATE(R_SERIAL0_READ
, data_avail
, yes
)) {
62 *(char*)(target_address
+ nbr_read
++) = status_and_data_in
& 0xff; /* ugly mask */
63 last_timeout
= REG_GET(R_TIMER0_DATA
, count
);
73 while (!REG_EQL(R_SERIAL0_STATUS
, tr_ready
, ready
))
76 REG_ISET(0, R_SERIAL0_TR_DATA
, data_out
, '+');
80 send_serial_string(char *str
)
84 for (i
= 0; str
[i
];) {
85 if (REG_IEQL(0, R_SERIAL0_STATUS
, tr_ready
, ready
)) {
86 REG_ISET(0, R_SERIAL0_TR_DATA
, data_out
, str
[i
]);
93 send_serial_hex(udword v
, byte nl
)
109 for (i
= 0; i
!= 8; i
++) {
110 nybble
= (v
>> (i
*4)) & 0xf;
114 buf
[7-i
+2] = nybble
+ '0';
116 send_serial_string(buf
);