Changeset f300523 in mainline for uspace/app/tester/hw/serial/serial1.c
- Timestamp:
- 2017-11-29T18:43:10Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 39026d7c
- Parents:
- 48b77ed
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/hw/serial/serial1.c
r48b77ed rf300523 45 45 #include <stddef.h> 46 46 #include <str.h> 47 #include <thread.h>48 47 #include "../../tester.h" 49 48 … … 162 161 TPRINTF("Read %zd bytes\n", nread); 163 162 164 if (nread == 0) 165 thread_usleep(DEFAULT_SLEEP); 166 else { 167 buf[nread] = 0; 168 169 /* 170 * Write data back to the device to test the opposite 171 * direction of data transfer. 172 */ 173 rc = chardev_write(chardev, buf, nread, &nwritten); 174 if (rc != EOK) { 175 (void) serial_set_comm_props(serial, old_baud, 176 old_par, old_word_size, old_stop); 177 178 free(buf); 179 chardev_close(chardev); 180 serial_close(serial); 181 async_hangup(sess); 182 return "Failed writing to serial device"; 183 } 184 185 if (nwritten != nread) { 186 (void) serial_set_comm_props(serial, old_baud, 187 old_par, old_word_size, old_stop); 188 189 free(buf); 190 chardev_close(chardev); 191 serial_close(serial); 192 async_hangup(sess); 193 return "Written less data than read from serial device"; 194 } 195 196 TPRINTF("Written %zd bytes\n", nwritten); 197 } 163 buf[nread] = 0; 164 165 /* 166 * Write data back to the device to test the opposite 167 * direction of data transfer. 168 */ 169 rc = chardev_write(chardev, buf, nread, &nwritten); 170 if (rc != EOK) { 171 (void) serial_set_comm_props(serial, old_baud, 172 old_par, old_word_size, old_stop); 173 174 free(buf); 175 chardev_close(chardev); 176 serial_close(serial); 177 async_hangup(sess); 178 return "Failed writing to serial device"; 179 } 180 181 if (nwritten != nread) { 182 (void) serial_set_comm_props(serial, old_baud, 183 old_par, old_word_size, old_stop); 184 185 free(buf); 186 chardev_close(chardev); 187 serial_close(serial); 188 async_hangup(sess); 189 return "Written less data than read from serial device"; 190 } 191 192 TPRINTF("Written %zd bytes\n", nwritten); 198 193 199 194 total += nread;
Note:
See TracChangeset
for help on using the changeset viewer.