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_FIRMWARE_API_H__ 21 #define __ACAMERA_FIRMWARE_API_H__ 22 23 #include "acamera_types.h" 24 #include "acamera_sensor_api.h" 25 #include "acamera_lens_api.h" 26 #include "acamera_command_api.h" 27 #include "acamera_firmware_settings.h" 28 29 /** 30 * Initialize one instance of firmware context 31 * 32 * The firmware can control several context at the same time. Each context must be initialized with its own 33 * set of setting and independently from all other contexts. A pointer will be returned on valid context on 34 * successful initialization. 35 * 36 * @param settings - a structure with setting for context to be initialized with 37 * @param ctx_num - number of contexts to be initialized 38 * 39 * @return 0 - success 40 * -1 - fail. 41 */ 42 int32_t acamera_init( acamera_settings *settings, uint32_t ctx_num ); 43 44 45 /** 46 * Terminate the firmware 47 * 48 * The function will close the firmware and free all previously allocated resources 49 * 50 * @return 0 - success 51 * -1 - fail. 52 */ 53 int32_t acamera_terminate( void ); 54 55 56 /** 57 * Process one instance of firmware context 58 * 59 * The firmware can control several context at the same time. Each context must be given a CPU time to fulfil 60 * all tasks it has at the moment. This function has to be called for all contexts as frequent as possible to avoid 61 * delays. 62 * 63 * @param ctx - context pointer which was returned by acamera_init 64 * 65 * @return 0 - success 66 * -1 - fail. 67 */ 68 int32_t acamera_process( void ); 69 70 71 /** 72 * Process interrupts 73 * 74 * This function must be called when any of interrupts happen. It will process interrupts properly to guarantee 75 * the correct firmware behaviour. 76 * 77 * @return 0 - success 78 * -1 - fail. 79 */ 80 int32_t acamera_interrupt_handler( void ); 81 82 83 #endif // __ACAMERA_FIRMWARE_API_H__ 84