From d9c7c68219f5872b3615a757dd9fc4c7d6447e39 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Mon, 11 Feb 2008 21:01:22 +0000 Subject: [PATCH] Update interrupt priorities for Fujitsu port. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@162 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Demo/MB91460_Softune/91467d_FreeRTOS.prj | 18 +- Demo/MB91460_Softune/91467d_FreeRTOS.wsp | 6 +- Demo/MB91460_Softune/SRC/FreeRTOSConfig.h | 2 +- Demo/MB91460_Softune/SRC/serial/serial.c | 2 +- .../MB91460_Softune/SRC/utility/taskutility.c | 246 ++++++++++-------- Demo/MB91460_Softune/SRC/vectors.c | 8 +- .../STANDALONE/Mondeb_57K6_com1.sup | 10 +- 7 files changed, 164 insertions(+), 128 deletions(-) diff --git a/Demo/MB91460_Softune/91467d_FreeRTOS.prj b/Demo/MB91460_Softune/91467d_FreeRTOS.prj index 2f8885e16..e05a92c98 100644 --- a/Demo/MB91460_Softune/91467d_FreeRTOS.prj +++ b/Demo/MB91460_Softune/91467d_FreeRTOS.prj @@ -362,17 +362,19 @@ F27-7=- ..\..\Source\include\task.h F27-8=- ..\..\Source\include\list.h F27-9=- SRC\watchdog\watchdog.h F27-10=- ..\..\..\..\..\..\devtools\Softune6\LIB\911\INCLUDE\stddef.h -F28=10 c 1 SRC\utility\taskutility.c +F28=12 c 1 SRC\utility\taskutility.c F28-1=- SRC\mb91467d.h F28-2=- SRC\vectors.h F28-3=- ..\..\Source\include\FreeRTOS.h -F28-4=- ..\..\Source\include\projdefs.h -F28-5=- SRC\FreeRTOSConfig.h -F28-6=- ..\..\Source\include\portable.h -F28-7=- ..\..\Source\portable\Softune\MB91460\portmacro.h -F28-8=- ..\..\Source\include\task.h -F28-9=- ..\..\Source\include\list.h -F28-10=- ..\..\..\..\..\..\devtools\Softune6\LIB\911\INCLUDE\stddef.h +F28-4=- ..\..\..\..\..\..\devtools\Softune6\LIB\911\INCLUDE\stddef.h +F28-5=- ..\..\Source\include\projdefs.h +F28-6=- SRC\FreeRTOSConfig.h +F28-7=- ..\..\Source\include\portable.h +F28-8=- ..\..\Source\portable\Softune\MB91460\portmacro.h +F28-9=- ..\..\Source\include\task.h +F28-10=- ..\..\Source\include\list.h +F28-11=- ..\..\Source\include\semphr.h +F28-12=- ..\..\Source\include\queue.h F29=25 c 1 SRC\main.c F29-1=- SRC\mb91467d.h F29-2=- SRC\vectors.h diff --git a/Demo/MB91460_Softune/91467d_FreeRTOS.wsp b/Demo/MB91460_Softune/91467d_FreeRTOS.wsp index a9e6f6772..512ab5b47 100644 --- a/Demo/MB91460_Softune/91467d_FreeRTOS.wsp +++ b/Demo/MB91460_Softune/91467d_FreeRTOS.wsp @@ -18,6 +18,8 @@ AutoLoad=1 WSP=C:\E\Dev\FreeRTOS\WorkingCopy2\Demo\MB91460_Softune\ [EditState] -STATE-1=SRC\main.c:1 -Count=1 +STATE-1=SRC\main.c:18 +STATE-2=..\..\Source\queue.c:988 +STATE-3=..\..\Source\tasks.c:1342 +Count=3 diff --git a/Demo/MB91460_Softune/SRC/FreeRTOSConfig.h b/Demo/MB91460_Softune/SRC/FreeRTOSConfig.h index f5dfe2f5f..af11cda28 100644 --- a/Demo/MB91460_Softune/SRC/FreeRTOSConfig.h +++ b/Demo/MB91460_Softune/SRC/FreeRTOSConfig.h @@ -53,7 +53,7 @@ #define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 64000000 ) /* Clock setup from start91460.asm in the demo application. */ #define configPER_CLOCK_HZ ( ( unsigned portLONG ) 16000000 ) /* Clock setup from start91460.asm in the demo application. */ #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 6 ) -#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 70 ) +#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 100 ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32768 - 4192 ) ) #define configMAX_TASK_NAME_LEN ( 20 ) #define configUSE_TRACE_FACILITY 1 diff --git a/Demo/MB91460_Softune/SRC/serial/serial.c b/Demo/MB91460_Softune/SRC/serial/serial.c index 4aaf19159..090d79935 100644 --- a/Demo/MB91460_Softune/SRC/serial/serial.c +++ b/Demo/MB91460_Softune/SRC/serial/serial.c @@ -174,7 +174,7 @@ signed portBASE_TYPE xReturn; /*If the post causes a task to wake force a context switch as the woken task may have a higher priority than the task we have interrupted. */ - portYIELDFromISR(); + portYIELD_FROM_ISR(); } } diff --git a/Demo/MB91460_Softune/SRC/utility/taskutility.c b/Demo/MB91460_Softune/SRC/utility/taskutility.c index e381aee67..b23f633f2 100644 --- a/Demo/MB91460_Softune/SRC/utility/taskutility.c +++ b/Demo/MB91460_Softune/SRC/utility/taskutility.c @@ -1,189 +1,215 @@ /* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */ /* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */ /* ELIGIBILITY FOR ANY PURPOSES. */ -/* (C) Fujitsu Microelectronics Europe GmbH */ +/* (C) Fujitsu Microelectronics Europe GmbH */ /*------------------------------------------------------------------------ taskutility.C - -------------------------------------------------------------------------*/ - - -/*************************@INCLUDE_START************************/ #include "mb91467d.h" #include "vectors.h" #include "FreeRTOS.h" #include "task.h" - +#include "semphr.h" static void vUART5Task( void *pvParameters ); -/**************************@INCLUDE_END*************************/ -/*********************@GLOBAL_VARIABLES_START*******************/ -const char ASCII[] = "0123456789ABCDEF"; +const char ASCII[] = "0123456789ABCDEF"; + +void vInitUart5( void ); -xTaskHandle UART_TaskHandle; +xSemaphoreHandle xSemaphore; -void InitUart5(void) +void vInitUart5( void ) { //Initialize UART asynchronous mode - BGR05 = 1666; // 9600 Baud @ 16MHz - + BGR05 = 1666; // 9600 Baud @ 16MHz SCR05 = 0x17; // 7N2 SMR05 = 0x0d; // enable SOT3, Reset, normal mode SSR05 = 0x00; // LSB first - PFR19_D4 = 1; // enable UART PFR19_D5 = 1; // enable UART //EPFR19 = 0x00; // enable UART - SSR05_RIE = 1; } -void Putch5(char ch) /* sends a char */ +void Putch5( char ch ) /* sends a char */ { - while (SSR05_TDRE == 0); /* wait for transmit buffer empty */ - TDR05 = ch; /* put ch into buffer */ + while( SSR05_TDRE == 0 ); + + /* wait for transmit buffer empty */ + TDR05 = ch; /* put ch into buffer */ } -char Getch5(void) /* waits for and returns incomming char */ +char Getch5( void ) /* waits for and returns incomming char */ { - volatile unsigned ch; - - while(SSR05_RDRF == 0); /* wait for data received */ - if (SSR05_ORE) /* overrun error */ - { - ch = RDR05; /* reset error flags */ - return (char)(-1); - } - else - return (RDR05); /* return char */ + volatile unsigned ch; + + while( SSR05_RDRF == 0 ); + + /* wait for data received */ + if( SSR05_ORE ) /* overrun error */ + { + ch = RDR05; /* reset error flags */ + return ( char ) ( -1 ); + } + else + { + return( RDR05 ); /* return char */ + } } -void Puts5(const char *Name5) /* Puts a String to UART */ +void Puts5( const char *Name5 ) /* Puts a String to UART */ { - volatile portSHORT i,len; - len = strlen(Name5); - - for (i=0; i> div)&0xF); /* get hex-digit value */ - Putch5(digit + ((digit < 0xA) ? '0' : 'A' - 0xA)); - div-=4; /* next digit shift */ - } + unsigned portCHAR digit = 0, div = 0, i; + + div = ( 4 * (digits - 1) ); /* init shift divisor */ + for( i = 0; i < digits; i++ ) + { + digit = ( (n >> div) & 0xF ); /* get hex-digit value */ + Putch5( digit + ((digit < 0xA) ? '0' : 'A' - 0xA) ); + div -= 4; /* next digit shift */ + } } -void Putdec5(unsigned long x, int digits) +void Putdec5( unsigned long x, int digits ) { - portSHORT i; - portCHAR buf[10],sign=1; - - if (digits < 0) { /* should be print of zero? */ - digits *= (-1); - sign =1; - } - buf[digits]='\0'; /* end sign of string */ - - for (i=digits; i>0; i--) { - buf[i-1] = ASCII[x % 10]; - x = x/10; + portSHORT i; + portCHAR buf[10], sign = 1; + + if( digits < 0 ) + { /* should be print of zero? */ + digits *= ( -1 ); + sign = 1; } - if ( sign ) + buf[digits] = '\0'; /* end sign of string */ + + for( i = digits; i > 0; i-- ) { - for (i=0; buf[i]=='0'; i++) { /* no print of zero */ - if ( i