• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 
19 #ifndef __HI_PROC_H__
20 #define __HI_PROC_H__
21 
22 #include "hi_type.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27 
28 #define MAX_PROC_CMD_LEN 50
29 #define MAX_PROC_NAME_LEN 50
30 #define HI_PROC_BUF_SIZE 65536
31 #define HI_PROC_WRITE_CMD_SIZE 32
32 
33 #define HIPROC_DEVICE_NAME "hi_proc"
34 #define HIPROC_PFX "hiproc: "
35 
36 #define HI_USER_PROC_READ_CMD "__read"
37 #define HI_USER_PROC_WRITE_CMD "__write"
38 
39 typedef struct {
40     hi_char *buf;
41     hi_u32 size;
42     hi_u32 offset;
43 } hi_proc_show_buf;
44 
45 typedef struct {
46     hi_char buf[HI_PROC_WRITE_CMD_SIZE];
47     hi_u32 count;
48     hi_s64 ppos;
49 } hi_proc_write_buf;
50 
51 typedef struct {
52     hi_char cmd[MAX_PROC_CMD_LEN];
53     osal_proc_entry entry;
54     hi_proc_write_buf write_buf;
55 } hi_proc_para;
56 
57 typedef struct {
58     hi_char name[MAX_PROC_NAME_LEN];
59 } hi_proc_name;
60 
61 #define HI_ID_PROC 'Y'
62 
63 #define USER_CREATE_PROC_ENTRY           _IOW(HI_ID_PROC, 1, hi_proc_name)
64 #define USER_REMOVE_PROC_ENTRY           _IOW(HI_ID_PROC, 2, hi_proc_name)
65 #define USER_PROC_GET_CMD                _IOWR(HI_ID_PROC, 5, hi_proc_para)
66 #define USER_PROC_WAKE_GET_CMD           _IOW(HI_ID_PROC, 4, hi_proc_para)
67 #define USER_PROC_WAKE_READ_TASK         _IOW(HI_ID_PROC, 6, hi_proc_show_buf)
68 #define USER_PROC_WAKE_WRITE_TASK        _IOW(HI_ID_PROC, 7, hi_proc_show_buf)
69 
70 #ifdef __cplusplus
71 }
72 #endif /* __cplusplus */
73 
74 #endif
75