| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2004, 2005 MIPS Technologies, Inc.  All rights reserved. | 
|  | 3 | * | 
|  | 4 | */ | 
|  | 5 |  | 
| Vegard Nossum | 2cc3c0b | 2008-05-27 17:27:28 +0200 | [diff] [blame] | 6 | #ifndef __ASM_RTLX_H_ | 
| Ralf Baechle | 2600990 | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 7 | #define __ASM_RTLX_H_ | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 8 |  | 
| Atsushi Nemoto | 97dcb82 | 2007-01-08 02:14:29 +0900 | [diff] [blame] | 9 | #include <irq.h> | 
|  | 10 |  | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 11 | #define LX_NODE_BASE 10 | 
|  | 12 |  | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 13 | #define MIPS_CPU_RTLX_IRQ 0 | 
|  | 14 |  | 
| Ralf Baechle | 2600990 | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 15 | #define RTLX_VERSION 2 | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 16 | #define RTLX_xID 0x12345600 | 
|  | 17 | #define RTLX_ID (RTLX_xID | RTLX_VERSION) | 
|  | 18 | #define RTLX_CHANNELS 8 | 
|  | 19 |  | 
| Ralf Baechle | 2600990 | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 20 | #define RTLX_CHANNEL_STDIO	0 | 
|  | 21 | #define RTLX_CHANNEL_DBG	1 | 
|  | 22 | #define RTLX_CHANNEL_SYSIO	2 | 
| Ralf Baechle | afc4841 | 2005-10-31 00:30:39 +0000 | [diff] [blame] | 23 |  | 
| Ralf Baechle | 2600990 | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 24 | extern int rtlx_open(int index, int can_sleep); | 
|  | 25 | extern int rtlx_release(int index); | 
| Ralf Baechle | 46230aa | 2007-03-16 12:16:27 +0000 | [diff] [blame] | 26 | extern ssize_t rtlx_read(int index, void __user *buff, size_t count); | 
|  | 27 | extern ssize_t rtlx_write(int index, const void __user *buffer, size_t count); | 
| Ralf Baechle | 2600990 | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 28 | extern unsigned int rtlx_read_poll(int index, int can_sleep); | 
|  | 29 | extern unsigned int rtlx_write_poll(int index); | 
|  | 30 |  | 
|  | 31 | enum rtlx_state { | 
| Kevin D. Kissell | 1928cc8 | 2008-04-16 15:32:22 +0200 | [diff] [blame] | 32 | RTLX_STATE_UNUSED = 0, | 
| Ralf Baechle | 2600990 | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 33 | RTLX_STATE_INITIALISED, | 
|  | 34 | RTLX_STATE_REMOTE_READY, | 
|  | 35 | RTLX_STATE_OPENED | 
|  | 36 | }; | 
|  | 37 |  | 
| Kevin D. Kissell | 1928cc8 | 2008-04-16 15:32:22 +0200 | [diff] [blame] | 38 | #define RTLX_BUFFER_SIZE 2048 | 
| Ralf Baechle | afc4841 | 2005-10-31 00:30:39 +0000 | [diff] [blame] | 39 |  | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 40 | /* 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 Baechle | afc4841 | 2005-10-31 00:30:39 +0000 | [diff] [blame] | 44 | struct rtlx_channel { | 
| Ralf Baechle | 2600990 | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 45 | enum rtlx_state rt_state; | 
|  | 46 | enum rtlx_state lx_state; | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 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; | 
| Ralf Baechle | afc4841 | 2005-10-31 00:30:39 +0000 | [diff] [blame] | 56 | }; | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 57 |  | 
| Ralf Baechle | afc4841 | 2005-10-31 00:30:39 +0000 | [diff] [blame] | 58 | struct rtlx_info { | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 59 | unsigned long id; | 
| Ralf Baechle | 2600990 | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 60 | enum rtlx_state state; | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 61 |  | 
|  | 62 | struct rtlx_channel channel[RTLX_CHANNELS]; | 
| Ralf Baechle | afc4841 | 2005-10-31 00:30:39 +0000 | [diff] [blame] | 63 | }; | 
| Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 64 |  | 
| Ralf Baechle | 2600990 | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 65 | #endif /* __ASM_RTLX_H_ */ |