Changeset 7fd5e89 in rtems
- Timestamp:
- 10/07/14 14:28:04 (9 years ago)
- Branches:
- 4.11, 5, master
- Children:
- d5cc923f
- Parents:
- a830cb8
- git-author:
- Sebastian Huber <sebastian.huber@…> (10/07/14 14:28:04)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (10/07/14 14:35:13)
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/arm/tms570/console/tms570-sci.c
ra830cb8 r7fd5e89 27 27 #include <termios.h> 28 28 #include <rtems/termiostypes.h> 29 #include <libchip/sersupp.h>30 29 #include <bsp/tms570-sci.h> 31 30 #include <bsp/tms570-sci-driver.h> … … 44 43 const tms570_sci_context driver_context_table[] = { 45 44 { 45 .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("TMS570 SCI1"), 46 46 .device_name = "/dev/console", 47 47 .regs = &TMS570_SCI, … … 49 49 }, 50 50 { 51 .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("TMS570 SCI2"), 51 52 .device_name = "/dev/ttyS1", 52 53 .regs = &TMS570_SCI2, … … 105 106 handler, 106 107 NULL, 107 (void *) ctx108 RTEMS_DECONST(rtems_termios_device_context *, &ctx->base) 108 109 ); 109 110 if ( sc != RTEMS_SUCCESSFUL ) { … … 197 198 * Sets attributes of the HW peripheral (parity, baud rate, etc.) 198 199 * 199 * @param[in] tty rtems_termios_tty200 * @param[in] base context of the driver 200 201 * @param[in] t termios driver 201 202 * @retval true peripheral setting is changed 202 203 */ 203 204 static bool tms570_sci_set_attributes( 204 rtems_termios_ tty *tty,205 rtems_termios_device_context *base, 205 206 const struct termios *t 206 207 ) 207 208 { 208 tms570_sci_context *ctx = rtems_termios_get_device_context(tty);209 tms570_sci_context *ctx = (tms570_sci_context *) base; 209 210 rtems_interrupt_lock_context lock_context; 210 211 int32_t bauddiv; 211 212 int32_t baudrate; 212 213 213 rtems_termios_ interrupt_lock_acquire(tty, &lock_context);214 rtems_termios_device_lock_acquire(base, &lock_context); 214 215 215 216 ctx->regs->SCIGCR1 &= ~( (1<<7) | (1<<25) | (1<<24) ); … … 246 247 ctx->regs->SCIGCR1 |= (1<<7) | (1<<25) | (1<<24); 247 248 248 rtems_termios_ interrupt_lock_release(tty, &lock_context);249 rtems_termios_device_lock_release(base, &lock_context); 249 250 250 251 return true; … … 301 302 * so only one character can be written. 302 303 * 303 * @param[in] tty rtems_termios_tty304 * @param[in] base context of the driver 304 305 * @param[in] buf buffer of characters pending to send 305 306 * @param[in] len size of the buffer … … 307 308 */ 308 309 static void tms570_sci_interrupt_write( 309 rtems_termios_ tty *tty,310 rtems_termios_device_context *base, 310 311 const char *buf, 311 312 size_t len 312 313 ) 313 314 { 314 tms570_sci_context *ctx = rtems_termios_get_device_context(tty);315 tms570_sci_context *ctx = (tms570_sci_context *) base; 315 316 316 317 if ( len > 0 ) { … … 335 336 * character to HW peripheral. Writes all characters in the buffer. 336 337 * 337 * @param[in] tty rtems_termios_tty338 * @param[in] base context of the driver 338 339 * @param[in] buf buffer of characters pending to send 339 340 * @param[in] len size of the buffer … … 341 342 */ 342 343 static void tms570_sci_poll_write( 343 rtems_termios_ tty *tty,344 const char 345 size_t 346 ) 347 { 348 tms570_sci_context *ctx = rtems_termios_get_device_context(tty);344 rtems_termios_device_context *base, 345 const char *buf, 346 size_t n 347 ) 348 { 349 tms570_sci_context *ctx = (tms570_sci_context *) base; 349 350 size_t i; 350 351 … … 395 396 * check if there is recieved character to be read and reads it. 396 397 * 397 * @param[in] tty rtems_termios_tty (context of the driver)398 * @param[in] base context of the driver 398 399 * @retval -1 No character to be read 399 400 * @retval x Read character 400 401 */ 401 static int tms570_sci_poll_read(rtems_termios_ tty *tty)402 { 403 tms570_sci_context *ctx = rtems_termios_get_device_context(tty);402 static int tms570_sci_poll_read(rtems_termios_device_context *base) 403 { 404 tms570_sci_context *ctx = (tms570_sci_context *) base; 404 405 405 406 /* Check if a character is available */ … … 417 418 * This function is called only once when opening the driver. 418 419 * 419 * @param[in] tty context of the driver 420 * @param[in] tty Termios control 421 * @param[in] ctx context of the driver 422 * @param[in] term Termios attributes 420 423 * @param[in] args 421 424 * @retval false Error occured during initialization … … 424 427 static bool tms570_sci_poll_first_open( 425 428 rtems_termios_tty *tty, 429 rtems_termios_device_context *ctx, 430 struct termios *term, 426 431 rtems_libio_open_close_args_t *args 427 432 ) … … 429 434 bool ok; 430 435 431 rtems_termios_set_best_baud(t ty, TMS570_SCI_BAUD_RATE);432 ok = tms570_sci_set_attributes( tty, rtems_termios_get_termios(tty));436 rtems_termios_set_best_baud(term, TMS570_SCI_BAUD_RATE); 437 ok = tms570_sci_set_attributes(ctx, term); 433 438 if ( !ok ) { 434 439 return false; … … 443 448 * install and enables interrupts. 444 449 * 445 * @param[in] tty context of the driver 450 * @param[in] tty Termios control 451 * @param[in] base context of the driver 446 452 * @param[in] args 447 453 * @retval false Error occured during initialization … … 450 456 static bool tms570_sci_interrupt_first_open( 451 457 rtems_termios_tty *tty, 458 rtems_termios_device_context *base, 459 struct termios *term, 452 460 rtems_libio_open_close_args_t *args 453 461 ) 454 462 { 455 tms570_sci_context *ctx = rtems_termios_get_device_context(tty);463 tms570_sci_context *ctx = (tms570_sci_context *) base; 456 464 rtems_status_code sc; 457 465 bool ret; 458 466 459 ret = tms570_sci_poll_first_open(tty, args);467 ret = tms570_sci_poll_first_open(tty, base, term, args); 460 468 if ( ret == false ) { 461 469 return false; … … 472 480 return false; 473 481 } 474 tms570_sci_enable_interrupts( rtems_termios_get_device_context(tty));482 tms570_sci_enable_interrupts(ctx); 475 483 return true; 476 484 } … … 479 487 * @brief closes sci peripheral 480 488 * 481 * @param[in] tty context of the driver 489 * @param[in] tty Termios control 490 * @param[in] base context of the driver 482 491 * @param[in] args 483 492 * @retval false Error occured during initialization … … 486 495 static void tms570_sci_poll_last_close( 487 496 rtems_termios_tty *tty, 497 rtems_termios_device_context *base, 488 498 rtems_libio_open_close_args_t *args 489 499 ) … … 497 507 * calls tms570_sci_poll_last_close and disables interrupts 498 508 * 499 * @param[in] tty context of the driver 509 * @param[in] tty Termios control 510 * @param[in] base context of the driver 500 511 * @param[in] args 501 512 * @retval false Error occured during initialization … … 504 515 static void tms570_sci_interrupt_last_close( 505 516 rtems_termios_tty *tty, 517 rtems_termios_device_context *base, 506 518 rtems_libio_open_close_args_t *args 507 519 ) 508 520 { 509 tms570_sci_context *ctx = rtems_termios_get_device_context(tty);521 tms570_sci_context *ctx = (tms570_sci_context *) base; 510 522 rtems_interrupt_lock_context lock_context; 511 523 512 524 /* Turn off RX interrupts */ 513 rtems_termios_ interrupt_lock_acquire(tty, &lock_context);525 rtems_termios_device_lock_acquire(base, &lock_context); 514 526 tms570_sci_disable_interrupts(ctx); 515 rtems_termios_ interrupt_lock_release(tty, &lock_context);527 rtems_termios_device_lock_release(base, &lock_context); 516 528 517 529 /* Flush device */ … … 523 535 rtems_interrupt_handler_remove(ctx->irq, tms570_sci_interrupt_handler, tty); 524 536 525 tms570_sci_poll_last_close(tty, args);537 tms570_sci_poll_last_close(tty, base, args); 526 538 } 527 539 -
c/src/lib/libbsp/arm/tms570/include/tms570-sci-driver.h
ra830cb8 r7fd5e89 37 37 /* Low-level driver specific data structure */ 38 38 typedef struct { 39 rtems_termios_device_context base; 39 40 const char *device_name; 40 41 volatile tms570_sci_t *regs; -
c/src/lib/libbsp/sparc/leon3/console/console.c
ra830cb8 r7fd5e89 37 37 static int uarts = 0; 38 38 39 static struct apbuart_context *leon3_console_get_uart(int minor)39 static rtems_termios_device_context *leon3_console_get_context(int minor) 40 40 { 41 41 struct apbuart_context *uart; … … 46 46 uart = &apbuarts[minor - 1]; 47 47 48 return uart; 48 rtems_termios_device_context_initialize(&uart->base, "APBUART"); 49 50 return &uart->base; 49 51 } 50 52 … … 133 135 handler, 134 136 NULL, 135 leon3_console_get_ uart(syscon_uart_index)137 leon3_console_get_context(syscon_uart_index) 136 138 ); 137 139 if (status != RTEMS_SUCCESSFUL) … … 150 152 handler, 151 153 NULL, 152 leon3_console_get_ uart(syscon_uart_index)154 leon3_console_get_context(syscon_uart_index) 153 155 ); 154 156 } -
c/src/lib/libbsp/sparc/shared/include/apbuart_termios.h
ra830cb8 r7fd5e89 23 23 24 24 struct apbuart_context { 25 rtems_termios_device_context base; 25 26 struct apbuart_regs *regs; 26 27 unsigned int freq_hz; -
c/src/lib/libbsp/sparc/shared/uart/apbuart_termios.c
ra830cb8 r7fd5e89 42 42 43 43 static void apbuart_write_support( 44 rtems_termios_ tty *tty,44 rtems_termios_device_context *base, 45 45 const char *buf, 46 46 size_t len 47 47 ) 48 48 { 49 struct apbuart_context *uart = rtems_termios_get_device_context(tty);49 struct apbuart_context *uart = (struct apbuart_context *) base; 50 50 int sending; 51 51 … … 70 70 71 71 static void apbuart_write_polled( 72 rtems_termios_ tty *tty,72 rtems_termios_device_context *base, 73 73 const char *buf, 74 74 size_t len 75 75 ) 76 76 { 77 struct apbuart_context *uart = rtems_termios_get_device_context(tty);77 struct apbuart_context *uart = (struct apbuart_context *) base; 78 78 size_t nwrite = 0; 79 79 … … 84 84 } 85 85 86 static int apbuart_poll_read(rtems_termios_ tty *tty)87 { 88 struct apbuart_context *uart = rtems_termios_get_device_context(tty);86 static int apbuart_poll_read(rtems_termios_device_context *base) 87 { 88 struct apbuart_context *uart = (struct apbuart_context *) base; 89 89 90 90 return apbuart_inbyte_nonblocking(uart->regs); … … 92 92 93 93 static bool apbuart_set_attributes( 94 rtems_termios_ tty *tty,94 rtems_termios_device_context *base, 95 95 const struct termios *t 96 96 ) 97 97 { 98 struct apbuart_context *uart = rtems_termios_get_device_context(tty);98 struct apbuart_context *uart = (struct apbuart_context *) base; 99 99 rtems_interrupt_lock_context lock_context; 100 100 unsigned int scaler; … … 113 113 } 114 114 115 rtems_termios_ interrupt_lock_acquire(tty, &lock_context);115 rtems_termios_device_lock_acquire(base, &lock_context); 116 116 117 117 /* Read out current value */ … … 146 146 uart->regs->ctrl = ctrl; 147 147 148 rtems_termios_ interrupt_lock_release(tty, &lock_context);148 rtems_termios_device_lock_release(base, &lock_context); 149 149 150 150 /* Baud rate */ … … 162 162 163 163 static void apbuart_set_best_baud( 164 rtems_termios_tty *tty,165 const struct apbuart_context *uart164 const struct apbuart_context *uart, 165 struct termios *term 166 166 ) 167 167 { 168 168 uint32_t baud = (uart->freq_hz * 10) / ((uart->regs->scaler * 10 + 5) * 8); 169 169 170 rtems_termios_set_best_baud(t ty, baud);170 rtems_termios_set_best_baud(term, baud); 171 171 } 172 172 173 173 static bool apbuart_first_open_polled( 174 174 rtems_termios_tty *tty, 175 rtems_termios_device_context *base, 176 struct termios *term, 175 177 rtems_libio_open_close_args_t *args 176 178 ) 177 179 { 178 struct apbuart_context *uart = rtems_termios_get_device_context(tty);179 180 apbuart_set_best_baud( tty, uart);180 struct apbuart_context *uart = (struct apbuart_context *) base; 181 182 apbuart_set_best_baud(uart, term); 181 183 182 184 /* Initialize UART on opening */ … … 189 191 static bool apbuart_first_open_interrupt( 190 192 rtems_termios_tty *tty, 193 rtems_termios_device_context *base, 194 struct termios *term, 191 195 rtems_libio_open_close_args_t *args 192 196 ) 193 197 { 194 struct apbuart_context *uart = rtems_termios_get_device_context(tty);198 struct apbuart_context *uart = (struct apbuart_context *) base; 195 199 rtems_status_code sc; 196 200 197 apbuart_set_best_baud( tty, uart);201 apbuart_set_best_baud(uart, term); 198 202 199 203 /* Register Interrupt handler */ … … 218 222 static void apbuart_last_close_interrupt( 219 223 rtems_termios_tty *tty, 224 rtems_termios_device_context *base, 220 225 rtems_libio_open_close_args_t *args 221 226 ) 222 227 { 223 struct apbuart_context *uart = rtems_termios_get_device_context(tty);228 struct apbuart_context *uart = (struct apbuart_context *) base; 224 229 rtems_interrupt_lock_context lock_context; 225 230 226 231 /* Turn off RX interrupts */ 227 rtems_termios_ interrupt_lock_acquire(tty, &lock_context);232 rtems_termios_device_lock_acquire(base, &lock_context); 228 233 uart->regs->ctrl &= ~(APBUART_CTRL_RI); 229 rtems_termios_ interrupt_lock_release(tty, &lock_context);234 rtems_termios_device_lock_release(base, &lock_context); 230 235 231 236 /**** Flush device ****/ -
cpukit/libcsupport/include/rtems/termiostypes.h
ra830cb8 r7fd5e89 64 64 65 65 /** 66 * @brief Termios device context. 67 * 68 * @see RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER(), 69 * rtems_termios_device_context_initialize() and 70 * rtems_termios_device_install(). 71 */ 72 typedef struct rtems_termios_device_context { 73 rtems_interrupt_lock interrupt_lock; 74 } rtems_termios_device_context; 75 76 /** 77 * @brief Initializes a device context. 78 * 79 * @param[in] context The Termios device context. 80 * @param[in] name The name for the interrupt lock. This name must be a 81 * string persistent throughout the life time of this lock. The name is only 82 * used if profiling is enabled. 83 */ 84 RTEMS_INLINE_ROUTINE void rtems_termios_device_context_initialize( 85 rtems_termios_device_context *context, 86 const char *name 87 ) 88 { 89 rtems_interrupt_lock_initialize( &context->interrupt_lock, name ); 90 } 91 92 /** 93 * @brief Initializer for static initialization of Termios device contexts. 94 * 95 * @param name The name for the interrupt lock. It must be a string. The name 96 * is only used if profiling is enabled. 97 */ 98 #define RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( name ) \ 99 { RTEMS_INTERRUPT_LOCK_INITIALIZER( name ) } 100 101 /** 66 102 * @brief Termios device handler. 67 103 * … … 72 108 * @brief First open of this device. 73 109 * 74 * @param[in] tty The Termios control. 110 * @param[in] tty The Termios control. This parameter may be passed to 111 * interrupt service routines since it must be provided for the 112 * rtems_termios_enqueue_raw_characters() and 113 * rtems_termios_dequeue_characters() functions. 114 * @param[in] context The Termios device context. 115 * @param[in] term The current Termios attributes. 75 116 * @param[in] args The open/close arguments. This is parameter provided to 76 117 * support legacy drivers. It must not be used by new drivers. … … 79 120 * @retval false Cannot open device. 80 121 * 81 * @see rtems_termios_get_device_context(), rtems_termios_set_best_baud() and 82 * rtems_termios_get_termios(). 122 * @see rtems_termios_get_device_context() and rtems_termios_set_best_baud(). 83 123 */ 84 124 bool (*first_open)( 85 125 struct rtems_termios_tty *tty, 126 rtems_termios_device_context *context, 127 struct termios *term, 86 128 rtems_libio_open_close_args_t *args 87 129 ); … … 91 133 * 92 134 * @param[in] tty The Termios control. 135 * @param[in] context The Termios device context. 93 136 * @param[in] args The open/close arguments. This is parameter provided to 94 137 * support legacy drivers. It must not be used by new drivers. 95 *96 * @see rtems_termios_get_device_context().97 138 */ 98 139 void (*last_close)( 99 140 struct rtems_termios_tty *tty, 141 rtems_termios_device_context *context, 100 142 rtems_libio_open_close_args_t *args 101 143 ); … … 107 149 * received via rtems_termios_enqueue_raw_characters(). 108 150 * 109 * @param[in] tty The Termios control.151 * @param[in] context The Termios device context. 110 152 * 111 153 * @retval char The received data encoded as unsigned char. 112 154 * @retval -1 No data currently available. 113 * 114 * @see rtems_termios_get_device_context(). 115 */ 116 int (*poll_read)(struct rtems_termios_tty *tty); 155 */ 156 int (*poll_read)(rtems_termios_device_context *context); 117 157 118 158 /** … … 120 160 * otherwise. 121 161 * 122 * @param[in] tty The Termios control.162 * @param[in] context The Termios device context. 123 163 * @param[in] buf The output buffer. 124 164 * @param[in] len The output buffer length in characters. 125 * 126 * @see rtems_termios_get_device_context(). 127 */ 128 void (*write)(struct rtems_termios_tty *tty, const char *buf, size_t len); 165 */ 166 void (*write)( 167 rtems_termios_device_context *context, 168 const char *buf, 169 size_t len 170 ); 129 171 130 172 /** 131 173 * @brief Set attributes after a Termios settings change. 132 174 * 133 * @param[in] tty The Termios control.175 * @param[in] context The Termios device context. 134 176 * @param[in] term The new Termios attributes. 135 177 * 136 178 * @retval true Successful operation. 137 179 * @retval false Invalid attributes. 138 *139 * @see rtems_termios_get_device_context().140 180 */ 141 181 bool (*set_attributes)( 142 struct rtems_termios_tty *tty,143 const struct termios *term182 rtems_termios_device_context *context, 183 const struct termios *term 144 184 ); 145 185 … … 159 199 * @brief Indicate to stop remote transmitter. 160 200 * 161 * @param[in] tty The Termios control. 162 * 163 * @see rtems_termios_get_device_context(). 164 */ 165 void (*stop_remote_tx)(struct rtems_termios_tty *tty); 201 * @param[in] context The Termios device context. 202 */ 203 void (*stop_remote_tx)(rtems_termios_device_context *context); 166 204 167 205 /** 168 206 * @brief Indicate to start remote transmitter. 169 207 * 170 * @param[in] tty The Termios control. 171 * 172 * @see rtems_termios_get_device_context(). 173 */ 174 void (*start_remote_tx)(struct rtems_termios_tty *tty); 208 * @param[in] context The Termios device context. 209 */ 210 void (*start_remote_tx)(rtems_termios_device_context *context); 175 211 } rtems_termios_device_flow; 176 212 … … 186 222 const rtems_termios_device_handler *handler; 187 223 const rtems_termios_device_flow *flow; 188 void*context;224 rtems_termios_device_context *context; 189 225 struct rtems_termios_tty *tty; 190 226 } rtems_termios_device_node; … … 259 295 260 296 /** 297 * @brief Context for legacy devices using the callbacks. 298 */ 299 rtems_termios_device_context legacy_device_context; 300 301 /** 261 302 * @brief The device handler. 262 303 */ … … 290 331 int tty_rcvwakeup; 291 332 292 rtems_interrupt_lock interrupt_lock;293 294 333 /** 295 334 * @brief Corresponding device node. … … 299 338 /** 300 339 * @brief Context for device driver. 301 * 302 * @see rtems_termios_get_device_context(). 303 */ 304 void *device_context; 340 */ 341 rtems_termios_device_context *device_context; 305 342 } rtems_termios_tty; 306 343 … … 336 373 const rtems_termios_device_handler *handler, 337 374 const rtems_termios_device_flow *flow, 338 void*context375 rtems_termios_device_context *context 339 376 ); 340 377 … … 383 420 /** 384 421 * @brief Returns the device context of an installed Termios device. 422 * 423 * @param[in] tty The Termios control. 385 424 */ 386 425 RTEMS_INLINE_ROUTINE void *rtems_termios_get_device_context( … … 392 431 393 432 /** 394 * @brief Returns the Termios structure. 395 * 396 * It can be used for example in the first open handler to adjust or obtain the 397 * initial attributes. 398 */ 399 RTEMS_INLINE_ROUTINE struct termios *rtems_termios_get_termios( 400 rtems_termios_tty *tty 433 * @brief Acquires the device lock. 434 * 435 * @param[in] context The device context. 436 * @param[in] lock_context The local interrupt lock context for an acquire and 437 * release pair. 438 */ 439 RTEMS_INLINE_ROUTINE void rtems_termios_device_lock_acquire( 440 rtems_termios_device_context *context, 441 rtems_interrupt_lock_context *lock_context 401 442 ) 402 443 { 403 return &tty->termios; 444 rtems_interrupt_lock_acquire( &context->interrupt_lock, lock_context ); 445 } 446 447 /** 448 * @brief Releases the device lock. 449 * 450 * @param[in] context The device context. 451 * @param[in] lock_context The local interrupt lock context for an acquire and 452 * release pair. 453 */ 454 RTEMS_INLINE_ROUTINE void rtems_termios_device_lock_release( 455 rtems_termios_device_context *context, 456 rtems_interrupt_lock_context *lock_context 457 ) 458 { 459 rtems_interrupt_lock_release( &context->interrupt_lock, lock_context ); 404 460 } 405 461 … … 410 466 * value is chosen which minimizes the difference to the value specified. 411 467 * 412 * @param[in] t ty The Termios control.468 * @param[in] term The Termios attributes. 413 469 * @param[in] baud The current baud setting of the device. 414 470 */ 415 471 void rtems_termios_set_best_baud( 416 rtems_termios_tty *tty,417 uint32_t 472 struct termios *term, 473 uint32_t baud 418 474 ); 419 475 … … 499 555 ); 500 556 501 #define rtems_termios_interrupt_lock_acquire(tty, level) \502 rtems_interrupt_lock_acquire(&tty->interrupt_lock, level)503 504 #define rtems_termios_interrupt_lock_release(tty, level) \505 rtems_interrupt_lock_release(&tty->interrupt_lock, level)506 507 557 #ifdef __cplusplus 508 558 } -
cpukit/libcsupport/src/termios.c
ra830cb8 r7fd5e89 135 135 const rtems_termios_device_handler *handler, 136 136 const rtems_termios_device_flow *flow, 137 void*context137 rtems_termios_device_context *context 138 138 ) 139 139 { … … 228 228 } 229 229 230 static rtems_termios_tty * 231 legacyContextToTTY (rtems_termios_device_context *ctx) 232 { 233 return RTEMS_CONTAINER_OF (ctx, rtems_termios_tty, legacy_device_context); 234 } 235 230 236 static bool 231 237 rtems_termios_callback_firstOpen( 232 238 rtems_termios_tty *tty, 239 rtems_termios_device_context *ctx, 240 struct termios *term, 233 241 rtems_libio_open_close_args_t *args 234 242 ) 235 243 { 244 (void) ctx; 245 (void) term; 246 236 247 (*tty->device.firstOpen) (tty->major, tty->minor, args); 237 248 … … 242 253 rtems_termios_callback_lastClose( 243 254 rtems_termios_tty *tty, 255 rtems_termios_device_context *ctx, 244 256 rtems_libio_open_close_args_t *args 245 257 ) 246 258 { 259 (void) ctx; 260 247 261 (*tty->device.lastClose) (tty->major, tty->minor, args); 248 262 } 249 263 250 264 static int 251 rtems_termios_callback_pollRead (struct rtems_termios_tty *tty) 252 { 265 rtems_termios_callback_pollRead (rtems_termios_device_context *ctx) 266 { 267 rtems_termios_tty *tty = legacyContextToTTY (ctx); 268 253 269 return (*tty->device.pollRead) (tty->minor); 254 270 } … … 256 272 static void 257 273 rtems_termios_callback_write( 258 rtems_termios_ tty *tty,259 const char *buf,260 size_t len274 rtems_termios_device_context *ctx, 275 const char *buf, 276 size_t len 261 277 ) 262 278 { 279 rtems_termios_tty *tty = legacyContextToTTY (ctx); 280 263 281 (*tty->device.write) (tty->minor, buf, len); 264 282 } … … 266 284 static bool 267 285 rtems_termios_callback_setAttributes( 268 rtems_termios_ tty *tty,269 const struct termios *term286 rtems_termios_device_context *ctx, 287 const struct termios *term 270 288 ) 271 289 { 290 rtems_termios_tty *tty = legacyContextToTTY (ctx); 291 272 292 (*tty->device.setAttributes) (tty->minor, term); 273 293 … … 276 296 277 297 static void 278 rtems_termios_callback_stopRemoteTx (rtems_termios_tty *tty) 279 { 298 rtems_termios_callback_stopRemoteTx (rtems_termios_device_context *ctx) 299 { 300 rtems_termios_tty *tty = legacyContextToTTY (ctx); 301 280 302 (*tty->device.stopRemoteTx) (tty->minor); 281 303 } 282 304 283 305 static void 284 rtems_termios_callback_startRemoteTx (rtems_termios_tty *tty) 285 { 306 rtems_termios_callback_startRemoteTx (rtems_termios_device_context *ctx) 307 { 308 rtems_termios_tty *tty = legacyContextToTTY (ctx); 309 286 310 (*tty->device.startRemoteTx) (tty->minor); 287 311 } … … 293 317 drainOutput (struct rtems_termios_tty *tty) 294 318 { 319 rtems_termios_device_context *ctx = tty->device_context; 295 320 rtems_interrupt_lock_context lock_context; 296 321 rtems_status_code sc; 297 322 298 323 if (tty->handler.mode != TERMIOS_POLLED) { 299 rtems_termios_ interrupt_lock_acquire (tty, &lock_context);324 rtems_termios_device_lock_acquire (ctx, &lock_context); 300 325 while (tty->rawOutBuf.Tail != tty->rawOutBuf.Head) { 301 326 tty->rawOutBufState = rob_wait; 302 rtems_termios_ interrupt_lock_release (tty, &lock_context);327 rtems_termios_device_lock_release (ctx, &lock_context); 303 328 sc = rtems_semaphore_obtain( 304 329 tty->rawOutBuf.Semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT); 305 330 if (sc != RTEMS_SUCCESSFUL) 306 331 rtems_fatal_error_occurred (sc); 307 rtems_termios_ interrupt_lock_acquire (tty, &lock_context);308 } 309 rtems_termios_ interrupt_lock_release (tty, &lock_context);332 rtems_termios_device_lock_acquire (ctx, &lock_context); 333 } 334 rtems_termios_device_lock_release (ctx, &lock_context); 310 335 } 311 336 } … … 345 370 } 346 371 if (last_close && tty->handler.last_close) 347 (*tty->handler.last_close)(tty, arg);372 (*tty->handler.last_close)(tty, tty->device_context, arg); 348 373 349 374 if (tty->device_node != NULL) … … 356 381 (tty->handler.mode == TERMIOS_TASK_DRIVEN)) 357 382 rtems_semaphore_delete (tty->rawInBuf.Semaphore); 358 rtems_interrupt_lock_destroy (&tty->interrupt_lock); 383 384 if (tty->device_context == &tty->legacy_device_context) 385 rtems_interrupt_lock_destroy (&tty->legacy_device_context.interrupt_lock); 386 359 387 free (tty->rawInBuf.theBuf); 360 388 free (tty->rawOutBuf.theBuf); … … 490 518 } 491 519 492 rtems_interrupt_lock_initialize (&tty->interrupt_lock, "Termios"); 520 if (tty->device_context == NULL) { 521 tty->device_context = &tty->legacy_device_context; 522 rtems_termios_device_context_initialize (tty->device_context, "Termios"); 523 } 493 524 494 525 /* … … 570 601 args->iop->data1 = tty; 571 602 if (!tty->refcount++) { 572 if (tty->handler.first_open && 573 !(*tty->handler.first_open)(tty, args)) {603 if (tty->handler.first_open && !(*tty->handler.first_open)( 604 tty, tty->device_context, &tty->termios, args)) { 574 605 rtems_termios_destroy_tty(tty, args, false); 575 606 return NULL; … … 684 715 flushOutput (struct rtems_termios_tty *tty) 685 716 { 717 rtems_termios_device_context *ctx = tty->device_context; 686 718 rtems_interrupt_lock_context lock_context; 687 719 688 rtems_termios_ interrupt_lock_acquire (tty, &lock_context);720 rtems_termios_device_lock_acquire (ctx, &lock_context); 689 721 tty->rawOutBuf.Tail = 0; 690 722 tty->rawOutBuf.Head = 0; 691 723 tty->rawOutBufState = rob_idle; 692 rtems_termios_ interrupt_lock_release (tty, &lock_context);724 rtems_termios_device_lock_release (ctx, &lock_context); 693 725 } 694 726 … … 696 728 flushInput (struct rtems_termios_tty *tty) 697 729 { 730 rtems_termios_device_context *ctx = tty->device_context; 698 731 rtems_interrupt_lock_context lock_context; 699 732 700 rtems_termios_ interrupt_lock_acquire (tty, &lock_context);733 rtems_termios_device_lock_acquire (ctx, &lock_context); 701 734 tty->rawInBuf.Tail = 0; 702 735 tty->rawInBuf.Head = 0; 703 rtems_termios_ interrupt_lock_release (tty, &lock_context);736 rtems_termios_device_lock_release (ctx, &lock_context); 704 737 } 705 738 … … 785 818 termios_set_flowctrl(struct rtems_termios_tty *tty) 786 819 { 820 rtems_termios_device_context *ctx = tty->device_context; 787 821 rtems_interrupt_lock_context lock_context; 788 822 /* … … 799 833 if (tty->flow_ctrl & FL_OSTOP) { 800 834 /* disable interrupts */ 801 rtems_termios_ interrupt_lock_acquire (tty, &lock_context);835 rtems_termios_device_lock_acquire (ctx, &lock_context); 802 836 tty->flow_ctrl &= ~FL_OSTOP; 803 837 /* check for chars in output buffer (or rob_state?) */ … … 805 839 /* if chars available, call write function... */ 806 840 (*tty->handler.write)( 807 tty, &tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail],1);841 ctx, &tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail],1); 808 842 } 809 843 /* reenable interrupts */ 810 rtems_termios_ interrupt_lock_release (tty, &lock_context);844 rtems_termios_device_lock_release (ctx, &lock_context); 811 845 } 812 846 } … … 827 861 if ((tty->flow_ctrl & FL_IRTSOFF) && 828 862 (tty->flow.start_remote_tx != NULL)) { 829 tty->flow.start_remote_tx( tty);863 tty->flow.start_remote_tx(ctx); 830 864 } 831 865 tty->flow_ctrl &= ~(FL_IRTSOFF); … … 907 941 } 908 942 if (tty->handler.set_attributes) { 909 sc = (*tty->handler.set_attributes)(tty , &tty->termios) ?943 sc = (*tty->handler.set_attributes)(tty->device_context, &tty->termios) ? 910 944 RTEMS_SUCCESSFUL : RTEMS_IO_ERROR; 911 945 } … … 1004 1038 /* stop transmitter */ 1005 1039 if (transmitting) { 1006 (*tty->handler.write) (tty , NULL, 0);1040 (*tty->handler.write) (tty->device_context, NULL, 0); 1007 1041 } 1008 1042 } else { … … 1018 1052 1019 1053 (*tty->handler.write)( 1020 tty , &tty->rawOutBuf.theBuf[newTail], nToSend);1054 tty->device_context, &tty->rawOutBuf.theBuf[newTail], nToSend); 1021 1055 } 1022 1056 … … 1033 1067 const char *buf = _buf; 1034 1068 unsigned int newHead; 1069 rtems_termios_device_context *ctx = tty->device_context; 1035 1070 rtems_interrupt_lock_context lock_context; 1036 1071 rtems_status_code sc; 1037 1072 1038 1073 if (tty->handler.mode == TERMIOS_POLLED) { 1039 (*tty->handler.write)( tty, buf, len);1074 (*tty->handler.write)(ctx, buf, len); 1040 1075 return; 1041 1076 } … … 1050 1085 newHead -= tty->rawOutBuf.Size; 1051 1086 1052 rtems_termios_ interrupt_lock_acquire (tty, &lock_context);1087 rtems_termios_device_lock_acquire (ctx, &lock_context); 1053 1088 while (newHead == tty->rawOutBuf.Tail) { 1054 1089 tty->rawOutBufState = rob_wait; 1055 rtems_termios_ interrupt_lock_release (tty, &lock_context);1090 rtems_termios_device_lock_release (ctx, &lock_context); 1056 1091 sc = rtems_semaphore_obtain( 1057 1092 tty->rawOutBuf.Semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT); 1058 1093 if (sc != RTEMS_SUCCESSFUL) 1059 1094 rtems_fatal_error_occurred (sc); 1060 rtems_termios_ interrupt_lock_acquire (tty, &lock_context);1095 rtems_termios_device_lock_acquire (ctx, &lock_context); 1061 1096 } 1062 1097 … … 1091 1126 } 1092 1127 1093 rtems_termios_ interrupt_lock_release (tty, &lock_context);1128 rtems_termios_device_lock_release (ctx, &lock_context); 1094 1129 1095 1130 buf += nToCopy; … … 1372 1407 if (tty->termios.c_lflag & ICANON) { 1373 1408 for (;;) { 1374 n = (*tty->handler.poll_read)(tty );1409 n = (*tty->handler.poll_read)(tty->device_context); 1375 1410 if (n < 0) { 1376 1411 rtems_task_wake_after (1); … … 1385 1420 then = rtems_clock_get_ticks_since_boot(); 1386 1421 for (;;) { 1387 n = (*tty->handler.poll_read)(tty );1422 n = (*tty->handler.poll_read)(tty->device_context); 1388 1423 if (n < 0) { 1389 1424 if (tty->termios.c_cc[VMIN]) { … … 1448 1483 /* XON should be sent now... */ 1449 1484 (*tty->handler.write)( 1450 tty , (void *)&(tty->termios.c_cc[VSTART]), 1);1485 tty->device_context, (void *)&(tty->termios.c_cc[VSTART]), 1); 1451 1486 } else if (tty->flow_ctrl & FL_MDRTS) { 1452 1487 tty->flow_ctrl &= ~FL_IRTSOFF; 1453 1488 /* activate RTS line */ 1454 1489 if (tty->flow.start_remote_tx != NULL) { 1455 tty->flow.start_remote_tx(tty );1490 tty->flow.start_remote_tx(tty->device_context); 1456 1491 } 1457 1492 } … … 1551 1586 int dropped = 0; 1552 1587 bool flow_rcv = false; /* true, if flow control char received */ 1588 rtems_termios_device_context *ctx = tty->device_context; 1553 1589 rtems_interrupt_lock_context lock_context; 1554 1590 … … 1599 1635 if ((tty->flow_ctrl & (FL_ORCVXOF | FL_OSTOP)) == FL_OSTOP) { 1600 1636 /* disable interrupts */ 1601 rtems_termios_ interrupt_lock_acquire (tty, &lock_context);1637 rtems_termios_device_lock_acquire (ctx, &lock_context); 1602 1638 tty->flow_ctrl &= ~FL_OSTOP; 1603 1639 /* check for chars in output buffer (or rob_state?) */ … … 1605 1641 /* if chars available, call write function... */ 1606 1642 (*tty->handler.write)( 1607 tty, &tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail], 1);1643 ctx, &tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail], 1); 1608 1644 } 1609 1645 /* reenable interrupts */ 1610 rtems_termios_ interrupt_lock_release (tty, &lock_context);1646 rtems_termios_device_lock_release (ctx, &lock_context); 1611 1647 } 1612 1648 } else { 1613 1649 newTail = (tty->rawInBuf.Tail + 1) % tty->rawInBuf.Size; 1614 1650 /* if chars_in_buffer > highwater */ 1615 rtems_termios_ interrupt_lock_acquire (tty, &lock_context);1651 rtems_termios_device_lock_acquire (ctx, &lock_context); 1616 1652 if ((((newTail - tty->rawInBuf.Head + tty->rawInBuf.Size) 1617 1653 % tty->rawInBuf.Size) > tty->highwater) && … … 1626 1662 /* call write function here */ 1627 1663 tty->flow_ctrl |= FL_ISNTXOF; 1628 (*tty->handler.write)( tty,1664 (*tty->handler.write)(ctx, 1629 1665 (void *)&(tty->termios.c_cc[VSTOP]), 1); 1630 1666 } … … 1633 1669 /* deactivate RTS line */ 1634 1670 if (tty->flow.stop_remote_tx != NULL) { 1635 tty->flow.stop_remote_tx( tty);1671 tty->flow.stop_remote_tx(ctx); 1636 1672 } 1637 1673 } … … 1639 1675 1640 1676 /* reenable interrupts */ 1641 rtems_termios_ interrupt_lock_release (tty, &lock_context);1677 rtems_termios_device_lock_release (ctx, &lock_context); 1642 1678 1643 1679 if (newTail == tty->rawInBuf.Head) { … … 1673 1709 unsigned int newTail; 1674 1710 int nToSend; 1711 rtems_termios_device_context *ctx = tty->device_context; 1675 1712 rtems_interrupt_lock_context lock_context; 1676 1713 int len; 1677 1714 1678 rtems_termios_ interrupt_lock_acquire (tty, &lock_context);1715 rtems_termios_device_lock_acquire (ctx, &lock_context); 1679 1716 1680 1717 /* check for XOF/XON to send */ … … 1682 1719 == (FL_MDXOF | FL_IREQXOF)) { 1683 1720 /* XOFF should be sent now... */ 1684 (*tty->handler.write)( tty, (void *)&(tty->termios.c_cc[VSTOP]), 1);1721 (*tty->handler.write)(ctx, (void *)&(tty->termios.c_cc[VSTOP]), 1); 1685 1722 1686 1723 tty->t_dqlen--; … … 1698 1735 * Therefore the dequeue "length" should be reduced by 1 1699 1736 */ 1700 (*tty->handler.write)( tty, (void *)&(tty->termios.c_cc[VSTART]), 1);1737 (*tty->handler.write)(ctx, (void *)&(tty->termios.c_cc[VSTART]), 1); 1701 1738 1702 1739 tty->t_dqlen--; … … 1715 1752 } 1716 1753 1717 (*tty->handler.write) ( tty, NULL, 0);1754 (*tty->handler.write) (ctx, NULL, 0); 1718 1755 nToSend = 0; 1719 1756 } else { … … 1735 1772 */ 1736 1773 tty->rawOutBufState = rob_idle; 1737 (*tty->handler.write) ( tty, NULL, 0);1774 (*tty->handler.write) (ctx, NULL, 0); 1738 1775 nToSend = 0; 1739 1776 … … 1752 1789 } 1753 1790 1754 rtems_termios_ interrupt_lock_release (tty, &lock_context);1791 rtems_termios_device_lock_release (ctx, &lock_context); 1755 1792 1756 1793 if (wakeUpWriterTask) { … … 1855 1892 { 1856 1893 struct rtems_termios_tty *tty = (struct rtems_termios_tty *)argument; 1894 rtems_termios_device_context *ctx = tty->device_context; 1857 1895 rtems_event_set the_event; 1858 1896 int c; … … 1877 1915 * do something 1878 1916 */ 1879 c = tty->handler.poll_read( tty);1917 c = tty->handler.poll_read(ctx); 1880 1918 if (c != EOF) { 1881 1919 /* -
cpukit/libcsupport/src/termios_setbestbaud.c
ra830cb8 r7fd5e89 20 20 21 21 void rtems_termios_set_best_baud( 22 rtems_termios_tty *tty,23 uint32_t 22 struct termios *term, 23 uint32_t baud 24 24 ) 25 25 { … … 42 42 } 43 43 44 t ty->termios.c_cflag = (tty->termios.c_cflag & ~cbaud_mask) | cbaud;44 term->c_cflag = (term->c_cflag & ~cbaud_mask) | cbaud; 45 45 } -
cpukit/libnetworking/net/if_ppp.c
ra830cb8 r7fd5e89 388 388 /* write out frame byte to start the transmission */ 389 389 sc->sc_outchar = (u_char)PPP_FLAG; 390 (*tp->handler.write)(tp , (char *)&sc->sc_outchar, 1);390 (*tp->handler.write)(tp->device_context, (char *)&sc->sc_outchar, 1); 391 391 } 392 392 -
cpukit/libnetworking/net/ppp_tty.c
ra830cb8 r7fd5e89 569 569 struct mbuf *m = (struct mbuf *)0; 570 570 struct ppp_softc *sc = tp->t_sc; 571 rtems_termios_device_context *ctx = rtems_termios_get_device_context(tp); 571 572 572 573 /* ensure input is valid and we are busy */ … … 607 608 sc->sc_outflag &=~(SC_TX_FCS); 608 609 sc->sc_outchar = (u_char)PPP_FLAG; 609 (*tp->handler.write)( tp, (char *)&sc->sc_outchar, 1);610 (*tp->handler.write)(ctx, (char *)&sc->sc_outchar, 1); 610 611 return(0); 611 612 } … … 644 645 645 646 /* write out the character(s) and update the stats */ 646 (*tp->handler.write)( tp, (char *)sendBegin, (ioffset > 0) ? ioffset : 1);647 (*tp->handler.write)(ctx, (char *)sendBegin, (ioffset > 0) ? ioffset : 1); 647 648 sc->sc_stats.ppp_obytes += (ioffset > 0) ? ioffset : 1; 648 649 sc->sc_outoff += ioffset; -
doc/bsp_howto/console.t
ra830cb8 r7fd5e89 275 275 /* Low-level driver specific data structure */ 276 276 typedef struct @{ 277 rtems_termios_device_context base; 277 278 const char *device_name; 278 279 volatile module_register_block *regs; … … 299 300 @group 300 301 static void my_driver_poll_write( 301 rtems_termios_ tty *tty,302 const char *buf,303 size_t n302 rtems_termios_device_context *base, 303 const char *buf, 304 size_t n 304 305 ) 305 306 @{ 306 my_driver_context *ctx = rtems_termios_get_device_context(tty);307 my_driver_context *ctx = (my_driver_context *) base; 307 308 size_t i; 308 309 … … 321 322 @example 322 323 @group 323 static int my_driver_poll_read(rtems_termios_ tty *tty)324 @{ 325 my_driver_context *ctx = rtems_termios_get_device_context(tty);324 static int my_driver_poll_read(rtems_termios_device_context *base) 325 @{ 326 my_driver_context *ctx = (my_driver_context *) base; 326 327 327 328 /* Check if a character is available */ … … 410 411 @group 411 412 static void my_driver_interrupt_write( 412 rtems_termios_ tty *tty,413 const char *buf,414 size_t n413 rtems_termios_device_context *base, 414 const char *buf, 415 size_t n 415 416 ) 416 417 @{ 417 my_driver_context *ctx = rtems_termios_get_device_context(tty);418 my_driver_context *ctx = (my_driver_context *) base; 418 419 419 420 /* … … 519 520 static bool my_driver_first_open( 520 521 rtems_termios_tty *tty, 522 rtems_termios_device_context *base, 523 struct termios *term, 521 524 rtems_libio_open_close_args_t *args 522 525 ) 523 526 @{ 524 my_driver_context *ctx = rtems_termios_get_device_context(tty);527 my_driver_context *ctx = (my_driver_context *) base; 525 528 rtems_status_code sc; 526 529 bool ok; … … 543 546 * Alternatively you can set the best baud. 544 547 */ 545 rtems_termios_set_best_baud(t ty, MY_DRIVER_BAUD_RATE);548 rtems_termios_set_best_baud(term, MY_DRIVER_BAUD_RATE); 546 549 547 550 /* … … 549 552 * this. 550 553 */ 551 ok = my_driver_set_attributes( tty, rtems_termios_get_termios(tty));554 ok = my_driver_set_attributes(base, term); 552 555 if (!ok) @{ 553 556 /* This is bad */ … … 575 578 static void my_driver_last_close( 576 579 rtems_termios_tty *tty, 580 rtems_termios_device_context *base, 577 581 rtems_libio_open_close_args_t *args 578 582 ) 579 583 @{ 580 my_driver_context *ctx = rtems_termios_get_device_context(tty);584 my_driver_context *ctx = (my_driver_context *) base; 581 585 582 586 /* … … 619 623 @group 620 624 static bool my_driver_set_attributes( 621 rtems_termios_ tty *tty,622 const struct termios *term625 rtems_termios_device_context *base, 626 const struct termios *term 623 627 ) 624 628 @{ 625 my_driver_context *ctx = rtems_termios_get_device_context(tty);629 my_driver_context *ctx = (my_driver_context *) base; 626 630 627 631 /* -
testsuites/libtests/termios01/init.c
ra830cb8 r7fd5e89 518 518 } 519 519 520 typedef struct { 521 rtems_termios_device_context base; 522 bool done; 523 } device_context; 524 520 525 static rtems_status_code test_early_device_install_remove( 521 526 rtems_device_major_number major, … … 529 534 rtems_resource_snapshot_take( &snapshot ); 530 535 531 sc = rtems_termios_device_install( "/", 0, 0, NULL, NULL );536 sc = rtems_termios_device_install( "/", 0, 0, NULL, NULL, NULL ); 532 537 rtems_test_assert( sc == RTEMS_INCORRECT_STATE ); 533 538 … … 631 636 static bool first_open_error( 632 637 rtems_termios_tty *tty, 638 rtems_termios_device_context *base, 639 struct termios *term, 633 640 rtems_libio_open_close_args_t *args 634 641 ) 635 642 { 636 bool *done = rtems_termios_get_device_context( tty ); 637 643 device_context *ctx = (device_context *) base; 644 645 (void) tty; 646 (void) term; 638 647 (void) args; 639 648 640 *done = true;649 ctx->done = true; 641 650 642 651 return false; … … 656 665 rtems_libio_t iop; 657 666 rtems_libio_open_close_args_t args; 658 bool done = false; 667 device_context ctx = { 668 .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "abc" ), 669 .done = false 670 }; 659 671 660 672 rtems_resource_snapshot_take( &snapshot ); … … 666 678 &handler, 667 679 NULL, 668 & done680 &ctx.base 669 681 ); 670 682 rtems_test_assert( sc == RTEMS_SUCCESSFUL ); … … 674 686 args.iop = &iop; 675 687 676 rtems_test_assert( ! done );688 rtems_test_assert( !ctx.done ); 677 689 sc = rtems_termios_device_open( major, minor, &args ); 678 690 rtems_test_assert( sc == RTEMS_NO_MEMORY ); 679 rtems_test_assert( done );691 rtems_test_assert( ctx.done ); 680 692 681 693 sc = rtems_termios_device_remove( &dev[0], major, minor ); … … 686 698 687 699 static bool set_attributes_error( 688 rtems_termios_ tty *tty,700 rtems_termios_device_context *base, 689 701 const struct termios *term 690 702 ) 691 703 { 692 bool *done = rtems_termios_get_device_context( tty );704 device_context *ctx = (device_context *) base; 693 705 694 706 (void) term; 695 707 696 *done = true;708 ctx->done = true; 697 709 698 710 return false; … … 714 726 rtems_libio_ioctl_args_t io_args; 715 727 struct termios term; 716 bool done = false; 728 device_context ctx = { 729 .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "abc" ), 730 .done = false 731 }; 717 732 718 733 rtems_resource_snapshot_take( &snapshot ); … … 724 739 &handler, 725 740 NULL, 726 & done741 &ctx.base 727 742 ); 728 743 rtems_test_assert( sc == RTEMS_SUCCESSFUL ); … … 740 755 io_args.buffer = &term; 741 756 742 rtems_test_assert( ! done );757 rtems_test_assert( !ctx.done ); 743 758 sc = rtems_termios_ioctl( &io_args ); 744 759 rtems_test_assert( sc == RTEMS_IO_ERROR ); 745 rtems_test_assert( done );760 rtems_test_assert( ctx.done ); 746 761 747 762 sc = rtems_termios_device_close( &oc_args ); … … 791 806 792 807 for ( i = 0; i < n; ++i ) { 793 rtems_termios_tty tty; 794 struct termios *term = rtems_termios_get_termios( &tty ); 808 struct termios term; 795 809 tcflag_t cbaud_mask = CBAUD; 796 810 797 memset( &t ty, 0xff, sizeof( tty) );798 rtems_termios_set_best_baud( &t ty, baud_to_cflag_table[ i ].baud );811 memset( &term, 0xff, sizeof( term ) ); 812 rtems_termios_set_best_baud( &term, baud_to_cflag_table[ i ].baud ); 799 813 800 814 rtems_test_assert( 801 (term ->c_cflag & cbaud_mask) == baud_to_cflag_table[ i ].cflag815 (term.c_cflag & cbaud_mask) == baud_to_cflag_table[ i ].cflag 802 816 ); 803 817 }
Note: See TracChangeset
for help on using the changeset viewer.