Changeset f619943a in mainline
- Timestamp:
- 2010-05-12T14:36:49Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 04c7003f
- Parents:
- f4ef3c2
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/test_serial/test_serial.c
rf4ef3c2 rf619943a 46 46 #include <device/char.h> 47 47 #include <string.h> 48 #include <ipc/serial_ctl.h> 48 49 49 50 #define NAME "test serial" … … 91 92 } 92 93 94 res = ipc_call_sync_1_0(phone, SERIAL_SET_BAUD_RATE, 1200); 95 if (EOK != res) { 96 printf(NAME ": failed to set baud rate, errno = %d.\n", -res); 97 devman_hangup_phone(DEVMAN_CLIENT); 98 ipc_hangup(phone); 99 free(buf); 100 return 4; 101 } 102 93 103 int total = 0; 94 104 int read = 0; … … 100 110 devman_hangup_phone(DEVMAN_CLIENT); 101 111 free(buf); 102 return 4;112 return 5; 103 113 } 104 114 total += read; -
uspace/lib/libc/include/ipc/dev_iface.h
rf4ef3c2 rf619943a 45 45 #define DEV_IFACE_IDX(id) ((id) - IPC_FIRST_USER_METHOD) 46 46 47 #define DEV_IFACE_COUNT DEV_IFACE_MAX 48 #define DEV_FIRST_CUSTOM_METHOD DEV_IFACE_MAX 47 #define DEV_IFACE_COUNT DEV_IFACE_MAX 48 #define DEV_FIRST_CUSTOM_METHOD_IDX DEV_IFACE_MAX 49 #define DEV_FIRST_CUSTOM_METHOD DEV_IFACE_ID(DEV_FIRST_CUSTOM_METHOD_IDX) 49 50 50 51 -
uspace/srv/drivers/serial/serial.c
rf4ef3c2 rf619943a 119 119 static int serial_read(device_t *dev, char *buf, size_t count) 120 120 { 121 printf(NAME ": serial_read %s\n", dev->name);121 // printf(NAME ": serial_read %s\n", dev->name); 122 122 123 123 int ret = 0; … … 342 342 343 343 if (50 > baud_rate || 0 != MAX_BAUD_RATE % baud_rate) { 344 printf(NAME ": error - somebody tried to set invalid baud rate %d\n", baud_rate); 344 345 return EINVAL; 345 346 } … … 364 365 ioport8_t *port = data->port; 365 366 int ret; 367 368 printf(NAME ": set baud rate %d for the device %s.\n", baud_rate, dev->name); 366 369 367 370 fibril_mutex_lock(&data->mutex); … … 380 383 381 384 serial_port_interrupts_disable(port); // Disable all interrupts 382 serial_port_set_baud_rate(port, 1200);385 serial_port_set_baud_rate(port, 38400); 383 386 pio_write_8(port + 3, 0x07); // 8 bits, no parity, two stop bits 384 387 pio_write_8(port + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold … … 398 401 if (cont = serial_received(port)) { 399 402 uint8_t val = serial_read_8(port); 400 printf(NAME ": character %c read from %s.\n", val, dev->name); 401 403 // printf(NAME ": character %c read from %s.\n", val, dev->name); 402 404 403 405 if (data->client_connected) { … … 408 410 } 409 411 } else { 410 printf(NAME ": no client is connected to %s, discarding the character which was read.\n", dev->name);412 // printf(NAME ": no client is connected to %s, discarding the character which was read.\n", dev->name); 411 413 } 412 414 }
Note:
See TracChangeset
for help on using the changeset viewer.