OpenCores
URL https://opencores.org/ocsvn/minsoc/minsoc/trunk

Subversion Repositories minsoc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /minsoc/trunk/sw/support
    from Rev 36 to Rev 11
    Reverse comparison

Rev 36 → Rev 11

/Makefile.inc
4,7 → 4,7
 
#GCC_LIB_OPTS= -lgcc -liberty
 
GCC_OPT=-mhard-mul -g -nostdlib
GCC_OPT=-mhard-mul -g
 
ifdef UART_PRINTF
GCC_OPT += -DUART_PRINTF
/except.S
64,7 → 64,7
 
l.movhi r9,hi(end_except) //set return addr to end_except instruction
l.ori r9,r9,lo(end_except) //set return addr to end_except instruction
l.j _tick_except
l.j _lpint_except
l.nop
 
.org 0x400
106,7 → 106,7
 
l.movhi r9,hi(end_except) //set return addr to end_except instruction
l.ori r9,r9,lo(end_except) //set return addr to end_except instruction
l.j _ext_except //jmp to C interrupt handler (returns later to end_except)
l.j _hpint_except //jmp to C interrupt handler (returns later to end_except)
l.nop
 
 
/uart.c
29,7 → 29,7
 
void uart_init(void)
{
int divisor;
int devisor;
/* Reset receiver and transmiter */
/* Set RX interrupt for each byte */
36,16 → 36,16
REG8(UART_BASE + UART_FCR) = UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT | UART_FCR_TRIGGER_1;
/* Enable RX interrupt */
REG8(UART_BASE + UART_IER) = UART_IER_RDI | UART_IER_THRI;
REG8(UART_BASE + UART_IER) = 0x01;
/* Set 8 bit char, 1 stop bit, no parity */
REG8(UART_BASE + UART_LCR) = UART_LCR_WLEN8 & ~(UART_LCR_STOP | UART_LCR_PARITY);
/* Set baud rate */
divisor = IN_CLK/(16 * UART_BAUD_RATE);
devisor = IN_CLK/(16 * UART_BAUD_RATE);
REG8(UART_BASE + UART_LCR) |= UART_LCR_DLAB;
REG8(UART_BASE + UART_DLL) = divisor & 0x000000ff;
REG8(UART_BASE + UART_DLM) = (divisor >> 8) & 0x000000ff;
REG8(UART_BASE + UART_DLL) = devisor & 0x000000ff;
REG8(UART_BASE + UART_DLM) = (devisor >> 8) & 0x000000ff;
REG8(UART_BASE + UART_LCR) &= ~(UART_LCR_DLAB);
return;
/support.c
15,9 → 15,24
#endif
 
#if OR32
void excpt_dummy();
void int_main();
 
void ext_except()
unsigned long excpt_buserr = (unsigned long) excpt_dummy;
unsigned long excpt_dpfault = (unsigned long) excpt_dummy;
unsigned long excpt_ipfault = (unsigned long) excpt_dummy;
unsigned long excpt_tick = (unsigned long) excpt_dummy;
unsigned long excpt_align = (unsigned long) excpt_dummy;
unsigned long excpt_illinsn = (unsigned long) excpt_dummy;
unsigned long excpt_int = (unsigned long) int_main;
unsigned long excpt_dtlbmiss = (unsigned long) excpt_dummy;
unsigned long excpt_itlbmiss = (unsigned long) excpt_dummy;
unsigned long excpt_range = (unsigned long) excpt_dummy;
unsigned long excpt_syscall = (unsigned long) excpt_dummy;
unsigned long excpt_break = (unsigned long) excpt_dummy;
unsigned long excpt_trap = (unsigned long) excpt_dummy;
 
void hpint_except()
{
int_main();
}
44,7 → 59,7
#define PRINTFBUFFER_SIZE 512
char PRINTFBUFFER[PRINTFBUFFER_SIZE]; // Declare a global printf buffer
 
void minsoc_printf(const char *fmt, ...)
void printf(const char *fmt, ...)
{
// init uart if not done already
if (!uart_init_done)
67,11 → 82,12
uart_putc(PRINTFBUFFER[c++]);
va_end(args);
}
 
#else
/* activate printf support in simulator */
void minsoc_printf(const char *fmt, ...)
void printf(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
165,3 → 181,6
}
 
#endif
 
 
void excpt_dummy() {}
/vfnprintf.c
96,7 → 96,7
 
// INCLUDES
 
//#include <stdlib.h> // For mbtowc()
#include <stdlib.h> // For mbtowc()
#include <stddef.h>
 
 
113,6 → 113,9
CYG_MACRO_END
 
#include <stdarg.h> // Variable argument definitions
//#include <stdio.h> // Standard header for all stdio files
#include <string.h> // memchr() and strlen() functions
//#include <cyg/libc/stdio/stream.hxx> // C library streams
 
#include "vfnprintf.h"
 
147,31 → 150,7
#define FPT 0x100 /* Floating point number */
#define SIZET 0x200 /* size_t */
 
int
strlen(const char *s)
{
const char *p;
 
for (p = s; *p != '\0'; p++)
;
return (s - p);
}
 
void *
memcpy(void *dst, const void *src, size_t len)
{
const char *csrc;
char *cdst;
int i;
 
cdst = dst;
csrc = src;
for (i = len; i >= 0; i--) {
cdst[i] = csrc[i];
}
return dst;
}
 
// Function which prints back to the buffer, ptr, len bytes
// returns 1 if it should finish up, otherwise 0 to continue
int print_back_to_string(char * ptr, int len, size_t * n, int * ret, char ** stream)
/support.h
16,7 → 16,7
#define REG16(add) *((volatile unsigned short *)(add))
#define REG32(add) *((volatile unsigned long *)(add))
 
void or32_printf(const char *fmt, ...);
void printf(const char *fmt, ...);
 
/* For writing into SPR. */
void mtspr(unsigned long spr, unsigned long value);
30,8 → 30,6
 
#endif /* OR1K */
 
#define printf or32_printf
 
/* Function to be called at entry point - not defined here. */
int main ();
 
65,5 → 63,4
extern unsigned long excpt_break;
extern unsigned long excpt_trap;
 
 
#endif /* SUPPORT_H */
#endif
/board.h
21,11 → 21,6
#define UART_IRQ 2
#define ETH_BASE 0x92000000
#define ETH_IRQ 4
#define I2C_BASE 0x9D000000
#define I2C_IRQ 3
#define CAN_BASE 0x94000000
#define CAN_IRQ 5
 
#define MC_BASE_ADDR 0x60000000
#define SPI_BASE 0xa0000000
 
/Makefile
1,3 → 1,5
include Makefile.inc
 
all: libsupport.a reset-nocache.o reset-ic.o reset-dc.o reset-icdc.o
 
libsupport.a: support.o int.o except.o uart.o vfnprintf.o
33,5 → 35,3
 
int.o: int.c
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) -c -o $@ $?
 
include Makefile.inc

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.