OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc
    from Rev 648 to Rev 649
    Reverse comparison

Rev 648 → Rev 649

/trunk/rtos/freertos-6.1.1/Demo/OpenRISC_SIM_GCC/serial/serial.c
105,15 → 105,9
Because FreeRTOS is not supposed to run with nested interrupts, put all OS
calls in a critical section . */
/* FIXME, entering, exiting ciritical section around
xQueueReceiveFromISR is not work */
#if 0
portENTER_CRITICAL();
retstatus = xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken );
portEXIT_CRITICAL();
#else
/* entering, exiting ciritical section around xQueueReceiveFromISR is not
required. OpenRISC automaticaly disable interrupt when expection occurs */
retstatus = xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken );
#endif
 
if (retstatus == pdTRUE)
{
135,10 → 129,9
cChar = uart_getc_noblock(0);
 
/* Because FreeRTOS is not supposed to run with nested interrupts, put all OS
calls in a critical section . */
portENTER_CRITICAL();
xQueueSendFromISR(xRxedChars, &cChar, &xHigherPriorityTaskWoken);
portEXIT_CRITICAL();
calls in a critical section . but in case of OpenRISC, it is not required. Tick
, External interrupt are automaticaly disabled. */
xQueueSendFromISR(xRxedChars, &cChar, &xHigherPriorityTaskWoken);
}
 
/* The return value will be used by portEXIT_SWITCHING_ISR() to know if it
/trunk/rtos/freertos-6.1.1/Demo/OpenRISC_SIM_GCC/FreeRTOSConfig.h
67,35 → 67,44
*----------------------------------------------------------*/
#include "board.h"
 
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( ( unsigned long ) SYS_CLK )
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 10 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 16 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 32 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configQUEUE_REGISTRY_SIZE 0
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( ( unsigned long ) SYS_CLK )
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 128 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 32 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_CO_ROUTINES 1
#define configUSE_MUTEXES 1
#define configGENERATE_RUN_TIME_STATS 0
#define configCHECK_FOR_STACK_OVERFLOW 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_APPLICATION_TASK_TAG 0
 
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 7 )
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
 
 
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 1
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
 
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
 
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetSchedulerState 1
 
 
#endif /* FREERTOS_CONFIG_H */
/trunk/rtos/freertos-6.1.1/Demo/OpenRISC_SIM_GCC/main.c
61,119 → 61,205
/* Scheduler header files. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
 
/* Demo application includes. */
#include "serial.h"
#include "partest.h"
#include "flash.h"
#include "integer.h"
#include "blocktim.h"
#include "BlockQ.h"
#include "comtest2.h"
#include "dynamic.h"
 
/* BSP headers. */
#include "support.h"
#include "board.h"
#include "uart.h"
#include "gpio.h"
 
#include "interrupts.h"
 
#define TASK_STACK_SIZE (configMINIMAL_STACK_SIZE)
/* Demo application task priorities. */
#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 )
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
 
#define mainPRINT_STACK_SIZE ( ( unsigned short ) 64 )
#define mainDEBUG_LOG_BUFFER_SIZE ( ( unsigned short ) 256 )
 
/* How often should we check the other tasks? */
#define mainCHECK_TASK_CYCLE_TIME ( 3000 )
 
/* Baud rate used by the comtest tasks. */
#define mainCOM_TEST_BAUD_RATE ( 115200 )
 
/* The LED used by the comtest tasks. See the comtest.c file for more
information. */
#define mainCOM_TEST_LED ( 7 )
 
/*-----------------------------------------------------------*/
 
/*
* The task that executes at the highest priority and checks the operation of
* all the other tasks in the system. See the description at the top of the
* file.
*/
static void vCheckTask( void *pvParameters );
 
/*
* ST provided routine to configure the processor.
*/
static void prvSetupHardware(void);
void vDemoTask(void *pvParameters);
void vClockTask(void *pvParameters);
 
void vApplicationTickHook(void);
void vApplicationIdleHook(void);
void vApplicationStackOverflowHook(xTaskHandle *pxTask, signed char *pcTaskName);
void vApplicationIdleHook( void );
void vApplicationTickHook( void );
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );
void vApplicationMallocFailedHook( void );
 
