2005-07-14 23:57:16 +08:00
|
|
|
/*
|
2014-01-01 23:35:32 +08:00
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*
|
2005-07-14 23:57:16 +08:00
|
|
|
* Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
|
2014-01-01 23:26:46 +08:00
|
|
|
* Copyright (C) 2013 Imagination Technologies Ltd.
|
2005-07-14 23:57:16 +08:00
|
|
|
*/
|
2008-05-27 23:27:28 +08:00
|
|
|
#ifndef __ASM_RTLX_H_
|
2006-04-05 16:45:45 +08:00
|
|
|
#define __ASM_RTLX_H_
|
2005-07-14 23:57:16 +08:00
|
|
|
|
2007-01-08 01:14:29 +08:00
|
|
|
#include <irq.h>
|
|
|
|
|
2014-01-01 23:26:46 +08:00
|
|
|
#define RTLX_MODULE_NAME "rtlx"
|
|
|
|
|
2005-07-14 23:57:16 +08:00
|
|
|
#define LX_NODE_BASE 10
|
|
|
|
|
|
|
|
#define MIPS_CPU_RTLX_IRQ 0
|
|
|
|
|
2006-04-05 16:45:45 +08:00
|
|
|
#define RTLX_VERSION 2
|
2005-07-14 23:57:16 +08:00
|
|
|
#define RTLX_xID 0x12345600
|
|
|
|
#define RTLX_ID (RTLX_xID | RTLX_VERSION)
|
2014-01-01 23:26:46 +08:00
|
|
|
#define RTLX_BUFFER_SIZE 2048
|
2005-07-14 23:57:16 +08:00
|
|
|
#define RTLX_CHANNELS 8
|
|
|
|
|
2006-04-05 16:45:45 +08:00
|
|
|
#define RTLX_CHANNEL_STDIO 0
|
|
|
|
#define RTLX_CHANNEL_DBG 1
|
|
|
|
#define RTLX_CHANNEL_SYSIO 2
|
2005-10-31 08:30:39 +08:00
|
|
|
|
2014-01-01 23:26:46 +08:00
|
|
|
void rtlx_starting(int vpe);
|
|
|
|
void rtlx_stopping(int vpe);
|
|
|
|
|
|
|
|
int rtlx_open(int index, int can_sleep);
|
|
|
|
int rtlx_release(int index);
|
|
|
|
ssize_t rtlx_read(int index, void __user *buff, size_t count);
|
|
|
|
ssize_t rtlx_write(int index, const void __user *buffer, size_t count);
|
|
|
|
unsigned int rtlx_read_poll(int index, int can_sleep);
|
|
|
|
unsigned int rtlx_write_poll(int index);
|
|
|
|
|
|
|
|
int __init rtlx_module_init(void);
|
|
|
|
void __exit rtlx_module_exit(void);
|
|
|
|
|
|
|
|
void _interrupt_sp(void);
|
|
|
|
|
|
|
|
extern struct vpe_notifications rtlx_notify;
|
|
|
|
extern const struct file_operations rtlx_fops;
|
|
|
|
extern void (*aprp_hook)(void);
|
2006-04-05 16:45:45 +08:00
|
|
|
|
|
|
|
enum rtlx_state {
|
2008-04-16 21:32:22 +08:00
|
|
|
RTLX_STATE_UNUSED = 0,
|
2006-04-05 16:45:45 +08:00
|
|
|
RTLX_STATE_INITIALISED,
|
|
|
|
RTLX_STATE_REMOTE_READY,
|
|
|
|
RTLX_STATE_OPENED
|
|
|
|
};
|
|
|
|
|
2014-01-01 23:26:46 +08:00
|
|
|
extern struct chan_waitqueues {
|
|
|
|
wait_queue_head_t rt_queue;
|
|
|
|
wait_queue_head_t lx_queue;
|
|
|
|
atomic_t in_open;
|
|
|
|
struct mutex mutex;
|
|
|
|
} channel_wqs[RTLX_CHANNELS];
|
2005-10-31 08:30:39 +08:00
|
|
|
|
2005-07-14 23:57:16 +08:00
|
|
|
/* each channel supports read and write.
|
2014-01-01 23:26:46 +08:00
|
|
|
linux (vpe0) reads lx_buffer and writes rt_buffer
|
2005-07-14 23:57:16 +08:00
|
|
|
SP (vpe1) reads rt_buffer and writes lx_buffer
|
|
|
|
*/
|
2005-10-31 08:30:39 +08:00
|
|
|
struct rtlx_channel {
|
2006-04-05 16:45:45 +08:00
|
|
|
enum rtlx_state rt_state;
|
|
|
|
enum rtlx_state lx_state;
|
2005-07-14 23:57:16 +08:00
|
|
|
|
|
|
|
int buffer_size;
|
|
|
|
|
|
|
|
/* read and write indexes per buffer */
|
|
|
|
int rt_write, rt_read;
|
|
|
|
char *rt_buffer;
|
|
|
|
|
|
|
|
int lx_write, lx_read;
|
|
|
|
char *lx_buffer;
|
2005-10-31 08:30:39 +08:00
|
|
|
};
|
2005-07-14 23:57:16 +08:00
|
|
|
|
2014-01-01 23:26:46 +08:00
|
|
|
extern struct rtlx_info {
|
2005-07-14 23:57:16 +08:00
|
|
|
unsigned long id;
|
2006-04-05 16:45:45 +08:00
|
|
|
enum rtlx_state state;
|
2014-01-01 23:29:03 +08:00
|
|
|
int ap_int_pending; /* Status of 0 or 1 for CONFIG_MIPS_CMP only */
|
2005-07-14 23:57:16 +08:00
|
|
|
|
|
|
|
struct rtlx_channel channel[RTLX_CHANNELS];
|
2014-01-01 23:26:46 +08:00
|
|
|
} *rtlx;
|
2006-04-05 16:45:45 +08:00
|
|
|
#endif /* __ASM_RTLX_H_ */
|