aboutsummaryrefslogtreecommitdiff
path: root/02-usart/tests/test_dma.c
blob: 770459007d13cf54c130f2cd698a029d344ed1ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#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;
}