ccmdma.h (2749B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * File: ccmdma.h 8 * Purpose: Maps out structures used for CCMDMA operations and 9 * exports routines. 10 */ 11 12 #ifndef _SOC_CCMDMA_H 13 #define _SOC_CCMDMA_H 14 15 #include <soc/defs.h> 16 #include <soc/types.h> 17 #include <sal/types.h> 18 #include <sal/core/time.h> 19 #include <sal/core/sync.h> 20 #include <sal/core/thread.h> 21 22 /******************************************* 23 * @function soc_ccmdma_ch_get 24 * purpose get idle DMA channel 25 * 26 * @param unit [in] unit # 27 * @param vchan [out] channel number 28 * 29 * @returns SOC_E_BUSY 30 * @returns SOC_E_NONE 31 * 32 * @end 33 */ 34 extern int 35 soc_ccmdma_ch_get(int unit, int *vchan); 36 37 /******************************************* 38 * @function soc_ccmdma_ch_put 39 * purpose put back the channel on free list 40 * 41 * @param ch [in] channel number 42 * 43 * @returns SOC_E_PARAM 44 * @returns SOC_E_NONE 45 * 46 * @end 47 */ 48 extern int 49 soc_ccmdma_ch_put(int unit, int vchan); 50 51 /******************************************* 52 * @function soc_ccmdma_copy_wait 53 * purpose to initiate DMA from source to 54 * destination memory on vchan 55 * @param vchan [in] channel number 56 * 57 * @returns SOC_E_XXXX 58 * @returns SOC_E_NONE 59 * 60 * @end 61 */ 62 extern int 63 soc_ccmdma_copy_wait(int unit, int vchan); 64 65 /******************************************* 66 * @function soc_ccmdma_copy 67 * purpose to initiate DMA from source to 68 * destination memory on vchan 69 * @param srcbuf [in] pointer to source memory 70 * @param dstbuf [in] pointer to dest memory 71 * @param src_is_internal [in] is src an internal memory 72 * @param dst_is_internal [in] is dst an internal memory 73 * @param count [in] number of bytes to xfer 74 * @param flags [in] 75 * @param vchan [in] channel number 76 * 77 * @returns SOC_E_XXXX 78 * @returns SOC_E_NONE 79 * 80 * @end 81 */ 82 extern int 83 soc_ccmdma_copy(int unit, sal_paddr_t *srcbuf, sal_paddr_t *dstbuf, 84 unsigned int src_is_internal, unsigned int dst_is_internal, 85 int count, int flags, int vchan); 86 /******************************************* 87 * @function soc_ccmdma_abort 88 * purpose to abort active DMA operation on 89 * given channel 90 * @param vchan [in] channel number 91 * 92 * @returns SOC_E_XXXX 93 * @returns SOC_E_NONE 94 * 95 * @end 96 */ 97 extern int 98 soc_ccmdma_abort(int unit, int vchan); 99 100 /******************************************* 101 * @function soc_ccmdma_clean 102 * purpose to clean 103 * @param max_cmc [in] number of cmc 104 * 105 * @returns SOC_E_XXXX 106 * @returns SOC_E_NONE 107 * 108 * @end 109 */ 110 extern int 111 soc_ccmdma_clean(int unit, int max_cmc); 112 113 extern int 114 soc_ccmdma_init(int unit); 115 116 extern int 117 soc_ccmdma_deinit(int unit); 118 119 #endif /* !_SOC_CCMDMA_H */