int main(int argc, char **argv) {
/*-----------------------------------------------------------*/
 
/* Create all the demo application tasks, then start the scheduler. */
int main( int argc, char **argv )
{
argc = argc;
argv = argv;
 
portBASE_TYPE delay[3] = {600, 400, 200};
/* Perform any hardware setup necessary. */
prvSetupHardware();
vParTestInitialise();
 
prvSetupHardware();
/* Create the standard demo application tasks. See the WEB documentation
for more information on these tasks. */
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
vStartIntegerMathTasks( tskIDLE_PRIORITY );
// vCreateBlockTimeTasks();
// vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
// vStartDynamicPriorityTasks();
 
xTaskCreate(vDemoTask , (signed char *)"vTask0", TASK_STACK_SIZE, (void*)&delay[0], 1, (xTaskHandle)NULL);
xTaskCreate(vDemoTask , (signed char *)"vTask1", TASK_STACK_SIZE, (void*)&delay[1], 2, (xTaskHandle)NULL);
xTaskCreate(vDemoTask , (signed char *)"vTask2", TASK_STACK_SIZE, (void*)&delay[2], 3, (xTaskHandle)NULL);
xTaskCreate(vClockTask, (signed char *)"vClock", TASK_STACK_SIZE, (void*)&delay[2], 3, (xTaskHandle)NULL);
/* Create the tasks defined within this file. */
xTaskCreate( vCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
vTaskStartScheduler();
 
// Control will not reach here
/* Execution will only reach here if there was insufficient heap to
start the scheduler. */
return 0;
}
/*-----------------------------------------------------------*/
 
void vClockTask(void *pvParameters) {
static void vCheckTask( void *pvParameters )
{
static unsigned long ulErrorDetected = pdFALSE;
portTickType xLastExecutionTime;
 
/* prevent compiler warning */
pvParameters = pvParameters;
unsigned portBASE_TYPE ticks = xTaskGetTickCount();
int hour = 0;
int min = 0;
int sec = -1;
while(1) {
sec += 1;
if(sec == 60) {
sec = 0;
min += 1;
}
if(min == 60) {
min = 0;
hour += 1;
}
if(hour == 24) {
hour = 0;
}
 
portENTER_CRITICAL();
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
works correctly. */
xLastExecutionTime = xTaskGetTickCount();
 
for( ;; )
{
/* Wait until it is time for the next cycle. */
vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME );
/* Has an error been found in any of the standard demo tasks? */
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
{
uart_print_int(hour);
uart_print_str(" : ");
uart_print_int(min);
uart_print_str(" : ");
uart_print_int(sec);
uart_print_str(" , ");
uart_print_int(ticks);
uart_print_str("\n\r");
ulErrorDetected = pdTRUE;
}
portEXIT_CRITICAL();
/* FIXME, xAreComTestTasksStillRunning assumed that UART TX is loopbacked to RX
but, current Or1ksim does not surrpot UART loopback. so, ignore it.*/
if( xAreComTestTasksStillRunning() != pdTRUE )
{
// ulErrorDetected = pdTRUE;
}
 
vTaskDelay(1000);
ticks = xTaskGetTickCount();
}
}
// if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
// {
// ulErrorDetected = pdTRUE;
// }
 
void vDemoTask(void *pvParameters) {
// unsigned portBASE_TYPE priority = uxTaskPriorityGet(NULL);
unsigned portBASE_TYPE ticks = xTaskGetTickCount();
portTickType delay = *((portTickType *)pvParameters);
// if( xAreBlockingQueuesStillRunning() != pdTRUE )
// {
// ulErrorDetected = pdTRUE;
// }
// if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
// {
// ulErrorDetected = pdTRUE;
// }
if(ulErrorDetected == pdTRUE)
{
// something was wrong. report negative indicator
const char *message = "vCheckTask Error detected!\n\r";
vSerialPutString(NULL, (const signed char*)message, strlen(message));
 
while(1) {
portENTER_CRITICAL();
report(0xDEADBEEF);
}
else
{
uart_print_str("vTask ");
uart_print_int(delay);
uart_print_str(" : ");
// uart_print_int(priority);
// uart_print_str(" , ");
uart_print_int(ticks);
uart_print_str(" \n\r");
// we have no error. report positive indicator
const char *message = "vCheckTask OK!\n\r";
vSerialPutString(NULL, (const signed char*)message, strlen(message));
 
report(0x00000000);
}
portEXIT_CRITICAL();
vTaskDelay(delay);
ticks = xTaskGetTickCount();
 
}
}
 
static void prvSetupHardware(void) {
/*-----------------------------------------------------------*/
 
void prvSetupHardware( void )
{
// UART controller use 25 Mhz Wishbone bus clock, define in board.h
uart_init(0);
uart_rxint_enable(0);
 
// Initialize internal Programmable Interrupt Controller
int_init();
 
// GPIO Initialize
gpio_init(0);
 
// set low 8 port is outout
set_gpio_direction(0, 0xFFFFFF00);
}
/*-----------------------------------------------------------*/
 
void vApplicationTickHook(void) {
uart_print_str(".");
void vApplicationIdleHook( void )
{
}
/*-----------------------------------------------------------*/
 
void vApplicationIdleHook(void) {
uart_print_str(" i ");
void vApplicationTickHook( void )
{
}
/*-----------------------------------------------------------*/
 
void vApplicationStackOverflowHook(xTaskHandle *pxTask, signed char *pcTaskName) {
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
{
/* prevent compiler warning */
pxTask = pxTask;
pcTaskName = pcTaskName;
 
uart_print_str(" S \n\r");
report(0x00000099);
}
/*-----------------------------------------------------------*/
 
void vApplicationMallocFailedHook( void )
{
report(0x00000098);
}
/*-----------------------------------------------------------*/
/trunk/rtos/freertos-6.1.1/Demo/OpenRISC_SIM_GCC/sim.cfg
72,7 → 72,7
clkcycle = <value>[ps|ns|us|ms]
*/
section sim
clkcycle = 100ns
clkcycle = 1ns
end
 
 
367,13 → 367,30
irq = <value> (default: 0)
base_vapi_id = <value> (default: 0)
*/
 
/*
current version of Or1ksim does not supprot newest version of gpio
controller. So, we are use memory instead of gpio controller model.
*/
 
/*
section gpio
enabled = 1
enabled = 0
baseaddr = 0x91000000
irq = 3
base_vapi_id = 0x0200
end
*/
 
section memory
name = "gpio_dummystub"
type = unknown
baseaddr = 0x91000000
size = 0x00010000
delayr = 1
delayw = 2
end
 
/* VGA section
enabled = 0|1
/trunk/rtos/freertos-6.1.1/Demo/OpenRISC_SIM_GCC/Makefile
15,19 → 15,17
APP_SOURCE_DIR = ../Common/Minimal
 
APP_SRC = \
$(APP_SOURCE_DIR)/dynamic.c \
$(APP_SOURCE_DIR)/integer.c \
$(APP_SOURCE_DIR)/blocktim.c \
$(APP_SOURCE_DIR)/BlockQ.c \
$(APP_SOURCE_DIR)/flash.c \
$(APP_SOURCE_DIR)/PollQ.c \
$(APP_SOURCE_DIR)/comtest.c \
$(APP_SOURCE_DIR)/flop.c \
$(APP_SOURCE_DIR)/semtest.c \
$(APP_SOURCE_DIR)/dynamic.c \
$(APP_SOURCE_DIR)/BlockQ.c
$(APP_SOURCE_DIR)/comtest.c
 
PORT_SRC = $(RTOS_SOURCE_DIR)/portable/GCC/OpenRISC/port.c
PORT_ASM = $(RTOS_SOURCE_DIR)/portable/GCC/OpenRISC/portasm.S
 
DEMO_SRC = main.c
DEMO_SRC = main.c serial/serial.c ParTest/ParTest.c
ARCH_ASM = ./arch/reset.S
 
INC = -I. -I../../Source/include -I./arch -I./drivers -I../Common/include \
67,9 → 65,9
 
all: $(PROG).or32
 
$(PROG).or32 : $(PORT_ASM_OBJ) $(PORT_OBJ) $(RTOS_OBJ) $(DEMO_OBJ) Makefile arch drivers
$(PROG).or32 : $(PORT_ASM_OBJ) $(PORT_OBJ) $(RTOS_OBJ) $(DEMO_OBJ) $(APP_OBJ) Makefile arch drivers
@echo Link....
@$(LD) -o $@ $(LDFLAGS) --start-group $(ARCH_ASM_OBJ) $(PORT_ASM_OBJ) $(PORT_OBJ) $(RTOS_OBJ) $(DEMO_OBJ) $(LIBS) --end-group
@$(LD) -o $@ $(LDFLAGS) --start-group $(ARCH_ASM_OBJ) $(PORT_ASM_OBJ) $(PORT_OBJ) $(RTOS_OBJ) $(DEMO_OBJ) $(APP_OBJ) $(LIBS) --end-group
@$(OBJDUMP) -S $(PROG).or32 >> $(PROG).asm
@echo Complete $@
 
92,10 → 90,10
@true
 
#-------------------------------------------------------------
sim:
sim: $(PROG).or32
or32-elf-sim --nosrv -f sim.cfg $(PROG).or32
 
debug:
debug: $(PROG).or32
xterm -e or32-elf-sim -f sim.cfg --srv=9999 &
xterm -e or32-elf-gdb $(PROG).or32 &
 

powered by: WebSVN 2.1.0

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