diff options
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; +} |