]>
Commit | Line | Data |
---|---|---|
a49d2536 AC |
1 | /* |
2 | * Support for Intel Camera Imaging ISP subsystem. | |
3 | * Copyright (c) 2015, Intel Corporation. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms and conditions of the GNU General Public License, | |
7 | * version 2, as published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope it will be useful, but WITHOUT | |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | * more details. | |
13 | */ | |
14 | ||
15 | #ifndef __IA_CSS_FIRMWARE_H | |
16 | #define __IA_CSS_FIRMWARE_H | |
17 | ||
d929fb4e | 18 | /* @file |
a49d2536 AC |
19 | * This file contains firmware loading/unloading support functionality |
20 | */ | |
21 | ||
22 | #include "ia_css_err.h" | |
23 | #include "ia_css_env.h" | |
24 | ||
d929fb4e | 25 | /* CSS firmware package structure. |
a49d2536 AC |
26 | */ |
27 | struct ia_css_fw { | |
d929fb4e MCC |
28 | void *data; /** pointer to the firmware data */ |
29 | unsigned int bytes; /** length in bytes of firmware data */ | |
a49d2536 AC |
30 | }; |
31 | ||
d929fb4e | 32 | /* @brief Loads the firmware |
a49d2536 AC |
33 | * @param[in] env Environment, provides functions to access the |
34 | * environment in which the CSS code runs. This is | |
35 | * used for host side memory access and message | |
36 | * printing. | |
37 | * @param[in] fw Firmware package containing the firmware for all | |
38 | * predefined ISP binaries. | |
39 | * @return Returns IA_CSS_ERR_INTERNAL_ERROR in case of any | |
40 | * errors and IA_CSS_SUCCESS otherwise. | |
41 | * | |
42 | * This function interprets the firmware package. All | |
43 | * contents of this firmware package are copied into local data structures, so | |
44 | * the fw pointer could be freed after this function completes. | |
45 | * | |
46 | * Rationale for this function is that it can be called before ia_css_init, and thus | |
47 | * speeds up ia_css_init (ia_css_init is called each time a stream is created but the | |
48 | * firmware only needs to be loaded once). | |
49 | */ | |
50 | enum ia_css_err | |
51 | ia_css_load_firmware(const struct ia_css_env *env, | |
52 | const struct ia_css_fw *fw); | |
53 | ||
d929fb4e | 54 | /* @brief Unloads the firmware |
a49d2536 AC |
55 | * @return None |
56 | * | |
57 | * This function unloads the firmware loaded by ia_css_load_firmware. | |
58 | * It is pointless to call this function if no firmware is loaded, | |
59 | * but it won't harm. Use this to deallocate all memory associated with the firmware. | |
60 | */ | |
61 | void | |
62 | ia_css_unload_firmware(void); | |
63 | ||
d929fb4e | 64 | /* @brief Checks firmware version |
a49d2536 AC |
65 | * @param[in] fw Firmware package containing the firmware for all |
66 | * predefined ISP binaries. | |
67 | * @return Returns true when the firmware version matches with the CSS | |
68 | * host code version and returns false otherwise. | |
69 | * This function checks if the firmware package version matches with the CSS host code version. | |
70 | */ | |
71 | bool | |
72 | ia_css_check_firmware_version(const struct ia_css_fw *fw); | |
73 | ||
74 | #endif /* __IA_CSS_FIRMWARE_H */ |