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_RT_H 00022 #define MOST_SYNC_RT_H 00023 00031 #ifdef HAVE_CONFIG_H 00032 #include "config/config.h" 00033 #endif 00034 #include <linux/cdev.h> 00035 #include <asm/semaphore.h> 00036 #include <asm/ioctl.h> 00037 #include <linux/rwsem.h> 00038 #include "most-rxbuf.h" 00039 #include "most-txbuf.h" 00040 00041 #include "rtmostsync.h" 00042 #include "most-base.h" 00043 #include "most-common.h" 00044 00060 struct most_conf_sync { 00061 bool reconfigure_flag; 00065 int counter; 00068 rtdm_event_t wait_read_write; 00072 wait_queue_head_t wait_reconfigure; 00077 }; 00078 00084 static inline void most_conf_sync_init(struct most_conf_sync *sync) 00085 { 00086 rtdm_event_init(&sync->wait_read_write, 0); 00087 init_waitqueue_head(&sync->wait_reconfigure); 00088 } 00089 00095 static inline void most_conf_sync_destroy(struct most_conf_sync *sync) 00096 { 00097 rtdm_event_destroy(&sync->wait_read_write); 00098 } 00099 00106 struct most_sync_rt_dev { 00107 struct most_dev *most_dev; 00108 struct dma_buffer hw_receive_buf; 00109 struct dma_buffer hw_transmit_buf; 00110 struct rx_buffer *sw_receive_buf; 00111 struct tx_buffer *sw_transmit_buf; 00112 struct list_head file_list; 00113 atomic_t open_count; 00114 atomic_t receiver_count; 00115 atomic_t transmitter_count; 00116 rtdm_lock_t lock; 00117 struct rtdm_device rtdm_dev; 00123 rtdm_event_t rx_wait; 00126 rtdm_event_t tx_wait; 00129 struct most_conf_sync rx_sync; 00130 struct most_conf_sync tx_sync; 00131 unsigned char rx_current_page; 00133 unsigned char tx_current_page; 00135 }; 00136 00142 struct most_sync_rt_file { 00143 struct list_head list; 00145 struct most_sync_rt_dev *sync_dev; 00147 struct frame_part part_rx; 00148 struct frame_part part_tx; 00149 bool rx_running; 00150 bool tx_running; 00151 int reader_index; 00153 int writer_index; 00155 }; 00156 00157 #endif /* MOST_SYNC_RT_H */ 00158 00159 /* vim: set ts=4 et sw=4: */