Mercurial > ecos
comparison packages/io/serial/current/tests/ser_test_protocol.inl @ 20:5f5102441818 ecos-sw-1999-07-02
Merge from eCos master repository on 1999-07-02-23:17:07-BST
| author | jlarmour |
|---|---|
| date | Fri, 02 Jul 1999 15:44:37 +0000 |
| parents | 4f2df4ab82c8 |
| children | 53104bbd5f99 |
comparison
equal
deleted
inserted
replaced
| 19:154303061551 | 20:5f5102441818 |
|---|---|
| 471 new_cfg.stop = cfg->stop_bits; | 471 new_cfg.stop = cfg->stop_bits; |
| 472 new_cfg.parity = cfg->parity; | 472 new_cfg.parity = cfg->parity; |
| 473 | 473 |
| 474 res = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, | 474 res = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, |
| 475 &new_cfg, &len); | 475 &new_cfg, &len); |
| 476 cyg_thread_delay(10); // Some chips don't like changes to happen to fast... | |
| 476 | 477 |
| 477 // Driver didn't like it. It will not have changed anything, so it's | 478 // Driver didn't like it. It will not have changed anything, so it's |
| 478 // safe to return now. | 479 // safe to return now. |
| 479 if (ENOERR != res) { | 480 if (ENOERR != res) { |
| 480 // Let user know that the config was skipped due to the target. | 481 // Let user know that the config was skipped due to the target. |
| 487 | 488 |
| 488 // Succeeded. Change back to the original config so we can communicate | 489 // Succeeded. Change back to the original config so we can communicate |
| 489 // with the host. | 490 // with the host. |
| 490 res = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, | 491 res = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, |
| 491 &old_cfg, &len); | 492 &old_cfg, &len); |
| 493 cyg_thread_delay(10); // Some chips don't like changes to happen to fast... | |
| 492 if (ENOERR != res) { | 494 if (ENOERR != res) { |
| 493 diag_printf("change_config: set_config failed/1 (%d)\n", res); | 495 diag_printf("change_config: set_config failed/1 (%d)\n", res); |
| 494 hang(); | 496 hang(); |
| 495 } | 497 } |
| 496 | 498 |
| 519 // get totally lost, in which case there's not much else to do | 521 // get totally lost, in which case there's not much else to do |
| 520 // really. In this case the host will consider the test a FAIL. | 522 // really. In this case the host will consider the test a FAIL. |
| 521 len = sizeof(new_cfg); | 523 len = sizeof(new_cfg); |
| 522 res = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, | 524 res = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, |
| 523 &new_cfg, &len); | 525 &new_cfg, &len); |
| 526 cyg_thread_delay(10); // Some chips don't like changes to happen to fast... | |
| 524 if (ENOERR != res) { | 527 if (ENOERR != res) { |
| 525 diag_printf("change_config: set_config failed/2 (%d)\n", res); | 528 diag_printf("change_config: set_config failed/2 (%d)\n", res); |
| 526 hang(); | 529 hang(); |
| 527 } | 530 } |
| 528 | 531 |
| 612 | 615 |
| 613 // Revert to the old configuration and try again. | 616 // Revert to the old configuration and try again. |
| 614 len = sizeof(old_cfg); | 617 len = sizeof(old_cfg); |
| 615 res = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, | 618 res = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, |
| 616 &old_cfg, &len); | 619 &old_cfg, &len); |
| 620 cyg_thread_delay(10); // Some chips don't like changes to happen to fast... | |
| 617 if (res != ENOERR) { | 621 if (res != ENOERR) { |
| 618 diag_printf("change_config: set_config failed/3 (%d)\n", res); | 622 diag_printf("change_config: set_config failed/3 (%d)\n", res); |
| 619 hang(); | 623 hang(); |
| 620 } | 624 } |
| 621 out_buf[0] = 't'; // change the char so a developer can | 625 out_buf[0] = 't'; // change the char so a developer can |
