rtlx.h 1.4 KB
Newer Older
1 2 3 4 5
/*
 * Copyright (C) 2004, 2005 MIPS Technologies, Inc.  All rights reserved.
 *
 */

6 7
#ifndef __ASM_RTLX_H
#define __ASM_RTLX_H_
8 9 10 11 12 13

#define LX_NODE_BASE 10

#define MIPSCPU_INT_BASE       16
#define MIPS_CPU_RTLX_IRQ 0

14
#define RTLX_VERSION 2
15 16 17 18
#define RTLX_xID 0x12345600
#define RTLX_ID (RTLX_xID | RTLX_VERSION)
#define RTLX_CHANNELS 8

19 20 21
#define RTLX_CHANNEL_STDIO	0
#define RTLX_CHANNEL_DBG	1
#define RTLX_CHANNEL_SYSIO	2
R
Ralf Baechle 已提交
22

23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
extern int rtlx_open(int index, int can_sleep);
extern int rtlx_release(int index);
extern ssize_t rtlx_read(int index, void *buff, size_t count, int user);
extern ssize_t rtlx_write(int index, void *buffer, size_t count, int user);
extern unsigned int rtlx_read_poll(int index, int can_sleep);
extern unsigned int rtlx_write_poll(int index);

enum rtlx_state {
	RTLX_STATE_UNUSED,
	RTLX_STATE_INITIALISED,
	RTLX_STATE_REMOTE_READY,
	RTLX_STATE_OPENED
};

#define RTLX_BUFFER_SIZE 1024
R
Ralf Baechle 已提交
38

39 40 41 42
/* each channel supports read and write.
   linux (vpe0) reads lx_buffer  and writes rt_buffer
   SP (vpe1) reads rt_buffer and writes lx_buffer
*/
R
Ralf Baechle 已提交
43
struct rtlx_channel {
44 45
	enum rtlx_state rt_state;
	enum rtlx_state lx_state;
46 47 48 49 50 51 52 53 54

	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;
R
Ralf Baechle 已提交
55
};
56

R
Ralf Baechle 已提交
57
struct rtlx_info {
58
	unsigned long id;
59
	enum rtlx_state state;
60 61

	struct rtlx_channel channel[RTLX_CHANNELS];
R
Ralf Baechle 已提交
62
};
63

64
#endif /* __ASM_RTLX_H_ */