• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 *
3 * SPDX-License-Identifier: GPL-2.0
4 *
5 * Copyright (C) 2011-2018 ARM or its affiliates
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 *
18 */
19 
20 #ifndef ACAMERA_CTRL_CHANNEL_H
21 #define ACAMERA_CTRL_CHANNEL_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include "acamera_types.h"
28 
29 #define CTRL_CHANNEL_DEV_NAME "ac_isp4uf"
30 #define CTRL_CHANNEL_DEV_NODE_NAME "/dev/" CTRL_CHANNEL_DEV_NAME
31 #define CTRL_CHANNEL_MAX_CMD_SIZE ( 8 * 1024 )
32 
33 
34 enum ctrl_cmd_category {
35     CTRL_CMD_CATEGORY_API_COMMAND = 1,
36     CTRL_CMD_CATEGORY_API_CALIBRATION,
37 };
38 
39 struct ctrl_cmd_item {
40     /* command metadata */
41     uint32_t cmd_len;
42     uint8_t cmd_category;
43 
44     /* command content */
45 #if FIRMWARE_CONTEXT_NUMBER == 2
46     uint32_t cmd_ctx_id;
47 #endif
48     uint8_t cmd_type;
49     uint8_t cmd_id;
50     uint8_t cmd_direction;
51     uint32_t cmd_value;
52 };
53 
54 int ctrl_channel_init( void );
55 void ctrl_channel_process( void );
56 void ctrl_channel_deinit( void );
57 
58 void ctrl_channel_handle_command( uint32_t cmd_ctx_id, uint8_t command_type, uint8_t command, uint32_t value, uint8_t direction );
59 void ctrl_channel_handle_api_calibration( uint32_t cmd_ctx_id, uint8_t type, uint8_t id, uint8_t direction, void *data, uint32_t data_size );
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 #endif /* ACAMERA_CTRL_CHANNEL_H */
66