rtlx.h (bf61c8840efe60fd8f91446860b63338fb424158) rtlx.h (2c973ef0cc3f981bfb137c3e42e08de5e8f1cc18)
1/*
2 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
1/*
2 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
3 *
3 * Copyright (C) 2013 Imagination Technologies Ltd.
4 */
5
6#ifndef __ASM_RTLX_H_
7#define __ASM_RTLX_H_
8
9#include <irq.h>
10
4 */
5
6#ifndef __ASM_RTLX_H_
7#define __ASM_RTLX_H_
8
9#include <irq.h>
10
11#define RTLX_MODULE_NAME "rtlx"
12
11#define LX_NODE_BASE 10
12
13#define MIPS_CPU_RTLX_IRQ 0
14
15#define RTLX_VERSION 2
16#define RTLX_xID 0x12345600
17#define RTLX_ID (RTLX_xID | RTLX_VERSION)
13#define LX_NODE_BASE 10
14
15#define MIPS_CPU_RTLX_IRQ 0
16
17#define RTLX_VERSION 2
18#define RTLX_xID 0x12345600
19#define RTLX_ID (RTLX_xID | RTLX_VERSION)
20#define RTLX_BUFFER_SIZE 2048
18#define RTLX_CHANNELS 8
19
20#define RTLX_CHANNEL_STDIO 0
21#define RTLX_CHANNEL_DBG 1
22#define RTLX_CHANNEL_SYSIO 2
23
21#define RTLX_CHANNELS 8
22
23#define RTLX_CHANNEL_STDIO 0
24#define RTLX_CHANNEL_DBG 1
25#define RTLX_CHANNEL_SYSIO 2
26
24extern int rtlx_open(int index, int can_sleep);
25extern int rtlx_release(int index);
26extern ssize_t rtlx_read(int index, void __user *buff, size_t count);
27extern ssize_t rtlx_write(int index, const void __user *buffer, size_t count);
28extern unsigned int rtlx_read_poll(int index, int can_sleep);
29extern unsigned int rtlx_write_poll(int index);
27void rtlx_starting(int vpe);
28void rtlx_stopping(int vpe);
30
29
30int rtlx_open(int index, int can_sleep);
31int rtlx_release(int index);
32ssize_t rtlx_read(int index, void __user *buff, size_t count);
33ssize_t rtlx_write(int index, const void __user *buffer, size_t count);
34unsigned int rtlx_read_poll(int index, int can_sleep);
35unsigned int rtlx_write_poll(int index);
36
37int __init rtlx_module_init(void);
38void __exit rtlx_module_exit(void);
39
40void _interrupt_sp(void);
41
42extern struct vpe_notifications rtlx_notify;
43extern const struct file_operations rtlx_fops;
44extern void (*aprp_hook)(void);
45
31enum rtlx_state {
32 RTLX_STATE_UNUSED = 0,
33 RTLX_STATE_INITIALISED,
34 RTLX_STATE_REMOTE_READY,
35 RTLX_STATE_OPENED
36};
37
46enum rtlx_state {
47 RTLX_STATE_UNUSED = 0,
48 RTLX_STATE_INITIALISED,
49 RTLX_STATE_REMOTE_READY,
50 RTLX_STATE_OPENED
51};
52
38#define RTLX_BUFFER_SIZE 2048
53extern struct chan_waitqueues {
54 wait_queue_head_t rt_queue;
55 wait_queue_head_t lx_queue;
56 atomic_t in_open;
57 struct mutex mutex;
58} channel_wqs[RTLX_CHANNELS];
39
40/* each channel supports read and write.
59
60/* each channel supports read and write.
41 linux (vpe0) reads lx_buffer and writes rt_buffer
61 linux (vpe0) reads lx_buffer and writes rt_buffer
42 SP (vpe1) reads rt_buffer and writes lx_buffer
43*/
44struct rtlx_channel {
45 enum rtlx_state rt_state;
46 enum rtlx_state lx_state;
47
48 int buffer_size;
49
50 /* read and write indexes per buffer */
51 int rt_write, rt_read;
52 char *rt_buffer;
53
54 int lx_write, lx_read;
55 char *lx_buffer;
56};
57
62 SP (vpe1) reads rt_buffer and writes lx_buffer
63*/
64struct rtlx_channel {
65 enum rtlx_state rt_state;
66 enum rtlx_state lx_state;
67
68 int buffer_size;
69
70 /* read and write indexes per buffer */
71 int rt_write, rt_read;
72 char *rt_buffer;
73
74 int lx_write, lx_read;
75 char *lx_buffer;
76};
77
58struct rtlx_info {
78extern struct rtlx_info {
59 unsigned long id;
60 enum rtlx_state state;
61
62 struct rtlx_channel channel[RTLX_CHANNELS];
79 unsigned long id;
80 enum rtlx_state state;
81
82 struct rtlx_channel channel[RTLX_CHANNELS];
63};
64
83} *rtlx;
65#endif /* __ASM_RTLX_H_ */
84#endif /* __ASM_RTLX_H_ */