// multi_axi4ls.c
// 2023/03/11 by marsee
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
int32_t multi_calc(int32_t *multi_axi4ls, int32_t a, int32_t b){
while((multi_axi4ls[0] &4) == 0) ; // wait ap_idle
multi_axi4ls[6] = a; // reg a, 0x18
multi_axi4ls[8] = b; // reg b, 0x20
multi_axi4ls[0] = 1; // ap_start = 1
while((multi_axi4ls[11] & 1) == 0) ; // wait c_ap_vld
return(multi_axi4ls[10]);
}
void main(){
int uio8_fd;
int32_t *multi_axi4ls;
int32_t a, b, c;
if((uio8_fd = open("/dev/uio8", O_RDWR)) == -1) {
printf("Can not open /dev/uio8\n");
exit(1);
}
multi_axi4ls = (uint32_t*)mmap(NULL, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, uio8_fd, 0);
for(a = 0, b = 1; a < 10; a++, b++){
c = multi_calc(multi_axi4ls, a, b);
printf("a = %d, b = %d, c = %d\n", a, b, c);
}
}
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
- | - | - | - | - | 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 | - | - | - | - | - | - |