Changeset 0c3d6f58 in rtems
- Timestamp:
- 05/23/23 08:44:04 (4 months ago)
- Branches:
- master
- Children:
- a83dc4a4
- Parents:
- 63415655
- git-author:
- Sebastian Huber <sebastian.huber@…> (05/23/23 08:44:04)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (05/31/23 08:07:17)
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
bsps/arm/xilinx-zynq/console/console-init.c
r63415655 r0c3d6f58 27 27 28 28 #include <rtems/console.h> 29 #include <rtems/termiostypes.h> 29 30 30 31 #include <bsp.h> -
bsps/include/dev/serial/zynq-uart.h
r63415655 r0c3d6f58 35 35 #define LIBBSP_ARM_XILINX_ZYNQ_UART_H 36 36 37 #include <rtems/termios types.h>37 #include <rtems/termiosdevice.h> 38 38 39 39 #ifdef __cplusplus -
bsps/shared/dev/serial/zynq-uart.c
r63415655 r0c3d6f58 29 29 #include <dev/serial/zynq-uart-regs.h> 30 30 #include <bsp/irq.h> 31 #include <rtems/termiostypes.h> 31 32 32 33 #include <bspopts.h> -
cpukit/include/rtems/libio.h
r63415655 r0c3d6f58 1361 1361 * @brief Parameter block for open/close. 1362 1362 */ 1363 typedef struct {1363 typedef struct rtems_libio_open_close_args { 1364 1364 rtems_libio_t *iop; 1365 1365 uint32_t flags; -
cpukit/include/rtems/termiostypes.h
r63415655 r0c3d6f58 40 40 #include <rtems/assoc.h> 41 41 #include <rtems/chain.h> 42 #include <rtems/thread.h> 43 #include <sys/ioccom.h> 42 #include <rtems/termiosdevice.h> 44 43 #include <stdint.h> 45 44 #include <termios.h> … … 50 49 51 50 /** 52 * @defgroup TermiostypesSupport RTEMS Termios Device Support 53 * 54 * @ingroup libcsupport 55 * 56 * @brief RTEMS Termios Device Support Internal Data Structures 51 * @addtogroup TermiostypesSupport 52 * 53 * @{ 57 54 */ 58 55 … … 75 72 rtems_binary_semaphore Semaphore; 76 73 }; 77 78 typedef enum {79 TERMIOS_POLLED,80 TERMIOS_IRQ_DRIVEN,81 TERMIOS_TASK_DRIVEN,82 TERMIOS_IRQ_SERVER_DRIVEN83 } rtems_termios_device_mode;84 85 struct rtems_termios_tty;86 87 /**88 * @brief Termios device context.89 *90 * @see RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER(),91 * rtems_termios_device_context_initialize() and92 * rtems_termios_device_install().93 */94 typedef struct rtems_termios_device_context {95 union {96 /* Used for TERMIOS_POLLED and TERMIOS_IRQ_DRIVEN */97 rtems_interrupt_lock interrupt;98 99 /* Used for TERMIOS_IRQ_SERVER_DRIVEN or TERMIOS_TASK_DRIVEN */100 rtems_mutex mutex;101 } lock;102 103 void ( *lock_acquire )(104 struct rtems_termios_device_context *,105 rtems_interrupt_lock_context *106 );107 108 void ( *lock_release )(109 struct rtems_termios_device_context *,110 rtems_interrupt_lock_context *111 );112 } rtems_termios_device_context;113 114 void rtems_termios_device_lock_acquire_default(115 rtems_termios_device_context *ctx,116 rtems_interrupt_lock_context *lock_context117 );118 119 void rtems_termios_device_lock_release_default(120 rtems_termios_device_context *ctx,121 rtems_interrupt_lock_context *lock_context122 );123 124 /**125 * @brief Initializes a device context.126 *127 * @param[in] context The Termios device context.128 * @param[in] name The name for the interrupt lock. This name must be a129 * string persistent throughout the life time of this lock. The name is only130 * used if profiling is enabled.131 */132 static inline void rtems_termios_device_context_initialize(133 rtems_termios_device_context *context,134 const char *name135 )136 {137 rtems_interrupt_lock_initialize( &context->lock.interrupt, name );138 context->lock_acquire = rtems_termios_device_lock_acquire_default;139 context->lock_release = rtems_termios_device_lock_release_default;140 }141 142 /**143 * @brief Initializer for static initialization of Termios device contexts.144 *145 * @param name The name for the interrupt lock. It must be a string. The name146 * is only used if profiling is enabled.147 */148 #define RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( name ) \149 { \150 { RTEMS_INTERRUPT_LOCK_INITIALIZER( name ) }, \151 rtems_termios_device_lock_acquire_default, \152 rtems_termios_device_lock_release_default \153 }154 155 /**156 * @brief Termios device handler.157 *158 * @see rtems_termios_device_install().159 */160 typedef struct {161 /**162 * @brief First open of this device.163 *164 * @param[in] tty The Termios control. This parameter may be passed to165 * interrupt service routines since it must be provided for the166 * rtems_termios_enqueue_raw_characters() and167 * rtems_termios_dequeue_characters() functions.168 * @param[in] context The Termios device context.169 * @param[in] term The current Termios attributes.170 * @param[in] args The open/close arguments. This is parameter provided to171 * support legacy drivers. It must not be used by new drivers.172 *173 * @retval true Successful operation.174 * @retval false Cannot open device.175 *176 * @see rtems_termios_get_device_context() and rtems_termios_set_best_baud().177 */178 bool (*first_open)(179 struct rtems_termios_tty *tty,180 rtems_termios_device_context *context,181 struct termios *term,182 rtems_libio_open_close_args_t *args183 );184 185 /**186 * @brief Last close of this device.187 *188 * @param[in] tty The Termios control.189 * @param[in] context The Termios device context.190 * @param[in] args The open/close arguments. This is parameter provided to191 * support legacy drivers. It must not be used by new drivers.192 */193 void (*last_close)(194 struct rtems_termios_tty *tty,195 rtems_termios_device_context *context,196 rtems_libio_open_close_args_t *args197 );198 199 /**200 * @brief Polled read.201 *202 * In case mode is TERMIOS_IRQ_DRIVEN, TERMIOS_IRQ_SERVER_DRIVEN or203 * TERMIOS_TASK_DRIVEN, then data is received via204 * rtems_termios_enqueue_raw_characters().205 *206 * @param[in] context The Termios device context.207 *208 * @retval char The received data encoded as unsigned char.209 * @retval -1 No data currently available.210 */211 int (*poll_read)(rtems_termios_device_context *context);212 213 /**214 * @brief Polled write in case mode is TERMIOS_POLLED or write support215 * otherwise.216 *217 * @param[in] context The Termios device context.218 * @param[in] buf The output buffer.219 * @param[in] len The output buffer length in characters.220 */221 void (*write)(222 rtems_termios_device_context *context,223 const char *buf,224 size_t len225 );226 227 /**228 * @brief Set attributes after a Termios settings change.229 *230 * @param[in] context The Termios device context.231 * @param[in] term The new Termios attributes.232 *233 * @retval true Successful operation.234 * @retval false Invalid attributes.235 */236 bool (*set_attributes)(237 rtems_termios_device_context *context,238 const struct termios *term239 );240 241 /**242 * @brief IO control handler.243 *244 * Invoked in case the Termios layer cannot deal with the IO request.245 *246 * @param[in] context The Termios device context.247 * @param[in] request The IO control request.248 * @param[in] buffer The IO control buffer.249 */250 int (*ioctl)(251 rtems_termios_device_context *context,252 ioctl_command_t request,253 void *buffer254 );255 256 /**257 * @brief Termios device mode.258 */259 rtems_termios_device_mode mode;260 } rtems_termios_device_handler;261 262 /**263 * @brief Termios device flow control handler.264 *265 * @see rtems_termios_device_install().266 */267 typedef struct {268 /**269 * @brief Indicate to stop remote transmitter.270 *271 * @param[in] context The Termios device context.272 */273 void (*stop_remote_tx)(rtems_termios_device_context *context);274 275 /**276 * @brief Indicate to start remote transmitter.277 *278 * @param[in] context The Termios device context.279 */280 void (*start_remote_tx)(rtems_termios_device_context *context);281 } rtems_termios_device_flow;282 74 283 75 /** … … 454 246 { 455 247 return tty->device_context; 456 }457 458 /**459 * @brief Acquires the device lock.460 *461 * @param[in] context The device context.462 * @param[in] lock_context The local interrupt lock context for an acquire and463 * release pair.464 */465 static inline void rtems_termios_device_lock_acquire(466 rtems_termios_device_context *context,467 rtems_interrupt_lock_context *lock_context468 )469 {470 ( *context->lock_acquire )( context, lock_context );471 }472 473 /**474 * @brief Releases the device lock.475 *476 * @param[in] context The device context.477 * @param[in] lock_context The local interrupt lock context for an acquire and478 * release pair.479 */480 static inline void rtems_termios_device_lock_release(481 rtems_termios_device_context *context,482 rtems_interrupt_lock_context *lock_context483 )484 {485 ( *context->lock_release )( context, lock_context );486 248 } 487 249 -
cpukit/libcsupport/src/termiosinitialize.c
r63415655 r0c3d6f58 1 1 /** 2 * 2 * @file 3 3 * 4 * @brief Termios Initialization 5 * @ingroup Termios 4 * @ingroup TermiostypesSupport 5 * 6 * @brief This source file contains the implementation of 7 * rtems_termios_device_lock_acquire_default() and 8 * rtems_termios_device_lock_release_default(). 6 9 */ 7 10 … … 18 21 #endif 19 22 20 #include <rtems/termios types.h>23 #include <rtems/termiosdevice.h> 21 24 22 25 void
Note: See TracChangeset
for help on using the changeset viewer.