Skip to content

Commit

Permalink
fix(dma): Add dma_demo makefile target.
Browse files Browse the repository at this point in the history
Add macro for dma_demo.
To run DMA demo, type:
make dma-demo
  • Loading branch information
arturum1 committed Jul 9, 2024
1 parent e6b6a8d commit 09db972
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 8 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ jobs:
run: make fpga-run RUN_LINUX=0 BOARD=CYCLONEV-GT-DK
- name: test linux
run: make test-linux-fpga-connect BOARD=CYCLONEV-GT-DK
- name: test dma
run: make dma-linux-fpga-connect BOARD=CYCLONEV-GT-DK

aes-ku040:
runs-on: self-hosted
Expand All @@ -119,8 +117,21 @@ jobs:
run: make fpga-run RUN_LINUX=0 BOARD=AES-KU040-DB-G
- name: test linux
run: make test-linux-fpga-connect BOARD=AES-KU040-DB-G

dma_demo:
runs-on: self-hosted
timeout-minutes: 90
# run even if previous job failed
if: ${{ !cancelled() }}
# run after indicated job
needs: [ aes-ku040 ]

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: test dma
run: make dma-linux-fpga-connect BOARD=AES-KU040-DB-G
run: make dma-demo

## doc:
## runs-on: self-hosted
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ dma-linux-fpga-connect: build_dir_name

.PHONY: setup sim-run sim-test fpga-test test-all test-linux-fpga-connect dma-linux-fpga-connect

# Run this target to configure system for a DMA data transfer demo in linux and run it on a FPGA.
dma-demo:
# Try to setup, so that it generates correct linux_build_macros.txt (ignore errors as well)
-make setup DMA_DEMO=1
make build-linux-files DMA_DEMO=1
make fpga-run RUN_LINUX=0 DMA_DEMO=1
make dma-linux-fpga-connect

.PHONY: dma-demo

#
# Linux targets
#
Expand Down
11 changes: 11 additions & 0 deletions iob_soc_opencryptolinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,17 @@ def _post_setup(cls):

@classmethod
def _setup_confs(cls, extra_confs=[]):
if DMA_DEMO:
extra_confs += [
{
"name": "DMA_DEMO",
"type": "M",
"val": True,
"min": "0",
"max": "1",
"descr": "Enable DMA demo",
},
]
# Append confs or override them if they exist
super()._setup_confs(
[
Expand Down
10 changes: 5 additions & 5 deletions software/src/iob_soc_opencryptolinux_firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "plic.h"
#include "printf.h"
#include <string.h>
#ifdef DMA_DEMO
#ifdef IOB_SOC_OPENCRYPTOLINUX_DMA_DEMO
#include "iob-dma.h"
#include "iob-axistream-in.h"
#include "iob-axistream-out.h"
Expand Down Expand Up @@ -123,7 +123,7 @@ int main() {
eth_init(ETH0_BASE, &clear_cache);
eth_wait_phy_rst();

#ifdef DMA_DEMO
#ifdef IOB_SOC_OPENCRYPTOLINUX_DMA_DEMO
// init dma
dma_init(DMA0_BASE);
// init axistream
Expand All @@ -145,7 +145,7 @@ int main() {

printf("\n\n\nHello world!\n\n\n");

#ifdef DMA_DEMO
#ifdef IOB_SOC_OPENCRYPTOLINUX_DMA_DEMO
send_axistream();
receive_axistream();
#endif
Expand Down Expand Up @@ -368,7 +368,7 @@ static void irq_entry(void) {
#pragma GCC pop_options


#ifdef DMA_DEMO
#ifdef IOB_SOC_OPENCRYPTOLINUX_DMA_DEMO
void send_axistream() {
uint8_t i;
uint8_t words_in_byte_stream = 4;
Expand Down Expand Up @@ -419,4 +419,4 @@ void receive_axistream() {

free((uint32_t *)byte_stream);
}
#endif // DMA_DEMO
#endif // IOB_SOC_OPENCRYPTOLINUX_DMA_DEMO

0 comments on commit 09db972

Please sign in to comment.