/home/hillier_g/checkout/most4linux/most-kernel/most-sync.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright(c) Siemens AG, Muenchen, Germany, 2005, 2006, 2007
00003  *                           Bernhard Walle <bernhard.walle@gmx.de>
00004  *                           Gernot Hillier <gernot.hillier@siemens.com>
00005  *
00006  * ----------------------------------------------------------------------------
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License version 2 as 
00009  * published by the Free Software Foundation;
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  * ----------------------------------------------------------------------------
00020  */
00021 #ifndef MOST_SYNC_H
00022 #define MOST_SYNC_H
00023 
00034 #ifdef __KERNEL__
00035 #   include <linux/cdev.h>
00036 #   include <asm/semaphore.h>
00037 #   include <asm/ioctl.h>
00038 #   include <linux/rwsem.h>
00039 #   include "most-rxbuf.h"
00040 #   include "most-txbuf.h"
00041 #endif
00042 
00043 #include "most-common.h"
00044 
00045 /*
00046  * types and constants for userspace and kernelspace ----------------------- 
00047  */
00048 
00053 #define MOST_SYNC_IOCTL_MAGIC                           'h'
00054 
00075 #define MOST_SYNC_SETUP_RX  \
00076     _IOW(MOST_SYNC_IOCTL_MAGIC, 0, struct frame_part)
00077 
00098 #define MOST_SYNC_SETUP_TX \
00099     _IOW(MOST_SYNC_IOCTL_MAGIC, 1, struct frame_part)
00100 
00104 #define MOST_SYNC_MAXIOCTL                  1
00105 
00106 
00107 #ifdef __KERNEL__
00108 
00109 /*
00110  * constants --------------------------------------------------------------- 
00111  */
00112 
00116 #define MOST_SYNC_MINOR_OFFSET              8
00117 
00118 
00119 /*
00120  * type definitions -------------------------------------------------------- 
00121  */
00122 
00128 struct most_sync_dev {
00129     struct cdev             cdev;                
00131     struct most_dev         *most_dev;           
00133     struct dma_buffer       hw_receive_buf;      
00134     struct dma_buffer       hw_transmit_buf;     
00135     struct rx_buffer        *sw_receive_buf;     
00136     struct tx_buffer        *sw_transmit_buf;    
00137     struct list_head        file_list;           
00139     atomic_t                open_count;          
00140     atomic_t                receiver_count;      
00141     atomic_t                transmitter_count;   
00142     wait_queue_head_t       rx_queue;            
00145     wait_queue_head_t       tx_queue;            
00148     struct rw_semaphore     config_lock_rx;      
00151     struct rw_semaphore     config_lock_tx;      
00154     unsigned char           rx_current_page;     
00157     unsigned char           tx_current_page;     
00160 };
00161 
00165 struct most_sync_file {
00166     struct list_head       list;                
00168     struct most_sync_dev   *sync_dev;           
00170     struct frame_part      part_rx;             
00171     struct frame_part      part_tx;             
00172     bool                   rx_running;          
00173     bool                   tx_running;          
00174     int                    reader_index;        
00177     int                    writer_index;        
00180 };
00181 
00182 
00193 ssize_t most_sync_read(struct file                  *filp, 
00194                        void                         *buff,
00195                        size_t                       count,
00196                        struct rtnrt_memcopy_desc    *copy);
00197 
00208 ssize_t most_sync_write(struct file                 *filp, 
00209                         void                        *buff,
00210                         size_t                      count,
00211                         struct rtnrt_memcopy_desc   *copy);
00212 
00221 int most_sync_setup_rx(struct file *filp, struct frame_part *frame_part);
00222 
00230 int most_sync_setup_tx(struct file *filp, struct frame_part *frame_part);
00231 
00232 #endif /* __KERNEL__ */
00233 
00234 #endif /* MOST_SYNC_H */
00235 
00236 
00237 /* vim: set ts=4 et sw=4: */
00238 

Generated on Fri Mar 9 14:48:58 2007 for MOST Linux Drivers (Linux and RTAI) by  doxygen 1.5.0