2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
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.
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
15 #ifndef __IA_CSS_ENV_H
16 #define __IA_CSS_ENV_H
18 #include <type_support.h>
19 #include <stdarg.h> /* va_list */
20 #include "ia_css_types.h"
21 #include "ia_css_acc_types.h"
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.
28 /* Memory allocation attributes, for use in ia_css_css_mem_env. */
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,
36 /* Environment with function pointers for local IA memory allocation.
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).
41 struct ia_css_cpu_mem_env
{
42 void (*flush
)(struct ia_css_acc_fw
*fw
);
43 /** Flush function to flush the cache for given accelerator. */
46 /* Environment with function pointers to access the CSS hardware. This includes
47 * registers and local memories.
49 struct ia_css_hw_access_env
{
50 void (*store_8
)(hrt_address addr
, uint8_t data
);
51 /** Store an 8 bit value into an address in the CSS HW address space.
52 The address must be an 8 bit aligned address. */
53 void (*store_16
)(hrt_address addr
, uint16_t data
);
54 /** Store a 16 bit value into an address in the CSS HW address space.
55 The address must be a 16 bit aligned address. */
56 void (*store_32
)(hrt_address addr
, uint32_t data
);
57 /** Store a 32 bit value into an address in the CSS HW address space.
58 The address must be a 32 bit aligned address. */
59 uint8_t (*load_8
)(hrt_address addr
);
60 /** Load an 8 bit value from an address in the CSS HW address
61 space. The address must be an 8 bit aligned address. */
62 uint16_t (*load_16
)(hrt_address addr
);
63 /** Load a 16 bit value from an address in the CSS HW address
64 space. The address must be a 16 bit aligned address. */
65 uint32_t (*load_32
)(hrt_address addr
);
66 /** Load a 32 bit value from an address in the CSS HW address
67 space. The address must be a 32 bit aligned address. */
68 void (*store
)(hrt_address addr
, const void *data
, uint32_t bytes
);
69 /** Store a number of bytes into a byte-aligned address in the CSS HW address space. */
70 void (*load
)(hrt_address addr
, void *data
, uint32_t bytes
);
71 /** Load a number of bytes from a byte-aligned address in the CSS HW address space. */
74 /* Environment with function pointers to print error and debug messages.
76 struct ia_css_print_env
{
77 int (*debug_print
)(const char *fmt
, va_list args
);
78 /** Print a debug message. */
79 int (*error_print
)(const char *fmt
, va_list args
);
80 /** Print an error message.*/
83 /* Environment structure. This includes function pointers to access several
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.
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. */
94 #endif /* __IA_CSS_ENV_H */