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_ENV_H | |
16 | #define __IA_CSS_ENV_H | |
17 | ||
18 | #include <type_support.h> | |
19 | #include <stdarg.h> /* va_list */ | |
20 | #include "ia_css_types.h" | |
21 | #include "ia_css_acc_types.h" | |
22 | ||
d929fb4e | 23 | /* @file |
a49d2536 AC |
24 | * This file contains prototypes for functions that need to be provided to the |
25 | * CSS-API host-code by the environment in which the CSS-API code runs. | |
26 | */ | |
27 | ||
d929fb4e | 28 | /* Memory allocation attributes, for use in ia_css_css_mem_env. */ |
a49d2536 AC |
29 | enum ia_css_mem_attr { |
30 | IA_CSS_MEM_ATTR_CACHED = 1 << 0, | |
31 | IA_CSS_MEM_ATTR_ZEROED = 1 << 1, | |
32 | IA_CSS_MEM_ATTR_PAGEALIGN = 1 << 2, | |
33 | IA_CSS_MEM_ATTR_CONTIGUOUS = 1 << 3, | |
34 | }; | |
35 | ||
d929fb4e | 36 | /* Environment with function pointers for local IA memory allocation. |
a49d2536 AC |
37 | * This provides the CSS code with environment specific functionality |
38 | * for memory allocation of small local buffers such as local data structures. | |
39 | * This is never expected to allocate more than one page of memory (4K bytes). | |
40 | */ | |
41 | struct ia_css_cpu_mem_env { | |
a49d2536 | 42 | void (*flush)(struct ia_css_acc_fw *fw); |
d929fb4e | 43 | /** Flush function to flush the cache for given accelerator. */ |
a49d2536 AC |
44 | }; |
45 | ||
d929fb4e | 46 | /* Environment with function pointers to access the CSS hardware. This includes |
a49d2536 AC |
47 | * registers and local memories. |
48 | */ | |
49 | struct ia_css_hw_access_env { | |
50 | void (*store_8)(hrt_address addr, uint8_t data); | |
d929fb4e | 51 | /** Store an 8 bit value into an address in the CSS HW address space. |
a49d2536 AC |
52 | The address must be an 8 bit aligned address. */ |
53 | void (*store_16)(hrt_address addr, uint16_t data); | |
d929fb4e | 54 | /** Store a 16 bit value into an address in the CSS HW address space. |
a49d2536 AC |
55 | The address must be a 16 bit aligned address. */ |
56 | void (*store_32)(hrt_address addr, uint32_t data); | |
d929fb4e | 57 | /** Store a 32 bit value into an address in the CSS HW address space. |
a49d2536 AC |
58 | The address must be a 32 bit aligned address. */ |
59 | uint8_t (*load_8)(hrt_address addr); | |
d929fb4e | 60 | /** Load an 8 bit value from an address in the CSS HW address |
a49d2536 AC |
61 | space. The address must be an 8 bit aligned address. */ |
62 | uint16_t (*load_16)(hrt_address addr); | |
d929fb4e | 63 | /** Load a 16 bit value from an address in the CSS HW address |
a49d2536 AC |
64 | space. The address must be a 16 bit aligned address. */ |
65 | uint32_t (*load_32)(hrt_address addr); | |
d929fb4e | 66 | /** Load a 32 bit value from an address in the CSS HW address |
a49d2536 AC |
67 | space. The address must be a 32 bit aligned address. */ |
68 | void (*store)(hrt_address addr, const void *data, uint32_t bytes); | |
d929fb4e | 69 | /** Store a number of bytes into a byte-aligned address in the CSS HW address space. */ |
a49d2536 | 70 | void (*load)(hrt_address addr, void *data, uint32_t bytes); |
d929fb4e | 71 | /** Load a number of bytes from a byte-aligned address in the CSS HW address space. */ |
a49d2536 AC |
72 | }; |
73 | ||
d929fb4e | 74 | /* Environment with function pointers to print error and debug messages. |
a49d2536 AC |
75 | */ |
76 | struct ia_css_print_env { | |
77 | int (*debug_print)(const char *fmt, va_list args); | |
d929fb4e | 78 | /** Print a debug message. */ |
a49d2536 | 79 | int (*error_print)(const char *fmt, va_list args); |
d929fb4e | 80 | /** Print an error message.*/ |
a49d2536 AC |
81 | }; |
82 | ||
d929fb4e | 83 | /* Environment structure. This includes function pointers to access several |
a49d2536 AC |
84 | * features provided by the environment in which the CSS API is used. |
85 | * This is used to run the camera IP in multiple platforms such as Linux, | |
86 | * Windows and several simulation environments. | |
87 | */ | |
88 | struct ia_css_env { | |
d929fb4e MCC |
89 | struct ia_css_cpu_mem_env cpu_mem_env; /** local flush. */ |
90 | struct ia_css_hw_access_env hw_access_env; /** CSS HW access functions */ | |
91 | struct ia_css_print_env print_env; /** Message printing env. */ | |
a49d2536 AC |
92 | }; |
93 | ||
94 | #endif /* __IA_CSS_ENV_H */ |