URL
https://opencores.org/ocsvn/or1k/or1k/trunk
[/] [or1k/] [trunk/] [or1ksim/] [tick/] [tick.c] - Diff between revs 167 and 189
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 167 |
Rev 189 |
Line 25... |
Line 25... |
#include <stdio.h>
|
#include <stdio.h>
|
#include <string.h>
|
#include <string.h>
|
|
|
#include "tick.h"
|
#include "tick.h"
|
#include "../cpu/or1k/spr_defs.h"
|
#include "../cpu/or1k/spr_defs.h"
|
#include "../cpu/or1k/sprs.h"
|
|
#include "pic.h"
|
#include "pic.h"
|
|
#include "sprs.h"
|
|
|
/* For mode 10 only: timer stops until we write into TTCR. */
|
/* For mode 10 only: timer stops until we write into TTCR. */
|
int tt_stopped = 0;
|
int tt_stopped = 0;
|
|
|
/* Reset. It initializes TTCR register. */
|
/* Reset. It initializes TTCR register. */
|
Line 54... |
Line 54... |
|
|
if (!(ttmr & SPR_TTMR_M) || tt_stopped)
|
if (!(ttmr & SPR_TTMR_M) || tt_stopped)
|
return;
|
return;
|
|
|
if ((ttcr & SPR_TTCR_PERIOD) == (ttmr & SPR_TTMR_PERIOD)) {
|
if ((ttcr & SPR_TTCR_PERIOD) == (ttmr & SPR_TTMR_PERIOD)) {
|
|
int mode = (ttmr & SPR_TTMR_M) >> 30; /* CZ 04/09/01 */
|
|
|
if (ttmr & SPR_TTMR_IE) {
|
if (ttmr & SPR_TTMR_IE) {
|
setsprbits(SPR_TTMR, SPR_TTMR_IP, 1);
|
setsprbits(SPR_TTMR, SPR_TTMR_IP, 1);
|
report_interrupt(INT_TICK);
|
report_interrupt(INT_TICK);
|
}
|
}
|
|
|
if ((ttmr & SPR_TTMR_M) >> 30 == 1) {
|
/* Handle the modes properly.. CZ 04/09/01 */
|
/* Mode 01: Restart timer. */
|
switch(mode)
|
|
{
|
|
case 0: /* Timer is disabled */
|
|
tt_stopped = 1;
|
|
break;
|
|
case 1: /* Timer should auto restart */
|
ttcr = 0;
|
ttcr = 0;
|
mtspr(SPR_TTCR, ttcr);
|
mtspr(SPR_TTCR, ttcr);
|
return;
|
break;
|
} else if ((ttmr & SPR_TTMR_M) >> 30 == 2) {
|
case 2: /* Pause the timer */
|
/* Mode 10: Temporarly stop timer. */
|
|
tt_stopped = 1;
|
tt_stopped = 1;
|
return;
|
break;
|
|
case 3: /* Timer keeps running */
|
|
break;
|
}
|
}
|
}
|
}
|
if (!tt_stopped)
|
if (!tt_stopped)
|
ttcr++;
|
ttcr++;
|
mtspr(SPR_TTCR, ttcr);
|
mtspr(SPR_TTCR, ttcr);
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.