ion_test.h revision ceff95d49cc3e28c06c2352e8d94f56046271aeb
1/* 2 * drivers/staging/android/uapi/ion.h 3 * 4 * Copyright (C) 2011 Google, Inc. 5 * 6 * This software is licensed under the terms of the GNU General Public 7 * License version 2, as published by the Free Software Foundation, and 8 * may be copied, distributed, and modified under those terms. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 */ 16 17#ifndef _UAPI_LINUX_ION_TEST_H 18#define _UAPI_LINUX_ION_TEST_H 19 20#include <linux/ioctl.h> 21#include <linux/types.h> 22 23typedef int ion_user_handle_t; 24 25/** 26 * struct ion_test_rw_data - metadata passed to the kernel to read handle 27 * @ptr: a pointer to an area at least as large as size 28 * @offset: offset into the ion buffer to start reading 29 * @size: size to read or write 30 * @write: 1 to write, 0 to read 31 */ 32struct ion_test_rw_data { 33 __u64 ptr; 34 __u64 offset; 35 __u64 size; 36 int write; 37}; 38 39#define ION_IOC_MAGIC 'I' 40 41/** 42 * DOC: ION_IOC_TEST_SET_DMA_BUF - attach a dma buf to the test driver 43 * 44 * Attaches a dma buf fd to the test driver. Passing a second fd or -1 will 45 * release the first fd. 46 */ 47#define ION_IOC_TEST_SET_FD \ 48 _IO(ION_IOC_MAGIC, 0xf0) 49 50/** 51 * DOC: ION_IOC_TEST_DMA_MAPPING - read or write memory from a handle as DMA 52 * 53 * Reads or writes the memory from a handle using an uncached mapping. Can be 54 * used by unit tests to emulate a DMA engine as close as possible. Only 55 * expected to be used for debugging and testing, may not always be available. 56 */ 57#define ION_IOC_TEST_DMA_MAPPING \ 58 _IOW(ION_IOC_MAGIC, 0xf1, struct ion_test_rw_data) 59 60/** 61 * DOC: ION_IOC_TEST_KERNEL_MAPPING - read or write memory from a handle 62 * 63 * Reads or writes the memory from a handle using a kernel mapping. Can be 64 * used by unit tests to test heap map_kernel functions. Only expected to be 65 * used for debugging and testing, may not always be available. 66 */ 67#define ION_IOC_TEST_KERNEL_MAPPING \ 68 _IOW(ION_IOC_MAGIC, 0xf2, struct ion_test_rw_data) 69 70 71#endif /* _UAPI_LINUX_ION_H */ 72