3 * ________ _________ ____ / __ \/ ___/
4 * / ___/ _ \/ ___/ __ \/ __ \/ / / /\__ \
5 * / / / __/ /__/ /_/ / / / / /_/ /___/ /
6 * /_/ \___/\___/\____/_/ /_/\____//____/
8 * ======================================================================
10 * title: Architecture specific code - Microblaze, Linux
13 * author: Christoph RĂ¼thing, University of Paderborn
14 * description: Functions needed for ReconOS which are architecure
15 * specific and are implemented here.
17 * ======================================================================
21 #ifdef RECONOS_ARCH_microblaze
22 #ifdef RECONOS_OS_linux
26 #include "../../linux/driver/include/reconos.h"
31 #include <sys/ioctl.h>
34 #define PROC_CONTROL_DEV "/dev/reconos/proc-control"
37 /* == OSIF related functions ============================================ */
39 int reconos_osif_open(int num
) {
46 snprintf(dev
, 25, "/dev/reconos/osif-%d", num
);
47 fd
= open(dev
, O_RDWR
);
49 panic("[reconos_core] error while opening osif %d\n", num
);
54 uint32_t reconos_osif_read(int fd
) {
58 ret
= read(fd
, &data
, sizeof(data
));
60 panic("[reconos-core] error reading from osif\n");
65 void reconos_osif_write(int fd
, uint32_t data
) {
68 ret
= write(fd
, &data
, sizeof(data
));
70 panic("[reconos-core] error writing to osif\n");
73 void reconos_osif_close(int fd
) {
78 /* == Proc control related functions ==================================== */
80 int reconos_proc_control_open() {
83 fd
= open(PROC_CONTROL_DEV
, O_RDWR
);
85 panic("[reconos_core] error while opening proc control\n");
90 int reconos_proc_control_get_num_hwts(int fd
) {
93 ioctl(fd
, RECONOS_PROC_CONTROL_GET_NUM_HWTS
, &data
);
98 int reconos_proc_control_get_tlb_hits(int fd
) {
101 ioctl(fd
, RECONOS_PROC_CONTROL_GET_TLB_HITS
, &data
);
106 int reconos_proc_control_get_tlb_misses(int fd
) {
109 ioctl(fd
, RECONOS_PROC_CONTROL_GET_TLB_MISSES
, &data
);
114 uint32_t reconos_proc_control_get_fault_addr(int fd
) {
117 ioctl(fd
, RECONOS_PROC_CONTROL_GET_FAULT_ADDR
, &data
);
122 void reconos_proc_control_clear_page_fault(int fd
) {
123 ioctl(fd
, RECONOS_PROC_CONTROL_CLEAR_PAGE_FAULT
, NULL
);
126 void reconos_proc_control_set_pgd(int fd
) {
127 ioctl(fd
, RECONOS_PROC_CONTROL_SET_PGD_ADDR
, NULL
);
130 void reconos_proc_control_sys_reset(int fd
) {
131 ioctl(fd
, RECONOS_PROC_CONTROL_SYS_RESET
, NULL
);
134 void reconos_proc_control_hwt_reset(int fd
, int num
, int reset
) {
136 ioctl(fd
, RECONOS_PROC_CONTROL_SET_HWT_RESET
, &num
);
138 ioctl(fd
, RECONOS_PROC_CONTROL_CLEAR_HWT_RESET
, &num
);
141 void reconos_proc_control_cache_flush(int fd
) {
142 ioctl(fd
, RECONOS_PROC_CONTROL_CACHE_FLUSH
, NULL
);
145 void reconos_proc_control_close(int fd
) {
150 /* == Reconfiguration related functions ================================= */
152 int load_partial_bitstream(uint32_t *bitstream
, unsigned int bitstream_length
) {
153 panic("NOT IMPLEMENTED YET\n");
159 /* == Initialization function =========================================== */
161 void reconos_drv_init() {
162 // nothing to do here