blob: 65778c890a62ef4ed3b06a673d7ce552ca616e2a [file] [log] [blame]
Ralf Baechlee01402b2005-07-14 15:57:16 +00001/*
2 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 */
5
Ralf Baechle26009902006-04-05 09:45:45 +01006#ifndef __ASM_RTLX_H
7#define __ASM_RTLX_H_
Ralf Baechlee01402b2005-07-14 15:57:16 +00008
Atsushi Nemoto97dcb822007-01-08 02:14:29 +09009#include <irq.h>
10
Ralf Baechlee01402b2005-07-14 15:57:16 +000011#define LX_NODE_BASE 10
12
Ralf Baechlee01402b2005-07-14 15:57:16 +000013#define MIPS_CPU_RTLX_IRQ 0
14
Ralf Baechle26009902006-04-05 09:45:45 +010015#define RTLX_VERSION 2
Ralf Baechlee01402b2005-07-14 15:57:16 +000016#define RTLX_xID 0x12345600
17#define RTLX_ID (RTLX_xID | RTLX_VERSION)
18#define RTLX_CHANNELS 8
19
Ralf Baechle26009902006-04-05 09:45:45 +010020#define RTLX_CHANNEL_STDIO 0
21#define RTLX_CHANNEL_DBG 1
22#define RTLX_CHANNEL_SYSIO 2
Ralf Baechleafc48412005-10-31 00:30:39 +000023
Ralf Baechle26009902006-04-05 09:45:45 +010024extern int rtlx_open(int index, int can_sleep);
25extern int rtlx_release(int index);
Ralf Baechle46230aa2007-03-16 12:16:27 +000026extern 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);
Ralf Baechle26009902006-04-05 09:45:45 +010028extern unsigned int rtlx_read_poll(int index, int can_sleep);
29extern unsigned int rtlx_write_poll(int index);
30
31enum rtlx_state {
32 RTLX_STATE_UNUSED,
33 RTLX_STATE_INITIALISED,
34 RTLX_STATE_REMOTE_READY,
35 RTLX_STATE_OPENED
36};
37
38#define RTLX_BUFFER_SIZE 1024
Ralf Baechleafc48412005-10-31 00:30:39 +000039
Ralf Baechlee01402b2005-07-14 15:57:16 +000040/* each channel supports read and write.
41 linux (vpe0) reads lx_buffer and writes rt_buffer
42 SP (vpe1) reads rt_buffer and writes lx_buffer
43*/
Ralf Baechleafc48412005-10-31 00:30:39 +000044struct rtlx_channel {
Ralf Baechle26009902006-04-05 09:45:45 +010045 enum rtlx_state rt_state;
46 enum rtlx_state lx_state;
Ralf Baechlee01402b2005-07-14 15:57:16 +000047
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;
Ralf Baechleafc48412005-10-31 00:30:39 +000056};
Ralf Baechlee01402b2005-07-14 15:57:16 +000057
Ralf Baechleafc48412005-10-31 00:30:39 +000058struct rtlx_info {
Ralf Baechlee01402b2005-07-14 15:57:16 +000059 unsigned long id;
Ralf Baechle26009902006-04-05 09:45:45 +010060 enum rtlx_state state;
Ralf Baechlee01402b2005-07-14 15:57:16 +000061
62 struct rtlx_channel channel[RTLX_CHANNELS];
Ralf Baechleafc48412005-10-31 00:30:39 +000063};
Ralf Baechlee01402b2005-07-14 15:57:16 +000064
Ralf Baechle26009902006-04-05 09:45:45 +010065#endif /* __ASM_RTLX_H_ */