18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 38c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 48c2ecf20Sopenharmony_ci * for more details. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved. 78c2ecf20Sopenharmony_ci * Copyright (C) 2013 Imagination Technologies Ltd. 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#ifndef __ASM_RTLX_H_ 108c2ecf20Sopenharmony_ci#define __ASM_RTLX_H_ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <irq.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#define RTLX_MODULE_NAME "rtlx" 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#define LX_NODE_BASE 10 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define MIPS_CPU_RTLX_IRQ 0 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define RTLX_VERSION 2 218c2ecf20Sopenharmony_ci#define RTLX_xID 0x12345600 228c2ecf20Sopenharmony_ci#define RTLX_ID (RTLX_xID | RTLX_VERSION) 238c2ecf20Sopenharmony_ci#define RTLX_BUFFER_SIZE 2048 248c2ecf20Sopenharmony_ci#define RTLX_CHANNELS 8 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#define RTLX_CHANNEL_STDIO 0 278c2ecf20Sopenharmony_ci#define RTLX_CHANNEL_DBG 1 288c2ecf20Sopenharmony_ci#define RTLX_CHANNEL_SYSIO 2 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_civoid rtlx_starting(int vpe); 318c2ecf20Sopenharmony_civoid rtlx_stopping(int vpe); 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciint rtlx_open(int index, int can_sleep); 348c2ecf20Sopenharmony_ciint rtlx_release(int index); 358c2ecf20Sopenharmony_cissize_t rtlx_read(int index, void __user *buff, size_t count); 368c2ecf20Sopenharmony_cissize_t rtlx_write(int index, const void __user *buffer, size_t count); 378c2ecf20Sopenharmony_ciunsigned int rtlx_read_poll(int index, int can_sleep); 388c2ecf20Sopenharmony_ciunsigned int rtlx_write_poll(int index); 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciint __init rtlx_module_init(void); 418c2ecf20Sopenharmony_civoid __exit rtlx_module_exit(void); 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_civoid _interrupt_sp(void); 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ciextern struct vpe_notifications rtlx_notify; 468c2ecf20Sopenharmony_ciextern const struct file_operations rtlx_fops; 478c2ecf20Sopenharmony_ciextern void (*aprp_hook)(void); 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_cienum rtlx_state { 508c2ecf20Sopenharmony_ci RTLX_STATE_UNUSED = 0, 518c2ecf20Sopenharmony_ci RTLX_STATE_INITIALISED, 528c2ecf20Sopenharmony_ci RTLX_STATE_REMOTE_READY, 538c2ecf20Sopenharmony_ci RTLX_STATE_OPENED 548c2ecf20Sopenharmony_ci}; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ciextern struct chan_waitqueues { 578c2ecf20Sopenharmony_ci wait_queue_head_t rt_queue; 588c2ecf20Sopenharmony_ci wait_queue_head_t lx_queue; 598c2ecf20Sopenharmony_ci atomic_t in_open; 608c2ecf20Sopenharmony_ci struct mutex mutex; 618c2ecf20Sopenharmony_ci} channel_wqs[RTLX_CHANNELS]; 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci/* each channel supports read and write. 648c2ecf20Sopenharmony_ci linux (vpe0) reads lx_buffer and writes rt_buffer 658c2ecf20Sopenharmony_ci SP (vpe1) reads rt_buffer and writes lx_buffer 668c2ecf20Sopenharmony_ci*/ 678c2ecf20Sopenharmony_cistruct rtlx_channel { 688c2ecf20Sopenharmony_ci enum rtlx_state rt_state; 698c2ecf20Sopenharmony_ci enum rtlx_state lx_state; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci int buffer_size; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci /* read and write indexes per buffer */ 748c2ecf20Sopenharmony_ci int rt_write, rt_read; 758c2ecf20Sopenharmony_ci char *rt_buffer; 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci int lx_write, lx_read; 788c2ecf20Sopenharmony_ci char *lx_buffer; 798c2ecf20Sopenharmony_ci}; 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ciextern struct rtlx_info { 828c2ecf20Sopenharmony_ci unsigned long id; 838c2ecf20Sopenharmony_ci enum rtlx_state state; 848c2ecf20Sopenharmony_ci int ap_int_pending; /* Status of 0 or 1 for CONFIG_MIPS_CMP only */ 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci struct rtlx_channel channel[RTLX_CHANNELS]; 878c2ecf20Sopenharmony_ci} *rtlx; 888c2ecf20Sopenharmony_ci#endif /* __ASM_RTLX_H_ */ 89