rtlx.h 2.1 KB

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