- Timestamp:
-
04/30/07 04:49:00 (17 years ago)
- Author:
-
Paulw
- Comment:
-
Descript RTEMS_IO_RCVWAKEUP
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v4
|
v5
|
|
22 | 22 | |
23 | 23 | Not that I know of but I do know Robert Wade. :) |
| 24 | |
| 25 | |
| 26 | 5. ''Does RTEMS support select() on serial ports |
| 27 | |
| 28 | No. However, there is a method to register a call back on serial communications that can be used |
| 29 | for the same effect. ioctl( fd, RTEMS_IO_RCVWAKEUP, &wakeup); |
| 30 | |
| 31 | Here is a code snippet: |
| 32 | |
| 33 | void receive_callback(struct termios *tty, void * arg ) |
| 34 | { |
| 35 | (void) rtems_event_send( (rtems_id) arg, EVENT_RS232_RX ); |
| 36 | } |
| 37 | |
| 38 | To install the callback |
| 39 | |
| 40 | rtems_id task; |
| 41 | struct ttywakeup wakeup; |
| 42 | |
| 43 | rtems_task_ident( RTEMS_SELF, RTEMS_LOCAL, &task); |
| 44 | |
| 45 | wakeup.sw_pfn = receive_callback; |
| 46 | wakeup.sw_arg = (void *) task ; |
| 47 | |
| 48 | ioctl( fd, RTEMS_IO_RCVWAKEUP, &wakeup); |