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

Subversion Repositories altor32

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /altor32
    from Rev 22 to Rev 21
    Reverse comparison

Rev 22 → Rev 21

/trunk/sw/rtos_example/makefile File deleted \ No newline at end of file
/trunk/sw/rtos_example/libstd.a Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
trunk/sw/rtos_example/libstd.a Property changes : Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: trunk/sw/rtos_example/mem_map.h =================================================================== --- trunk/sw/rtos_example/mem_map.h (revision 22) +++ trunk/sw/rtos_example/mem_map.h (nonexistent) @@ -1,55 +0,0 @@ -#ifndef __MEM_MAP_H__ -#define __MEM_MAP_H__ - -//----------------------------------------------------------------- -// Defines: -//----------------------------------------------------------------- -#define INT_BASE 0x00000000 -#define EXT_BASE 0x10000000 -#define IO_BASE 0x20000000 - -//----------------------------------------------------------------- -// Macros: -//----------------------------------------------------------------- -#define REG8 (volatile unsigned char*) -#define REG16 (volatile unsigned short*) -#define REG32 (volatile unsigned int*) - -//----------------------------------------------------------------- -// Peripheral Base Addresses -//----------------------------------------------------------------- -#define UART_BASE 0x20000000 -#define TIMER_BASE 0x20000100 -#define INTR_BASE 0x20000200 -#define SPI_FLASH_BASE 0x20000300 - -//----------------------------------------------------------------- -// Interrupts -//----------------------------------------------------------------- -#define IRQ_UART_RX 0 -#define IRQ_TIMER_SYSTICK 1 -#define IRQ_TIMER_HIRES 2 - -//----------------------------------------------------------------- -// Peripheral Registers -//----------------------------------------------------------------- - -#define UART_USR (*(REG32 (UART_BASE + 0x4))) -#define UART_UDR (*(REG32 (UART_BASE + 0x8))) - -#define TIMER_VAL (*(REG32 (TIMER_BASE + 0x0))) -#define SYS_CLK_COUNT (*(REG32 (TIMER_BASE + 0x4))) - -#define IRQ_MASK (*(REG32 (INTR_BASE + 0x00))) -#define IRQ_MASK_SET (*(REG32 (INTR_BASE + 0x00))) -#define IRQ_MASK_CLR (*(REG32 (INTR_BASE + 0x04))) -#define IRQ_STATUS (*(REG32 (INTR_BASE + 0x08))) - #define IRQ_SYSTICK (IRQ_TIMER_SYSTICK) - -#define SPI_PROM_CTRL (*(REG32 (SPI_FLASH_BASE + 0x00))) - #define SPI_PROM_CS (1 << 0) -#define SPI_PROM_STAT (*(REG32 (SPI_FLASH_BASE + 0x00))) - #define SPI_PROM_BUSY (1 << 0) -#define SPI_PROM_DATA (*(REG32 (SPI_FLASH_BASE + 0x04))) - -#endif Index: trunk/sw/rtos_example/irq.h =================================================================== --- trunk/sw/rtos_example/irq.h (revision 22) +++ trunk/sw/rtos_example/irq.h (nonexistent) @@ -1,18 +0,0 @@ -#ifndef __IRQ_H__ -#define __IRQ_H__ - -//----------------------------------------------------------------- -// Types -//----------------------------------------------------------------- -typedef void (*fn_irq_func)(int irq_number); - -//----------------------------------------------------------------- -// Prototypes -//----------------------------------------------------------------- -void irq_register(int interrupt, fn_irq_func func); -void irq_handler(unsigned int interrupts); -void irq_enable(int interrupt); -void irq_disable(int interrupt); -void irq_acknowledge(int interrupt); - -#endif Index: trunk/sw/rtos_example/boot.S =================================================================== --- trunk/sw/rtos_example/boot.S (revision 22) +++ trunk/sw/rtos_example/boot.S (nonexistent) @@ -1,168 +0,0 @@ -#include "../rtos/arch/altor32/exception.inc" - -#------------------------------------------------------------- -# VECTOR 0x000 - Application Header -#------------------------------------------------------------- -.org 0x000 - -# This code is not executed as execution starts from reset vector -.word 0x00000000 -.word 0x00000000 -.word 0xb00710ad -.word 0x00000000 - -#------------------------------------------------------------- -# VECTOR 0x100 - Reset -#------------------------------------------------------------- -.org 0x100 -vector_reset: - - # Setup SP (R1) - l.movhi r4,hi(_sp); - l.ori r1,r4,lo(_sp); - - # R4 = _bss_start - l.movhi r4,hi(_bss_start); - l.ori r4,r4,lo(_bss_start); - - # R5 = _end - l.movhi r5,hi(_bss_end); - l.ori r5,r5,lo(_bss_end); - -BSS_CLEAR: - l.sw 0x0(r4),r0 # Write 0x00 to mem[r4] - l.sfleu r4,r5 # SR[F] = (r4 < r5) - l.bf BSS_CLEAR # If SR[F] == 0, jump to BSS_CLEAR - l.addi r4, r4, 4 # r4 += 4 - - # Jump to main routine - l.jal main - l.nop - -#------------------------------------------------------------- -# VECTOR 0x200 - Fault / Illegal Instruction -#------------------------------------------------------------- -.org 0x200 -vector_fault: - - # Jump to cpu_fault - l.movhi r10,hi(cpu_fault); - l.ori r10,r10,lo(cpu_fault); - l.jalr r10 - l.nop - -.size vector_fault, .-vector_fault - -#------------------------------------------------------------- -# VECTOR 0x300 - External Interrupt -#------------------------------------------------------------- -.org 0x300 -vector_extint: - - #--------------------------------------------------------- - # Save context - #--------------------------------------------------------- - asm_save_context - - # Load TCB address - l.movhi r10,hi(_currentTCB); - l.ori r10,r10,lo(_currentTCB); - l.lwz r10, 0(r10) - - # _currentTCB == NULL, goto no_tcb - l.sfeq r0, r10 - l.bf no_tcb2 - l.nop - - # Store SP to TCB - l.sw 0(r10), r1 - - no_tcb2: - #--------------------------------------------------------- - - # Setup kernel stack pointer to system stack - l.movhi r1,hi(_sp); - l.ori r1,r1,lo(_sp); - - # Jump to irq handling function - l.movhi r10,hi(cpu_irq); - l.ori r10,r10,lo(cpu_irq); - l.jalr r10 - l.nop - - l.j common_int_end - l.nop - -.size vector_extint, .-vector_extint - -#------------------------------------------------------------- -# VECTOR 0x400 - Syscall -#------------------------------------------------------------- -.org 0x400 -vector_syscall: - - #--------------------------------------------------------- - # Save context - #--------------------------------------------------------- - asm_save_context - - # Load TCB address - l.movhi r10,hi(_currentTCB); - l.ori r10,r10,lo(_currentTCB); - l.lwz r10, 0(r10) - - # _currentTCB == NULL, goto no_tcb - l.sfeq r0, r10 - l.bf no_tcb - l.nop - - # Store SP to TCB - l.sw 0(r10), r1 - - no_tcb: - #--------------------------------------------------------- - - # Setup kernel stack pointer to system stack - l.movhi r1,hi(_sp); - l.ori r1,r1,lo(_sp); - - # Jump to irq handling function - l.movhi r10,hi(cpu_syscall); - l.ori r10,r10,lo(cpu_syscall); - l.jalr r10 - l.nop - - #--------------------------------------------------------- - # Load context - #--------------------------------------------------------- -common_int_end: - - # Get TCB pointer address - l.movhi r13,hi(_currentTCB); - l.ori r13,r13,lo(_currentTCB); - - # Load current TCB address - l.lwz r13, 0(r13) - - # Load stack pointer from TCB - l.lwz r1, 0(r13) - - # Restore context - asm_load_context - #--------------------------------------------------------- - -.size vector_syscall, .-vector_syscall - -#------------------------------------------------------------- -# VECTOR 0x600 - Trap -#------------------------------------------------------------- -.org 0x600 -vector_trap: - - # Jump to cpu_fault - l.movhi r10,hi(cpu_trap); - l.ori r10,r10,lo(cpu_trap); - l.jalr r10 - l.nop - -.size vector_trap, .-vector_trap \ No newline at end of file Index: trunk/sw/rtos_example/main.c =================================================================== --- trunk/sw/rtos_example/main.c (revision 22) +++ trunk/sw/rtos_example/main.c (nonexistent) @@ -1,127 +0,0 @@ -//----------------------------------------------------------------------------- -// AltOR32 -// Alternative Lightweight OpenRISC -// Ultra-Embedded.com -// Copyright 2011 - 2012 -// -// Email: admin@ultra-embedded.com -// -// License: GPL -// Please contact the above address if you would like a version of this -// software with a more permissive license for use in closed source commercial -// applications. -//----------------------------------------------------------------------------- -// -// This file is part of AltOR32 Alternative Lightweight OpenRISC project. -// -// AltOR32 is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation; either version 2 of the License, or (at your option) any later -// version. -// -// AltOR32 is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -// details. -// -// You should have received a copy of the GNU General Public License -// along with AltOR32; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//----------------------------------------------------------------------------- -#include "serial.h" -#include "printf.h" -#include "assert.h" -#include "kernel/rtos.h" - -//----------------------------------------------------------------- -// Defines: -//----------------------------------------------------------------- -#define RTOS_MEM_SIZE (4096) -#define APP_STACK_SIZE (256) - -//----------------------------------------------------------------- -// Prototypes: -//----------------------------------------------------------------- -extern void app_func(void *arg); -static void idle_func(void); -static void thread1_func(void *arg); -static void thread2_func(void *arg); - -//----------------------------------------------------------------- -// Locals: -//----------------------------------------------------------------- -static unsigned char rtos_heap[RTOS_MEM_SIZE]; - -//----------------------------------------------------------------- -// main: -//----------------------------------------------------------------- -int main(void) -{ - printf_register(serial_putchar); - printf("\n\nRunning\n"); - - // Initialise RTOS - rtos_init(); - - // Register system specific functions - rtos_services.printf = printf; - rtos_services.idle = idle_func; - - // RTOS heap init - rtos_heap_init(rtos_heap, RTOS_MEM_SIZE); - - // Add threads - rtos_thread_create("THREAD1", THREAD_MAX_PRIO - 1, thread1_func, NULL, APP_STACK_SIZE); - rtos_thread_create("THREAD2", THREAD_MAX_PRIO - 2, thread2_func, NULL, APP_STACK_SIZE); - - // Start RTOS - printf("Starting RTOS...\n"); - thread_kernel_run(); - - return 0; -} -//----------------------------------------------------------------- -// thread1_func: -//----------------------------------------------------------------- -static void thread1_func(void *arg) -{ - int idx = 0; - - while (1) - { - printf("thread1\n"); - thread_sleep(10); - - if (idx++ == 5) - { - idx = 0; - thread_dump_list(); - } - } -} -//----------------------------------------------------------------- -// thread2_func: -//----------------------------------------------------------------- -static void thread2_func(void *arg) -{ - while (1) - { - printf("thread2\n"); - thread_sleep(1); - } -} -//----------------------------------------------------------------- -// idle_func: -//----------------------------------------------------------------- -static void idle_func(void) -{ - -} -//----------------------------------------------------------------- -// assert_handler: -//----------------------------------------------------------------- -void assert_handler(const char * type, const char *reason, const char *file, int line) -{ - printf("[%s]: %s %s:%d\n", type, reason, file, line); - while (1); -} Index: trunk/sw/rtos_example/serial.h =================================================================== --- trunk/sw/rtos_example/serial.h (revision 22) +++ trunk/sw/rtos_example/serial.h (nonexistent) @@ -1,12 +0,0 @@ -#ifndef __SERIAL_H__ -#define __SERIAL_H__ - -//----------------------------------------------------------------- -// Prototypes: -//----------------------------------------------------------------- -void serial_init (void); -int serial_putchar(char ch); -int serial_getchar(void); -int serial_haschar(); - -#endif // __SERIAL_H__ Index: trunk/sw/rtos_example =================================================================== --- trunk/sw/rtos_example (revision 22) +++ trunk/sw/rtos_example (nonexistent)
trunk/sw/rtos_example Property changes : Deleted: bugtraq:number ## -1 +0,0 ## -true \ No newline at end of property

powered by: WebSVN 2.1.0

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