• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * drivers/amlogic/amports/decoder/decoder_bmmu_box.h
3  *
4  * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  */
17 
18 #ifndef DECODER_BLOCK_BUFFER_BOX
19 #define DECODER_BLOCK_BUFFER_BOX
20 
21 void *decoder_bmmu_box_alloc_box(const char *name,
22 								 int channel_id,
23 								 int max_num,
24 								 int aligned,
25 								 int mem_flags);
26 
27 int decoder_bmmu_box_alloc_idx(
28 	void *handle, int idx, int size,
29 	int aligned_2n, int mem_flags);
30 
31 int decoder_bmmu_box_free_idx(void *handle, int idx);
32 int decoder_bmmu_box_free(void *handle);
33 void *decoder_bmmu_box_get_mem_handle(
34 	void *box_handle, int idx);
35 
36 unsigned long decoder_bmmu_box_get_phy_addr(
37 	void *box_handle, int idx);
38 
39 void *decoder_bmmu_box_get_virt_addr(
40 	void *box_handle, int idx);
41 
42 /*flags: &0x1 for wait,*/
43 int decoder_bmmu_box_check_and_wait_size(
44 	int size, int flags);
45 
46 int decoder_bmmu_box_alloc_buf_phy(
47 	void *handle, int idx,
48 	int size, unsigned char *driver_name,
49 	unsigned long *buf_phy_addr);
50 
51 #define BMMU_ALLOC_FLAGS_WAIT (1 << 0)
52 #define BMMU_ALLOC_FLAGS_CAN_CLEAR_KEEPER (1 << 1)
53 #define BMMU_ALLOC_FLAGS_WAITCLEAR \
54 		(BMMU_ALLOC_FLAGS_WAIT |\
55 		BMMU_ALLOC_FLAGS_CAN_CLEAR_KEEPER)
56 
57 int decoder_bmmu_box_alloc_idx_wait(
58 	void *handle, int idx,
59 	int size, int aligned_2n,
60 	int mem_flags,
61 	int wait_flags);
62 
63 bool decoder_bmmu_box_valide_check(void *box);
64 void decoder_bmmu_try_to_release_box(void *handle);
65 
66 int decoder_bmmu_box_init(void);
67 void decoder_bmmu_box_exit(void);
68 
69 #endif
70 
71