fifodma.h (5072B)
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: fifodma.h 8 * Purpose: Maps out structures used for FIFO DMA operations and 9 * exports routines. 10 */ 11 12 #ifndef _SOC_FIFODMA_H 13 #define _SOC_FIFODMA_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_l2mod_sbus_fifo_field_set 24 * obtain l2 mod sbus field set 25 * 26 * @param unit [in] unit # 27 * @param field [in] field 28 * @param enable [in] enable 29 * 30 * @returns SOC_E_BUSY 31 * @returns SOC_E_NONE 32 * 33 * @end 34 */ 35 36 extern int 37 soc_l2mod_sbus_fifo_field_set(int unit, soc_field_t field, int enable); 38 39 /******************************************* 40 * @function soc_l2mod_sbus_fifo_field_get 41 * obtain l2 mod sbus field get 42 * 43 * @param unit [in] unit # 44 * @param field [in] field 45 * @param enable [in] enable 46 * 47 * @returns SOC_E_BUSY 48 * @returns SOC_E_NONE 49 * 50 * @end 51 */ 52 53 extern int 54 soc_l2mod_sbus_fifo_field_get(int unit, soc_field_t field, int *enable); 55 56 /******************************************* 57 * @function soc_fifodma_stop 58 * purpose to stop fifo dma channel 59 * 60 * @param unit [in] unit # 61 * @param chan [in] channel number 62 * 63 * @returns SOC_E_BUSY 64 * @returns SOC_E_NONE 65 * 66 * @end 67 */ 68 extern int 69 soc_fifodma_stop(int unit, int chan); 70 71 /******************************************* 72 * @function soc_fifodma_start 73 * purpose to start fifo dma channel 74 * 75 * @param unit [in] unit # 76 * @param ch [in] channel number 77 * 78 * @returns SOC_E_PARAM 79 * @returns SOC_E_NONE 80 * 81 * @end 82 */ 83 extern int 84 soc_fifodma_start(int unit, int chan, int is_mem, 85 soc_mem_t mem, soc_reg_t reg, 86 int copyno, int force_entry_size, 87 int host_entries, void *host_buf); 88 89 /******************************************* 90 * @function soc_fifodma_intr_enable 91 * purpose to enable interrupt 92 * 93 * @param unit [in] unit # 94 * @param ch [in] channel 95 * 96 * @returns SOC_E_BUSY 97 * @returns SOC_E_NONE 98 * 99 * @end 100 */ 101 extern int 102 soc_fifodma_intr_enable(int unit, int ch); 103 104 /******************************************* 105 * @function soc_fifodma_intr_disable 106 * purpose to enable interrupt 107 * 108 * @param unit [in] unit # 109 * @param ch [in] channel 110 * 111 * @returns SOC_E_BUSY 112 * @returns SOC_E_NONE 113 * 114 * @end 115 */ 116 extern int 117 soc_fifodma_intr_disable(int unit, int ch); 118 119 /******************************************* 120 * @function soc_fifodma_get_read_ptr 121 * purpose to get read ptr 122 * 123 * @param unit [in] unit # 124 * 125 * @returns SOC_E_BUSY 126 * @returns SOC_E_NONE 127 * 128 * @end 129 */ 130 extern int 131 soc_fifodma_get_read_ptr(int unit, int chan, void **host_ptr, int *count); 132 133 /******************************************* 134 * @function soc_fifodma_advance_read_ptr 135 * purpose to advance read ptr 136 * 137 * @param unit [in] unit # 138 * 139 * @returns SOC_E_BUSY 140 * @returns SOC_E_NONE 141 * 142 * @end 143 */ 144 extern int 145 soc_fifodma_advance_read_ptr(int unit, int chan, int count); 146 147 /******************************************* 148 * @function soc_fifodma_set_entries_read 149 * purpose to set entries read 150 * 151 * @param unit [in] unit # 152 * 153 * @returns SOC_E_BUSY 154 * @returns SOC_E_NONE 155 * 156 * @end 157 */ 158 extern int 159 soc_fifodma_set_entries_read(int unit, int chan, uint32 num); 160 161 /******************************************* 162 * @function soc_fifodma_num_entries_get 163 * purpose to get number of entries 164 * 165 * @param unit [in] unit # 166 * 167 * @returns SOC_E_BUSY 168 * @returns SOC_E_NONE 169 * 170 * @end 171 */ 172 extern int 173 soc_fifodma_num_entries_get(int unit, int chan, int *count); 174 175 /******************************************* 176 * @function soc_fifodma_status_get 177 * purpose to obtain fifo dma channel status 178 * 179 * @param unit [in] unit # 180 * @param chan [in] channel number 181 * 182 * @returns SOC_E_BUSY 183 * @returns SOC_E_NONE 184 * 185 * @end 186 */ 187 extern int 188 soc_fifodma_status_get(int unit, int chan, uint32 *status); 189 190 /******************************************* 191 * @function soc_fifodma_ch_endian_set 192 * purpose to set fifo dma channel endianness 193 * 194 * @param unit [in] unit # 195 * @param chan [in] channel number 196 * @param ch [in] big_endian 197 * 198 * @returns SOC_E_BUSY 199 * @returns SOC_E_NONE 200 * 201 * @end 202 */ 203 extern int 204 soc_fifodma_ch_endian_set(int unit, int channel, int be); 205 206 /******************************************* 207 * @function soc_fifodma_status_clear 208 * purpose to clear fifo dma channel status 209 * 210 * @param unit [in] unit # 211 * @param chan [in] channel number 212 * 213 * @returns SOC_E_BUSY 214 * @returns SOC_E_NONE 215 * 216 * @end 217 */ 218 extern int 219 soc_fifodma_status_clear(int unit, int chan); 220 221 /******************************************* 222 * @function soc_fifodma_masks_get 223 * purpose to obtain fifodma masks 224 * 225 * @param unit [in] unit # 226 * @param chan [in] channel number 227 * 228 * @returns SOC_E_BUSY 229 * @returns SOC_E_NONE 230 * 231 * @end 232 */ 233 extern int 234 soc_fifodma_masks_get(int unit, uint32 *hostmem_timeout, uint32 *hostmem_overflow, uint32 *error, uint32 *done); 235 236 extern int 237 soc_fifodma_init(int unit); 238 239 extern int 240 soc_fifodma_deinit(int unit); 241 242 #endif /* !_SOC_FIFODMA_H */