source: branches/reconfiguration/modules/vci_cc_vcache_wrapper/caba/test/simple_wdt_test/main.c @ 850

Last change on this file since 850 was 850, checked in by cfuguet, 9 years ago

reconf: introducing a softs directory in the reconfiguration branch

  • This softs directory contains a minimalistic (giet-like) library of drivers and some utility functions.
  • Introducing a simple unit test in the vci_cc_vcache_wrapper component to test the newly introduced watchdog timer mechanism. This unit test uses the minimalistic library.
  • Property svn:executable set to *
File size: 861 bytes
Line 
1#include "stdio.h"
2#include "cpu.h"
3#include "hard_config.h"
4#include "io.h"
5#include "simhelper.h"
6#include "cpu_registers.h"
7
8void exception_handler()
9{
10    printf("exception_handler(): pid %d\n", cpu_procid());
11
12    int error = 0;
13    if (cpu_get_cr_exccode() != CR_DBE) {
14        printf("error: exccode should be DBE");
15        error = 1;
16    }
17    if (cpu_get_mmu_detr() != MMU_READ_DATA_TIMEOUT) {
18        printf("error: mmu data exception type should be WDT timeout");
19        error = 1;
20    }
21    if (error == 0) {
22        printf("success");
23    }
24    simh_stop_simulation();
25}
26
27void main(void)
28{
29    cpu_set_wdt_max(500);
30
31    /*
32     * Cause a WDT timeout exception
33     * Trying to read a memory location of another (non-existent) cluster
34     */
35    ioread32(0xFF00000000ULL);
36}
37
38/*
39 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
40 */
Note: See TracBrowser for help on using the repository browser.