Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * Copyright (C) 2004, 2005 MIPS Technologies, Inc.  All rights reserved.
0007  * Copyright (C) 2013 Imagination Technologies Ltd.
0008  */
0009 #ifndef __ASM_RTLX_H_
0010 #define __ASM_RTLX_H_
0011 
0012 #include <irq.h>
0013 
0014 #define RTLX_MODULE_NAME "rtlx"
0015 
0016 #define LX_NODE_BASE 10
0017 
0018 #define MIPS_CPU_RTLX_IRQ 0
0019 
0020 #define RTLX_VERSION 2
0021 #define RTLX_xID 0x12345600
0022 #define RTLX_ID (RTLX_xID | RTLX_VERSION)
0023 #define RTLX_BUFFER_SIZE 2048
0024 #define RTLX_CHANNELS 8
0025 
0026 #define RTLX_CHANNEL_STDIO  0
0027 #define RTLX_CHANNEL_DBG    1
0028 #define RTLX_CHANNEL_SYSIO  2
0029 
0030 void rtlx_starting(int vpe);
0031 void rtlx_stopping(int vpe);
0032 
0033 int rtlx_open(int index, int can_sleep);
0034 int rtlx_release(int index);
0035 ssize_t rtlx_read(int index, void __user *buff, size_t count);
0036 ssize_t rtlx_write(int index, const void __user *buffer, size_t count);
0037 unsigned int rtlx_read_poll(int index, int can_sleep);
0038 unsigned int rtlx_write_poll(int index);
0039 
0040 int __init rtlx_module_init(void);
0041 void __exit rtlx_module_exit(void);
0042 
0043 void _interrupt_sp(void);
0044 
0045 extern struct vpe_notifications rtlx_notify;
0046 extern const struct file_operations rtlx_fops;
0047 extern void (*aprp_hook)(void);
0048 
0049 enum rtlx_state {
0050     RTLX_STATE_UNUSED = 0,
0051     RTLX_STATE_INITIALISED,
0052     RTLX_STATE_REMOTE_READY,
0053     RTLX_STATE_OPENED
0054 };
0055 
0056 extern struct chan_waitqueues {
0057     wait_queue_head_t rt_queue;
0058     wait_queue_head_t lx_queue;
0059     atomic_t in_open;
0060     struct mutex mutex;
0061 } channel_wqs[RTLX_CHANNELS];
0062 
0063 /* each channel supports read and write.
0064    linux (vpe0) reads lx_buffer and writes rt_buffer
0065    SP (vpe1) reads rt_buffer and writes lx_buffer
0066 */
0067 struct rtlx_channel {
0068     enum rtlx_state rt_state;
0069     enum rtlx_state lx_state;
0070 
0071     int buffer_size;
0072 
0073     /* read and write indexes per buffer */
0074     int rt_write, rt_read;
0075     char *rt_buffer;
0076 
0077     int lx_write, lx_read;
0078     char *lx_buffer;
0079 };
0080 
0081 extern struct rtlx_info {
0082     unsigned long id;
0083     enum rtlx_state state;
0084     int ap_int_pending; /* Status of 0 or 1 for CONFIG_MIPS_CMP only */
0085 
0086     struct rtlx_channel channel[RTLX_CHANNELS];
0087 } *rtlx;
0088 #endif /* __ASM_RTLX_H_ */