GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_include / cpu_mem_support.h
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 __CPU_MEM_SUPPORT_H_INCLUDED__
16 #define __CPU_MEM_SUPPORT_H_INCLUDED__
17
18 #if defined (__KERNEL__)
19 #include <linux/string.h> /* memset */
20 #else
21 #include <string.h> /* memset */
22 #endif
23
24 #include "sh_css_internal.h" /* sh_css_malloc and sh_css_free */
25
26 static inline void*
27 ia_css_cpu_mem_alloc(unsigned int size)
28 {
29         return sh_css_malloc(size);
30 }
31
32 static inline void*
33 ia_css_cpu_mem_copy(void* dst, const void* src, unsigned int size)
34 {
35         if(!src || !dst)
36                 return NULL;
37
38         return memcpy(dst, src, size);
39 }
40
41 static inline void*
42 ia_css_cpu_mem_set_zero(void* dst, unsigned int size)
43 {
44         if(!dst)
45                 return NULL;
46
47         return memset(dst, 0, size);
48 }
49
50 static inline void
51 ia_css_cpu_mem_free(void* ptr)
52 {
53         if(!ptr)
54                 return;
55
56         sh_css_free(ptr);
57 }
58
59 #endif /* __CPU_MEM_SUPPORT_H_INCLUDED__ */