• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 /**
16  ****************************************************************************************
17  *
18  * @file asdma_mst_api.h
19  *
20  * @brief ASDMA utility functions
21  *
22  ****************************************************************************************
23  */
24 
25 #ifndef _ASDMA_MST_API_H_
26 #define _ASDMA_MST_API_H_
27 
28 /*
29  * INCLUDE FILES
30  ****************************************************************************************
31  */
32 
33 /*
34  * Structs
35  ****************************************************************************************
36  */
37 
38 typedef struct {
39     unsigned int addr;
40     unsigned int data;
41 } asdma_regw_info_t;
42 
43 typedef struct {
44     unsigned int addr;
45     unsigned int data;
46     unsigned int mask;
47 } asdma_regwm_info_t;
48 
49 typedef struct {
50     unsigned int addr;
51 } asdma_regr_info_t;
52 
53 typedef struct {
54     void *reginfo;
55     unsigned int count;
56 } asdma_func2_info_t;
57 
58 typedef struct {
59     unsigned int  buf_addr;
60     unsigned int  tbl0_cnt;
61     unsigned int  tbl1_cnt;
62     unsigned int  nxt_addr;
63 } asdma_dma_desc_t __attribute__ ((aligned (8)));
64 
65 typedef struct
66 {
67     unsigned volatile int *addr;
68     unsigned volatile int *data;
69     unsigned volatile int *wmask;
70     unsigned int count;
71 } ASDMA_REG_INFO_T;
72 
73 void asdma_mst_init(void);
74 unsigned int asdma_reg_rd(unsigned int raddr);
75 //void asdma_reg_rd_block(asdma_func2_info_t *func2_info, unsigned int *rbuf);
76 void asdma_reg_wr(unsigned int waddr, unsigned int wdata);
77 //void asdma_reg_wr_block(asdma_func2_info_t *func2_info);
78 void asdma_reg_mask_wr(unsigned int waddr, unsigned int wdata, unsigned int wmask);
79 //void asdma_reg_mask_wr_block(asdma_func2_info_t *func2_info);
80 void asdma_blk_rd(unsigned int word_count, unsigned int addr,unsigned volatile int *data, unsigned char fix_flag);
81 void asdma_blk_wr(unsigned int word_count, unsigned int addr, unsigned int *data, unsigned char fix_flag);
82 
83 void asdma_mst_global_int_enable(void);
84 void asdma_slv_internal_reg_wr(unsigned int func, unsigned int waddr, unsigned int *wdata, unsigned int byte_count, char incr);
85 void asdma_mst_enable_slv_global_int (unsigned char int_enable);
86 
87 void asdma_mst_audio_cfg_frag_len(unsigned short tx_bytes, unsigned short rx_bytes);
88 void asdma_mst_audio_cfg_slv_fifo_threshold(unsigned short txfifo_th, unsigned short rxfifo_th);
89 void asdma_mst_audio_init_trig_cnt(unsigned int trig_cnt_init);
90 void asdma_mst_audio_cfg_trig_threshold (unsigned int trig_th);
91 void asdma_mst_audio_cfg_trig_enable(void);
92 void asdma_mst_audio_cfg_trig_disable(void);
93 void asdma_mst_audio_force_trig(void);
94 
95 void asdma_slv_audio_soft_reset(void);
96 void asdma_slv_audio_clear_wrfifo(void);
97 void asdma_slv_audio_clear_rdfifo(void);
98 unsigned char asdma_slv_audio_fifo_status_get(void);
99 
100 #endif /* _ASDMA_MST_API_H_ */
101