⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rt_comp.h

📁 A real-time serial port device driver, works with RT-Linux and RTAI.
💻 H
字号:
/** * rt_com * ====== * * RT-Linux kernel module for communication across serial lines. * * Copyright (C) 1997 Jens Michaelsen * Copyright (C) 1997-2000 Jochen K黳per * Copyright (C) 1999 Hua Mao <hmao@nmt.edu> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file License. if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307, USA. */#ifndef RT_COM_P_H#define RT_COM_P_H/* private functions */#if defined RTLINUX_V1 || defined RTAIstatic void rt_com0_isr( void );static void rt_com1_isr( void );static inline void rt_com_isr( unsigned int );#elsestatic unsigned int rt_com0_isr( unsigned int, struct pt_regs * );static unsigned int rt_com1_isr( unsigned int, struct pt_regs * );static inline unsigned int rt_com_isr( unsigned int, struct pt_regs * );#endif#if defined RTLINUX_V1 || defined RTAI#elif defined RTLINUX_V2 && defined __SMP__spinlock_t rt_com_spinlock;#  define RTL_SPIN_LOCK rt_com_spinlock#endif/* internal convinience macros for interrupt handling */#ifdef RTLINUX_V1#  define rt_com_irq_off( state )         rtl_no_interrupts( state )#  define rt_com_irq_on( state )          rtl_restore_interrupts( state )#  define rt_com_request_irq( irq, isr )  request_RTirq( irq, isr )#  define rt_com_free_irq( irq )          free_RTirq( irq )#elif defined RTAI#  define rt_com_printk                   rt_printk#  define rt_com_irq_off( state )         rt_global_save_flags( &state ); rt_global_cli()#  define rt_com_irq_on(state)            rt_global_restore_flags( state )#  define rt_com_request_irq( irq, isr )  rt_request_global_irq( irq, isr ); rt_enable_irq( irq );#  define rt_com_free_irq( irq )          rt_free_global_irq( irq )#elif defined RTLINUX_V2 #  define rt_com_irq_off( state )         rtl_critical( state )#  define rt_com_irq_on(state)            rtl_end_critical( state )#  define rt_com_request_irq( irq, isr )  rtl_request_global_irq( irq, isr ); rtl_hard_enable_irq( irq )#  define rt_com_free_irq( irq )          rtl_free_global_irq( irq )#endif/* number of bytes in port FIFO when a DATA_READY interrupt shall occur */#define RT_COM_FIFO_TRIGGER 8/* status masks */#define RT_COM_DATA_READY   0x01     /* not an error *//* port register offsets */#define RT_COM_RXB  0x00#define RT_COM_TXB  0x00#define RT_COM_IER  0x01#define RT_COM_IIR  0x02#define RT_COM_FCR  0x02#define RT_COM_LCR  0x03#define RT_COM_MCR  0x04#define RT_COM_LSR  0x05#define RT_COM_MSR  0x06#define RT_COM_DLL  0x00#define RT_COM_DLM  0x01/* data buffer - organized as a FIFO */struct rt_buf_struct{    int  head;    int  tail;    char buf[ RT_COM_BUF_SIZ ];};/* information about handled ports */struct rt_com_struct{    int magic;    int baud_base;    int port;    int irq;    int flag;#if defined RTLINUX_V1 || defined RTAI    void (*isr)(void);#else    unsigned int (*isr)( unsigned int, struct pt_regs * );#endif    int mode; /* functioning mode	       * bit 0: 0 for standard functioning mode (DSR needed on TX)	       *        1 for comunication without hand shake signals (only RXD-TXD-GND)	       * bit 1: 1 for hardware flow control (RTS-CTS)	       * NOTE: When you select a mode that use hand shake signals pay	       * attention that no input signals (CTS,DSR,RI,DCD) must be floating.*/    int used; /* 1 if port region must be requested by init_module (standard)	       * 0 if port region must be requested later by rt_com_set_param */    int error; /* last error detected */    int type;    int ier;  /* copy of chip register */    int mcr;  /* copy of the MCR internal register */    IRQ_CALLBACK_FN callback;	/* called when chars rx'd */    struct rt_buf_struct ibuf;    struct rt_buf_struct obuf;};/* Some hardware description */#define RT_COM_BASE_BAUD 115200#define RT_COM_STD_COM_FLAG 0#endif /* RT_COM_P_H *//** * Local Variables: * mode: C * c-file-style: "Stroustrup" * End: */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -