diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2020-11-16 18:20:32 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2020-11-16 18:20:32 -0700 |
commit | 9f17335c19a6ae91a450e267b5313148644a7a14 (patch) | |
tree | f1ae946ada62148913a8cc10bc985f8de926a4a0 /02-usart/tests | |
parent | 4767c73fb2e1f96469fe24a83b443c1774b01d86 (diff) | |
download | stm32l4-9f17335c19a6ae91a450e267b5313148644a7a14.tar.gz stm32l4-9f17335c19a6ae91a450e267b5313148644a7a14.tar.bz2 stm32l4-9f17335c19a6ae91a450e267b5313148644a7a14.zip |
Add DMA header file which defines the DMA registers and add
testing_harness with fake environment to allow testing on x86
development machines.
Diffstat (limited to '02-usart/tests')
-rw-r--r-- | 02-usart/tests/test_dma.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/02-usart/tests/test_dma.c b/02-usart/tests/test_dma.c new file mode 100644 index 0000000..7c2127a --- /dev/null +++ b/02-usart/tests/test_dma.c @@ -0,0 +1,27 @@ +#include "test_harness.h" +#include "dma.h" + +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> + +TEST(dma, smoke) { + dma_t* dma = &DMA1; + memset(dma, sizeof(dma), 0); + + dma->is_bf.tcif1 = 1; + ASSERT_EQ(dma->is_r, 2); + + dma->is_bf.htif7 = 1; + ASSERT_EQ(dma->is_r, 67108866); +} + +TEST(dma, correct_align) +{ + dma_t dma; + + // Assert the DMA registers are aligned with what the spec says. + ASSERT_EQ((long)(&dma.csel_r) - (long)(&dma), 0xA8); + + return 0; +} |