Skip to content

Commit

Permalink
req_ready check in test
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoqun-liang committed Oct 29, 2024
1 parent 8c25a3a commit 2ebc5c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sw/tests/ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@ int main(void) {
// Destination Protocol
*reg32(ETH_BASE, IDMA_DST_PROTO_OFFSET) = 0x5;

while(!(*reg32(ETH_BASE, IDMA_REQ_READY_OFFSET)));
// Validate Request to DMA
*reg32(ETH_BASE, IDMA_REQ_VALID_OFFSET) = 0x1;

// configure ethernet
*reg32(ETH_BASE, MACLO_OFFSET) = 0x89000123;
*reg32(ETH_BASE, MACHI_OFFSET) = 0x00800207;
// rx irq
while (!(*reg32(PLIC_BASE, RV_PLIC_IP_0_OFFSET)) & (1 << 19) );
while (!((*reg32(PLIC_BASE, RV_PLIC_IP_0_OFFSET)) & (1 << 19) ));
// dma length ready, dma can be configured now
while (!(*reg32(ETH_BASE,IDMA_RX_EN_OFFSET)));

Expand All @@ -97,6 +98,7 @@ int main(void) {
*reg32(ETH_BASE, IDMA_DST_PROTO_OFFSET) = 0x0;
*reg32(ETH_BASE, IDMA_REQ_VALID_OFFSET) = 0x1;

while(!(*reg32(ETH_BASE, IDMA_REQ_READY_OFFSET)));
// wait until DMA moves all data
while (!(*reg32(ETH_BASE, IDMA_RSP_VALID_OFFSET)));

Expand Down

0 comments on commit 2ebc5c6

Please sign in to comment.