URL
https://opencores.org/ocsvn/or1k_old/or1k_old/trunk
Subversion Repositories or1k_old
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 820 to Rev 821
- ↔ Reverse comparison
Rev 820 → Rev 821
/trunk/or1ksim/peripheral/16450.c
334,12 → 334,15
|
/* Simulation hook. Must be called every clock cycle to simulate all UART |
devices. It does internal functional UART simulation. */ |
void uart_clock16(int i) |
void uart_clock16 (int i) |
{ |
int retval; |
|
/* Schedule for later */ |
SCHED_ADD (uart_clock16, i, cycles + UART_CLOCK_DIVIDER); |
|
/* If VAPI is not selected, UART communicates with two file streams; |
if VAPI is selected, we use VAPI streams. */ |
|
/* if txfs is corrupted, skip this uart. */ |
if (!config.uarts[i].vapi_id && !uarts[i].txfs) return; |
|
348,7 → 351,7
if (!(uarts[i].vapi.cur_break = uarts[i].vapi.next_break)) |
uarts[i].istat.break_set = 0; |
} |
|
|
/***************** Transmit *****************/ |
if (!uarts[i].istat.txser_full) { |
// uarts[i].regs.lsr |= UART_LSR_TXBUFE; |
544,7 → 547,6
debug (4, "uarts[i].regs.iir = %i\t", uarts[i].regs.iir); |
report_interrupt(config.uarts[i].irq); |
} |
SCHED_ADD (uart_clock16, i, cycles + UART_CLOCK_DIVIDER); |
} |
|
/* Reset. It initializes all registers of all UART devices to zero values, |
597,6 → 599,7
uarts[i].regs.lcr = UART_LCR_RESET; |
uarts[i].vapi.cur_break = uarts[i].vapi.cur_break_cnt = uarts[i].vapi.next_break = 0; |
uarts[i].vapi.next_break_cnt = -1; |
printf ("%i\n", i); |
SCHED_ADD (uart_clock16, i, cycles + UART_CLOCK_DIVIDER); |
} |
} |
/trunk/or1ksim/support/sched.h
63,15 → 63,15
|
/* Adds new job to the queue */ |
#define SCHED_ADD(job_func, job_param, job_time) {\ |
int i;\ |
int ___i;\ |
if (SCHED_DEBUG > 0) printf ("%s@%i:SCHED_ADD(func %x, param %i, time %i)\n", __FUNCTION__, cycles, (job_func), (job_param), (job_time));\ |
SCHED_PRINT_JOBS();\ |
if (SCHED_DEBUG > 1) printf ("--------\n");\ |
i = scheduler.size++;\ |
while (i > 1 && scheduler.heap[i / 2].time > (job_time)) scheduler.heap[i] = scheduler.heap[i /= 2];\ |
scheduler.heap[i].func = (job_func);\ |
scheduler.heap[i].param = (job_param);\ |
scheduler.heap[i].time = (job_time);\ |
___i = scheduler.size++;\ |
while (___i > 1 && scheduler.heap[___i / 2].time > (job_time)) scheduler.heap[___i] = scheduler.heap[___i /= 2];\ |
scheduler.heap[___i].func = (job_func);\ |
scheduler.heap[___i].param = (job_param);\ |
scheduler.heap[___i].time = (job_time);\ |
SCHED_PRINT_JOBS();\ |
} |
|
78,19 → 78,19
/* Removes an item from the heap */ |
#define SCHED_REMOVE_ITEM(index) {\ |
struct sched_entry *tmp;\ |
int i = (index), j;\ |
if (SCHED_DEBUG > 0) printf ("%s@%i:SCHED_REMOVE%i(time %i)\n", __FUNCTION__, cycles, (index), scheduler.heap[i].time); \ |
int ___i = (index), ___j;\ |
if (SCHED_DEBUG > 0) printf ("%s@%i:SCHED_REMOVE%i(time %i)\n", __FUNCTION__, cycles, (index), scheduler.heap[___i].time); \ |
SCHED_PRINT_JOBS();\ |
if (SCHED_DEBUG > 1) printf ("--------\n");\ |
tmp = &scheduler.heap[--scheduler.size];\ |
while (i <= scheduler.size / 2) {\ |
j = 2 * i;\ |
if (j < scheduler.size && scheduler.heap[j].time > scheduler.heap[j + 1].time) j++;\ |
if (scheduler.heap[j].time >= tmp->time) break;\ |
scheduler.heap[i] = scheduler.heap[j];\ |
i = j;\ |
while (___i <= scheduler.size / 2) {\ |
___j = 2 * ___i;\ |
if (___j < scheduler.size && scheduler.heap[___j].time > scheduler.heap[___j + 1].time) ___j++;\ |
if (scheduler.heap[___j].time >= tmp->time) break;\ |
scheduler.heap[___i] = scheduler.heap[___j];\ |
___i = ___j;\ |
}\ |
scheduler.heap[i] = *tmp;\ |
scheduler.heap[___i] = *tmp;\ |
SCHED_PRINT_JOBS();\ |
} |
|