File: t1068-2.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (53 lines) | stat: -rw-r--r-- 1,560 bytes parent folder | download | duplicates (10)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* { dg-do compile } */
/* { dg-options "-O2 -fno-common" } */
/* ??? we should be able to get down to 4 movt, but first we'll have to
   teach mov2add about flag handling.  Maybe add the code that was removed in
   r144425 from regmove to postreload; epiphany needs tweaks to the addsi3
   expander to generate a CC reg clobber in the pass.  */
/* { dg-final { scan-assembler-times "movt" 6 } } */

typedef unsigned int uint32_t;
typedef unsigned int uint16_t;

struct dma_desc {
   uint32_t config;
   uint32_t inner_stride;
   uint32_t count;
   uint32_t outer_stride;
   void *src_addr;
   void *dst_addr;
};
typedef struct dma_desc e_dma_desc_t;

e_dma_desc_t dma;
int a;
int id[8];
#define NULL ((void *)0)

static inline void _ez_dma_set(register e_dma_desc_t  *dma,
                uint32_t config,
                e_dma_desc_t *next,
                uint16_t inner_src, uint16_t inner_dst,
                uint16_t inner_count, uint16_t outer_count,
                uint16_t outer_src, uint16_t outer_dst,
                void *src, void*dst) {
   //register e_dma_desc_t *dmap = dma;

   dma->config = config | (((uint32_t)next)<<16);
   dma->inner_stride = (inner_dst << 16) | inner_src;
   dma->count = (inner_count << 16) | outer_count;
   dma->outer_stride = (outer_dst << 16) | outer_src;
   dma->src_addr = src;
   dma->dst_addr = dst;
}

void __attribute__((section(".text.ds1")))
dmas_inline1(void) {
   register e_dma_desc_t *dmap = &dma;

   _ez_dma_set(dmap, 3, NULL,
          1, 2,
          12, 13,
          5, 1,
          id, &a);
}