Azure Sphere MT3620 M4 API Reference Manual
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
os_hal_dma.h
1 /*
2  * (C) 2005-2020 MediaTek Inc. All rights reserved.
3  *
4  * Copyright Statement:
5  *
6  * This MT3620 driver software/firmware and related documentation
7  * ("MediaTek Software") are protected under relevant copyright laws.
8  * The information contained herein is confidential and proprietary to
9  * MediaTek Inc. ("MediaTek"). You may only use, reproduce, modify, or
10  * distribute (as applicable) MediaTek Software if you have agreed to and been
11  * bound by this Statement and the applicable license agreement with MediaTek
12  * ("License Agreement") and been granted explicit permission to do so within
13  * the License Agreement ("Permitted User"). If you are not a Permitted User,
14  * please cease any access or use of MediaTek Software immediately.
15  *
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
18  * PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS
19  * ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
21  * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
22  * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
23  * INCORPORATED IN, OR SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO
24  * LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
25  * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
26  * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
27  * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
28  * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
29  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
30  * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED
31  * HEREUNDER WILL BE ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
32  * RECEIVER TO MEDIATEK DURING THE PRECEDING TWELVE (12) MONTHS FOR SUCH
33  * MEDIATEK SOFTWARE AT ISSUE.
34  */
35 
36 #ifndef __OS_HAL_DMA_H__
37 #define __OS_HAL_DMA_H__
38 
39 #include "mhal_dma.h"
40 
210 };
211 
241 };
242 
253  DMA_INT_COMPLETION = 0x1 << 0,
266 };
290 typedef void (*dma_interrupt_callback)(void *user_data);
306 struct dma_wrap {
325 };
326 
355 };
356 
364  void *cb_data;
365 };
366 
370 struct dma_vfifo {
388 };
389 
394 struct dma_setting {
402  u8 dir;
404  u32 src_addr;
406  u32 dst_addr;
408  u32 count;
412  struct dma_vfifo vfifo;
415 };
425 #ifdef __cplusplus
426 extern "C" {
427 #endif
428 
440 
452 int mtk_os_hal_dma_config(enum dma_channel chn, struct dma_setting *setting);
453 
463 int mtk_os_hal_dma_start(enum dma_channel chn);
464 
474 int mtk_os_hal_dma_stop(enum dma_channel chn);
475 
485 int mtk_os_hal_dma_pause(enum dma_channel chn);
486 
496 int mtk_os_hal_dma_resume(enum dma_channel chn);
497 
509 
525  dma_interrupt_callback callback, void *callback_data,
526  enum dma_interrupt_type isr_type);
527 
538 
553  enum dma_param_type param_type, u32 value);
554 
568  enum dma_param_type param_type);
569 
584 int mtk_os_hal_dma_update_swptr(enum dma_channel chn, u32 length_byte);
585 
598 int mtk_os_hal_dma_vff_read_data(enum dma_channel chn, u8 *buffer, u32 length);
599 
610 
620 int mtk_os_hal_dma_reset(enum dma_channel chn);
621 
632 
633 #ifdef __cplusplus
634 }
635 #endif
636 
645 #endif
u8 wrap_side
The side for using address-wrapping: source or destination, and only one side can activate address-wr...
Definition: os_hal_dma.h:314
u8 bw_transfer_en
Word to byte or byte to word transfer flag, only for HALF-SIZE DMA.
Definition: os_hal_dma.h:338
struct dma_vfifo vfifo
The VFF DMA specified setting.
Definition: os_hal_dma.h:412
u8 bw_limiter
Bandwidth limiter.
Definition: os_hal_dma.h:352
dma_control_mode specifies the DMA channel settings to control the DMA channel transfer mode...
Definition: os_hal_dma.h:330
HALF-SIZE DMA channel 7 as ISU3-RX.
Definition: os_hal_dma.h:173
dma_interrupt_type
DMA interrupt type definition.
Definition: os_hal_dma.h:249
The interrupt of data transfer completion, for FULL-SIZE DMA and HALF-SIZE DMA.
Definition: os_hal_dma.h:253
u8 src_inc_en
Source addresses automatically increase after every transfer, only for FULL-SIZE DMA and HALF-SIZE DM...
Definition: os_hal_dma.h:346
VFF DMA channel 17 as ISU2-TX.
Definition: os_hal_dma.h:189
int mtk_os_hal_dma_clr_dreq(enum dma_channel chn)
This function is used to clear dreq signal of DMA channel.
struct dma_control_mode ctrl_mode
The setting to control DMA hardware transfer mode.
Definition: os_hal_dma.h:414
u32 src_addr
The source address of data transfer.
Definition: os_hal_dma.h:404
HALF-SIZE DMA channel 4 as ISU2-TX.
Definition: os_hal_dma.h:167
FULL-SIZE DMA channel 12 as memory copy.
Definition: os_hal_dma.h:179
int mtk_os_hal_dma_alloc_chan(enum dma_channel chn)
This function is used to allocate one DMA channel.
u32 dst_addr
The destination address of data transfer.
Definition: os_hal_dma.h:406
int mtk_os_hal_dma_set_param(enum dma_channel chn, enum dma_param_type param_type, u32 value)
This function is used to set DMA parameter which is defined in the dma_param_type.
void * cb_data
The users data being used in callback function.
Definition: os_hal_dma.h:364
int mtk_os_hal_dma_pause(enum dma_channel chn)
This function is used to pause one DMA channel.
u8 wrap_en
Flag of transfer address-wrapping fucntion.
Definition: os_hal_dma.h:310
u8 dir
Transfer direction, only for HALF-SIZE DMA and VFF DMA.
Definition: os_hal_dma.h:402
The interrupt of the Virtual FIFO data threshold, only for Virtual FIFO DMA.
Definition: os_hal_dma.h:265
HALF-SIZE DMA channel 3 as ISU1-RX.
Definition: os_hal_dma.h:165
HALF-SIZE DMA channel 1 as ISU0-RX.
Definition: os_hal_dma.h:161
VFF DMA channel 29 as ADC-RX.
Definition: os_hal_dma.h:209
dma_setting specifies the DMA channel settings which control the DMA channel transfer.
Definition: os_hal_dma.h:394
u8 burst_type
Burst-type, only for FULL-SIZE DMA and HALF-SIZE DMA.
Definition: os_hal_dma.h:334
The byte count of data in Virtual FIFO, read-only for VFF DMA.
Definition: os_hal_dma.h:236
HALF-SIZE DMA channel 0 as ISU0-TX.
Definition: os_hal_dma.h:159
dma_interrupt_callback isr_cb
The interrupt callback function.
Definition: os_hal_dma.h:362
u32 timeout_cnt
Interrupt will assert if there is no new data into FIFO more than n T(Bus Clock)
Definition: os_hal_dma.h:387
VFF DMA channel 19 as ISU3-TX.
Definition: os_hal_dma.h:193
VFF DMA channel 13 as ISU0-TX.
Definition: os_hal_dma.h:181
The SW pointer of Virtual FIFO, Only for VFF DMA.
Definition: os_hal_dma.h:240
VFF DMA channel 18 as ISU2-RX.
Definition: os_hal_dma.h:191
int mtk_os_hal_dma_reset(enum dma_channel chn)
This function is used to reset DMA channel.
dma_channel
DMA channels definition.
Definition: os_hal_dma.h:157
int mtk_os_hal_dma_get_status(enum dma_channel chn)
This function is used to get DMA channel status.
VFF DMA channel 27 as I2S1-TX.
Definition: os_hal_dma.h:205
dma_interrupt indicates the callback function and users data of DMA hardware interrupts.
Definition: os_hal_dma.h:360
dma_vfifo specifies the specified settings of the VFF DMA, which are only used for the VFF DMA...
Definition: os_hal_dma.h:370
HALF-SIZE DMA channel 8 as ISU4-TX.
Definition: os_hal_dma.h:175
u8 alert_cmp_type
Specifies the Alert Length of Virtual FIFO DMA.
Definition: os_hal_dma.h:377
The programable address which indicates the memory address, for HALF-SIZE DMA and VFF DMA...
Definition: os_hal_dma.h:232
VFF DMA channel 16 as ISU1-RX.
Definition: os_hal_dma.h:187
VFF DMA channel 15 as ISU1-TX.
Definition: os_hal_dma.h:185
VFF DMA channel 21 as ISU4-TX.
Definition: os_hal_dma.h:197
u32 wrap_point
Wrap point from start address.
Definition: os_hal_dma.h:319
u8 transize
Data size within the confine of a bus cycle per transfer.
Definition: os_hal_dma.h:350
VFF DMA channel 22 as ISU4-RX.
Definition: os_hal_dma.h:199
int mtk_os_hal_dma_dump_register(enum dma_channel chn)
This function is used to dump DMA registers for debug.
VFF DMA channel 26 as I2S0-RX.
Definition: os_hal_dma.h:203
HALF-SIZE DMA channel 2 as ISU1-TX.
Definition: os_hal_dma.h:163
int mtk_os_hal_dma_update_swptr(enum dma_channel chn, u32 length_byte)
This function is used to update VFF DMA channel swptr.
int mtk_os_hal_dma_vff_read_data(enum dma_channel chn, u8 *buffer, u32 length)
This function is used to read data from FIFO of VFF DMA channel.
The fix address which indicates the data port of peripheral devices, for HALF-SIZE DMA and VFF DMA...
Definition: os_hal_dma.h:228
int mtk_os_hal_dma_release_chan(enum dma_channel chn)
This function is used to release one DMA channel.
u8 dst_inc_en
Destination addresses automatically increase after every transfer, only for FULL-SIZE DMA and HALF-SI...
Definition: os_hal_dma.h:342
u32 count
The total byte count of data transfer.
Definition: os_hal_dma.h:408
int mtk_os_hal_dma_register_isr(enum dma_channel chn, dma_interrupt_callback callback, void *callback_data, enum dma_interrupt_type isr_type)
This function is used to register interrupt callback.
dma_wrap specifies the DMA channel settings which control the address-wrap function for FULL-SIZE DMA...
Definition: os_hal_dma.h:306
int mtk_os_hal_dma_stop(enum dma_channel chn)
This function is used to stop one DMA channel.
int mtk_os_hal_dma_resume(enum dma_channel chn)
This function is used to resume one DMA channel.
int mtk_os_hal_dma_start(enum dma_channel chn)
This function is used to start one DMA channel.
The remain count of data transfer, read-only for FULL-SIZE DMA and HALF-SIZE DMA. ...
Definition: os_hal_dma.h:224
The Virtual FIFO Length, only for VFF DMA.
Definition: os_hal_dma.h:234
dma_param_type
DMA parameters type.
Definition: os_hal_dma.h:220
HALF-SIZE DMA channel 9 as ISU4-RX.
Definition: os_hal_dma.h:177
u8 interrupt_flag
The flag of DMA hardware interrupt, please refer to dma_interrupt_type.
Definition: os_hal_dma.h:398
HALF-SIZE DMA channel 5 as ISU2-RX.
Definition: os_hal_dma.h:169
VFF DMA channel 28 as I2S1-RX.
Definition: os_hal_dma.h:207
u8 reload_en
Reload transfer count flag, only for HALF-SIZE DMA.
Definition: os_hal_dma.h:410
u32 fifo_size
Virtual FIFO size.
Definition: os_hal_dma.h:383
int mtk_os_hal_dma_get_param(enum dma_channel chn, enum dma_param_type param_type)
This function is used to get DMA parameter which is defined in the dma_param_type.
void(* dma_interrupt_callback)(void *user_data)
This defines the function prototype of DMA interrupt service routines callback.
Definition: os_hal_dma.h:290
u32 fifo_thrsh
It specifies the threshold for DMA_INT_VFIFO_THRESHOLD.
Definition: os_hal_dma.h:375
VFF DMA channel 14 as ISU0-RX.
Definition: os_hal_dma.h:183
HALF-SIZE DMA channel 6 as ISU3-TX.
Definition: os_hal_dma.h:171
The HW pointer of Virtual FIFO, read-only for VFF DMA.
Definition: os_hal_dma.h:238
struct dma_wrap wrap_settings
The setting for address-wrap function.
Definition: os_hal_dma.h:354
u32 alert_len
Specifies the Compare Equation Between ALTLEN and FIFO_SIZE - FIFO_CNT.
Definition: os_hal_dma.h:381
The interrupt of the half of data transfer completion, only for HALF-SIZE DMA.
Definition: os_hal_dma.h:257
u32 wrap_to_addr
The address which DMA will wrap to.
Definition: os_hal_dma.h:324
The interrupt of the Virtual FIFO data updating timeout, only for Virtual FIFO DMA.
Definition: os_hal_dma.h:261
VFF DMA channel 25 as I2S0-TX.
Definition: os_hal_dma.h:201
VFF DMA channel 20 as ISU3-RX.
Definition: os_hal_dma.h:195
int mtk_os_hal_dma_config(enum dma_channel chn, struct dma_setting *setting)
This function is used to config one DMA channel.