5 #ifndef OPENTITAN_SW_DEVICE_LIB_DIF_DIF_DMA_H_
6 #define OPENTITAN_SW_DEVICE_LIB_DIF_DIF_DMA_H_
17 #include "sw/device/lib/dif/autogen/dif_dma_autogen.h"
24 typedef enum dif_dma_address_space_id {
26 kDifDmaOpentitanInternalBus = 0x07,
30 kDifDmaSoCControlRegisterBus = 0x0a,
33 kDifDmaSoCSystemBus = 0x09,
34 } dif_dma_address_space_id_t;
37 typedef enum dif_dma_transaction_width {
39 kDifDmaTransWidth1Byte = 0x00,
41 kDifDmaTransWidth2Bytes = 0x01,
43 kDifDmaTransWidth4Bytes = 0x02,
44 } dif_dma_transaction_width_t;
47 typedef enum dif_dma_transaction_opcode {
49 kDifDmaCopyOpcode = 0x00,
51 kDifDmaSha256Opcode = 0x01,
53 kDifDmaSha384Opcode = 0x02,
55 kDifDmaSha512Opcode = 0x03,
56 } dif_dma_transaction_opcode_t;
63 dif_dma_address_space_id_t asid;
89 dif_dma_transaction_width_t width;
141 dif_dma_transaction_opcode_t opcode);
209 typedef enum dif_dma_status_code {
211 kDifDmaStatusBusy = 0x01 << DMA_STATUS_BUSY_BIT,
213 kDifDmaStatusDone = 0x01 << DMA_STATUS_DONE_BIT,
215 kDifDmaStatusAborted = 0x01 << DMA_STATUS_ABORTED_BIT,
218 kDifDmaStatusError = 0x01 << DMA_STATUS_ERROR_BIT,
220 kDifDmaStatusSha2DigestValid = 0x01 << DMA_STATUS_SHA2_DIGEST_VALID_BIT,
222 kDifDmaStatusChunkDone = 0x01 << DMA_STATUS_CHUNK_DONE_BIT,
223 } dif_dma_status_code_t;
269 dif_dma_status_code_t flag);
271 typedef enum dif_dma_error_code {
273 kDifDmaErrorNone = 0x00,
275 kDifDmaErrorSourceAddress = 0x01 << 0,
277 kDifDmaErrorDestinationAddress = 0x01 << 1,
279 kDifDmaErrorOpcode = 0x01 << 2,
281 kDifDmaErrorSize = 0x01 << 3,
283 kDifDmaErrorBus = 0x01 << 4,
285 kDifDmaErrorEnableMemoryConfig = 0x01 << 5,
287 kDifDmaErrorRangeValid = 0x01 << 6,
289 kDifDmaErrorInvalidAsid = 0x01 << 7,
290 } dif_dma_error_code_t;
301 dif_dma_error_code_t *error);
311 uint32_t *digest_len);
322 dif_dma_transaction_opcode_t opcode,
335 uint32_t enable_state);
347 uint32_t clear_state);
361 uint32_t clear_irq_bus);
368 kDifDmaIntrClearIdx0 = 0x0,
369 kDifDmaIntrClearIdx1 = 0x4,
370 kDifDmaIntrClearIdx2 = 0x8,
371 kDifDmaIntrClearIdx3 = 0xC,
372 kDifDmaIntrClearIdx4 = 0x10,
373 kDifDmaIntrClearIdx5 = 0x14,
374 kDifDmaIntrClearIdx6 = 0x18,
375 kDifDmaIntrClearIdx7 = 0x1C,
376 kDifDmaIntrClearIdx8 = 0x20,
377 kDifDmaIntrClearIdx9 = 0x24,
378 kDifDmaIntrClearIdx10 = 0x28,
391 uint32_t intr_src_addr);
404 uint32_t intr_src_value);