summaryrefstree
path: root/kernel/drivers/vision/iva/iva_vdma.h
blob: a9c458113d32ce053163dc33a7f47ae53b92d460 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Copyright (C) 2016 Samsung Electronics Co.Ltd
 *
 * This program is free software; you can redistribute	it and/or modify it
 * under  the terms of	the GNU General  Public License as published by the
 * Free Software Foundation;  either version 2 of the  License, or (at your
 * option) any later version.
 */

#ifndef __IVA_VDMA_H__
#define __IVA_VDMA_H__

#include "iva_ctrl.h"

/* vdma instance id */
enum vdma_id {
	vdma_id_0	= 0,	/* vdma instance 0 */
	vdma_id_1,		/* vdma instance 1 */
	vdma_id_max		/* vdma instance id max */
};


#define NUM_VDMA_CHANNELS	(4)
enum vdma_ch {
	vdma_ch_0	= 0,
	vdma_ch_1,
	vdma_ch_2,
	vdma_ch_3,
	vdma_ch_max,

	/* just for easier code readibility */
	vdma_ch_invalid = 8,
};

#define CH_MASK		(vdma_ch_max - 1)
#define ID_SHIFT	(2)

#define INVALID_HALDLE_ID	((uint32_t)-1)

#define HALDLE_TO_CH(hdl)	((enum vdma_ch)(hdl & CH_MASK))
#define HALDLE_TO_ID(hdl)	((enum vdma_id)(hdl >> ID_SHIFT))
#define ID_CH_TO_HANDLE(id, ch)	((id << ID_SHIFT) | ch)

extern void iva_vdma_start_cmd(struct iva_dev_data *iva, uint32_t handle);
/* busy wait*/
extern void iva_vdma_wait_done(struct iva_dev_data *iva, uint32_t handle);

extern int32_t	iva_vdma_config_dram_to_mcu(struct iva_dev_data *iva,
			uint32_t handle, uint32_t io_va,
			uint32_t mcu_addr, uint32_t x_size, bool start);

extern int32_t	iva_vdma_enable(struct iva_dev_data *iva,
			enum vdma_id id, bool enable);

extern void	iva_vdma_show_status(struct iva_dev_data *iva);

#endif /* __IVA_MBOX_H */