]> git.sur5r.net Git - freertos/commitdiff
Continue FX16 demo development.
authorRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 30 Jan 2009 14:06:37 +0000 (14:06 +0000)
committerRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 30 Jan 2009 14:06:37 +0000 (14:06 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@654 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/MB96350_Softune_Dice_Kit/DiceTask.c [new file with mode: 0644]
Demo/MB96350_Softune_Dice_Kit/DiceTask.h [new file with mode: 0644]
Demo/MB96350_Softune_Dice_Kit/FreeRTOSConfig.h
Demo/MB96350_Softune_Dice_Kit/OPT/dicekit16fx_dice2-v10.opb
Demo/MB96350_Softune_Dice_Kit/OPT/dicekit16fx_dice2-v10.opl
Demo/MB96350_Softune_Dice_Kit/dicekit16fx_dice2-v10.prj
Demo/MB96350_Softune_Dice_Kit/dicekit16fx_dice2-v10.wsp
Demo/MB96350_Softune_Dice_Kit/main.c
Demo/MB96350_Softune_Dice_Kit/options.dat
Demo/MB96350_Softune_Dice_Kit/vectors.c

diff --git a/Demo/MB96350_Softune_Dice_Kit/DiceTask.c b/Demo/MB96350_Softune_Dice_Kit/DiceTask.c
new file mode 100644 (file)
index 0000000..2565f65
--- /dev/null
@@ -0,0 +1,220 @@
+/*\r
+       FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry.\r
+\r
+       This file is part of the FreeRTOS.org distribution.\r
+\r
+       FreeRTOS.org is free software; you can redistribute it and/or modify\r
+       it under the terms of the GNU General Public License as published by\r
+       the Free Software Foundation; either version 2 of the License, or\r
+       (at your option) any later version.\r
+\r
+       FreeRTOS.org is distributed in the hope that it will be useful,\r
+       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+       GNU General Public License for more details.\r
+\r
+       You should have received a copy of the GNU General Public License\r
+       along with FreeRTOS.org; if not, write to the Free Software\r
+       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+\r
+       A special exception to the GPL can be applied should you wish to distribute\r
+       a combined work that includes FreeRTOS.org, without being obliged to provide\r
+       the source code for any proprietary components.  See the licensing section \r
+       of http://www.FreeRTOS.org for full details of how and when the exception\r
+       can be applied.\r
+\r
+    ***************************************************************************\r
+    ***************************************************************************\r
+    *                                                                         *\r
+    * SAVE TIME AND MONEY!  We can port FreeRTOS.org to your own hardware,    *\r
+    * and even write all or part of your application on your behalf.          *\r
+    * See http://www.OpenRTOS.com for details of the services we provide to   *\r
+    * expedite your project.                                                  *\r
+    *                                                                         *\r
+    ***************************************************************************\r
+    ***************************************************************************\r
+\r
+       Please ensure to read the configuration and relevant port sections of the\r
+       online documentation.\r
+\r
+       http://www.FreeRTOS.org - Documentation, latest information, license and \r
+       contact details.\r
+\r
+       http://www.SafeRTOS.com - A version that is certified for use in safety \r
+       critical systems.\r
+\r
+       http://www.OpenRTOS.com - Commercial support, development, porting, \r
+       licensing and training services.\r
+*/\r
+\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+#define diceMIN    1\r
+#define diceMAX    6\r
+#define diceRUN_MIN  600000L\r
+#define diceRUN_MAX 1200000L\r
+\r
+#define diceSTATE_STOPPED              0\r
+#define diceSTATE_STARTUP              1\r
+#define diceSTATE_RUNNING              2\r
+\r
+static unsigned char prvButtonHit( unsigned char ucIndex );\r
+\r
+static const char cDisplaySegments[ 2 ][ 11 ] =\r
+{\r
+       { 0x48, 0xeb, 0x8c, 0x89, 0x2b, 0x19, 0x18, 0xcb, 0x08, 0x09, 0xf7 },\r
+       { 0xa0, 0xf3, 0xc4, 0xc1, 0x93, 0x89, 0x88, 0xe3, 0x80, 0x81, 0x7f }\r
+};\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void vDiceTask( void *pvParameters )\r
+{\r
+char cDiceState = diceSTATE_STOPPED;\r
+unsigned char ucDiceValue, ucIndex;\r
+unsigned long ulDice1RunTime, ulDiceDelay, ulDiceDelayReload;\r
+\r
+       ucIndex = ( unsigned char ) pvParameters;\r
+\r
+       for( ;; )\r
+       {\r
+               switch( cDiceState )\r
+               {\r
+                       case diceSTATE_STOPPED:\r
+\r
+                               if( prvButtonHit( ucIndex ) == pdTRUE )\r
+                               {\r
+                                       ulDice1RunTime = diceRUN_MIN;\r
+                                       srand( ( unsigned char ) ulDice1RunTime );\r
+                                       cDiceState = diceSTATE_STARTUP;\r
+                               }\r
+                               break;\r
+\r
+                       case diceSTATE_STARTUP:\r
+\r
+                               if( ulDice1RunTime < diceRUN_MAX )     // variable running time\r
+                               {\r
+                                       ulDice1RunTime++;\r
+                               }\r
+                               else\r
+                               {\r
+                                       ulDice1RunTime = diceRUN_MIN;\r
+                               }\r
+\r
+                               if( PDR00_P0 == 0 )              // Key SW2:INT8 released\r
+                               {\r
+                                       ulDiceDelay    = 1;\r
+                                       ulDiceDelayReload = 1;\r
+                                       cDiceState = diceSTATE_RUNNING;\r
+                               }          \r
+                               break;\r
+\r
+                       case diceSTATE_RUNNING:\r
+\r
+                               ulDice1RunTime--;\r
+                               ulDiceDelay--;\r
+\r
+                               if( !ulDiceDelay )\r
+                               {\r
+                                       ucDiceValue = rand() % 6 + 1;\r
+                                       PDR03 = ( PDR03 | 0xf7 ) & cDisplaySegments[ ucIndex ][ ucDiceValue ];\r
+                                       ulDiceDelayReload = ulDiceDelayReload + 100;\r
+                                       ulDiceDelay = ulDiceDelayReload;\r
+                               }\r
+\r
+                               if( ulDice1RunTime == 0 )         // dice stopped\r
+                               {\r
+                                       PDR03 = ( PDR03 | 0xf7 ) & cDisplaySegments[ ucIndex ][ rand() % 6 + 1 ];\r
+                                       cDiceState = diceSTATE_STOPPED;\r
+                               }\r
+                               break;\r
+               }\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static unsigned char prvButtonHit( unsigned char ucIndex )\r
+{\r
+       if( ( ucIndex == 0 ) && PDR00_P0 )\r
+       {\r
+               return pdTRUE;\r
+       }\r
+       else if( ( ucIndex == 1 ) && PDR00_P1 )\r
+       {\r
+               return pdTRUE;\r
+       }\r
+       else\r
+       {\r
+               return pdFALSE;\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+\r
+#if 0\r
+      \r
+    // DICE 2\r
+      \r
+    switch (dice2state)\r
+    {\r
+      case 0x00: // dice2 stopped\r
+                 if( PDR00_P1 == 1)              // Key SW3:INT9 pressed\r
+                 {\r
+                   dice2run = diceRUN_MIN;\r
+                   srand((unsigned char)ulDice1RunTime);\r
+                   dice2state = 0x01;\r
+                 }\r
+\r
+                 break;\r
+                \r
+      case 0x01: // dice2 startup\r
+                 if( dice2run < diceRUN_MAX)     // variable running time\r
+                   dice2run++;\r
+                 else\r
+                   dice2run = diceRUN_MIN;\r
+            \r
+                 if( dice2 == diceMAX)          // simple 'random' number\r
+                   dice2 = diceMIN;\r
+                 else dice2++;\r
+\r
+                 if( PDR00_P1 == 0)              // Key SW3:INT9 released\r
+                 {\r
+                   dice2delay    = 1;\r
+                   dice2delayrld = 1;\r
+                   dice2state = 0x02;\r
+                 }\r
+                                  \r
+                 break;\r
+\r
+      case 0x02: // dice2 running\r
+                 dice2run--;\r
+                 dice2delay--;\r
+\r
+                 if( !dice2delay)\r
+                 {\r
+                   do                       // get new random number\r
+                   {\r
+                    temp = rand() % 6 + 1;\r
+                   }\r
+                   while (temp == dice2);\r
+                   dice2 = temp;\r
+                   \r
+                   PDR05 = DICE7SEG2[dice2];\r
+                   dice2delayrld = dice2delayrld + 100;\r
+                   dice2delay = dice2delayrld;\r
+                 }\r
+\r
+                 if( dice2run == 0)         // dice stopped\r
+                 {\r
+                   PDR05 = DICE7SEG2[rand() % 6 + 1];\r
+                   dice2state = 0x00;\r
+                 }\r
+\r
+                 break;\r
+\r
+    }//switch (dice2state)\r
+    \r
+  } // while(1)\r
+#endif\r
+\r
diff --git a/Demo/MB96350_Softune_Dice_Kit/DiceTask.h b/Demo/MB96350_Softune_Dice_Kit/DiceTask.h
new file mode 100644 (file)
index 0000000..4c3e360
--- /dev/null
@@ -0,0 +1,57 @@
+/*\r
+       FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry.\r
+\r
+       This file is part of the FreeRTOS.org distribution.\r
+\r
+       FreeRTOS.org is free software; you can redistribute it and/or modify\r
+       it under the terms of the GNU General Public License as published by\r
+       the Free Software Foundation; either version 2 of the License, or\r
+       (at your option) any later version.\r
+\r
+       FreeRTOS.org is distributed in the hope that it will be useful,\r
+       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+       GNU General Public License for more details.\r
+\r
+       You should have received a copy of the GNU General Public License\r
+       along with FreeRTOS.org; if not, write to the Free Software\r
+       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+\r
+       A special exception to the GPL can be applied should you wish to distribute\r
+       a combined work that includes FreeRTOS.org, without being obliged to provide\r
+       the source code for any proprietary components.  See the licensing section \r
+       of http://www.FreeRTOS.org for full details of how and when the exception\r
+       can be applied.\r
+\r
+    ***************************************************************************\r
+    ***************************************************************************\r
+    *                                                                         *\r
+    * SAVE TIME AND MONEY!  We can port FreeRTOS.org to your own hardware,    *\r
+    * and even write all or part of your application on your behalf.          *\r
+    * See http://www.OpenRTOS.com for details of the services we provide to   *\r
+    * expedite your project.                                                  *\r
+    *                                                                         *\r
+    ***************************************************************************\r
+    ***************************************************************************\r
+\r
+       Please ensure to read the configuration and relevant port sections of the\r
+       online documentation.\r
+\r
+       http://www.FreeRTOS.org - Documentation, latest information, license and \r
+       contact details.\r
+\r
+       http://www.SafeRTOS.com - A version that is certified for use in safety \r
+       critical systems.\r
+\r
+       http://www.OpenRTOS.com - Commercial support, development, porting, \r
+       licensing and training services.\r
+*/\r
+\r
+#ifndef DICE_TASK_H\r
+#define DICE_TASK_H\r
+\r
+void vDiceTask( void *pvParameters );\r
+\r
+#endif\r
+\r
+\r
index a2409b854e003309014b499e201f766d71ab8cbb..41e0fa9b6547a0836240c25dcf4729d381eb018c 100644 (file)
@@ -87,7 +87,7 @@ the ComTest tasks will be included in place of the trace task. */
 #define configCLKP1_CLOCK_HZ           ( ( unsigned portLONG ) 56000000 )      /* Clock setup from start.asm in the demo application. */\r
 #define configTICK_RATE_HZ                     ( (portTickType) 1000 )\r
 #define configMAX_PRIORITIES           ( ( unsigned portBASE_TYPE ) 6 )\r
-#define configTOTAL_HEAP_SIZE          ( (size_t) (8000) )\r
+#define configTOTAL_HEAP_SIZE          ( (size_t) (5000) )\r
 #define configMAX_TASK_NAME_LEN                ( 20 )\r
 #define configUSE_16_BIT_TICKS         1\r
 #define configIDLE_SHOULD_YIELD                1\r
index f252f11d5e0b6571e368fed33a9ab18999a5ecbd..eb69082866d6f23c5fb3276140f71aad04598df4 100644 (file)
@@ -16,4 +16,5 @@
 -a "C:\E\Dev\FreeRTOS\WorkingCopy3\Demo\MB96350_Softune_Dice_Kit\OBJ\__STD_LIB_sbrk.obj"\r
 -a "C:\E\Dev\FreeRTOS\WorkingCopy3\Demo\MB96350_Softune_Dice_Kit\OBJ\heap_1.obj"\r
 -a "C:\E\Dev\FreeRTOS\WorkingCopy3\Demo\MB96350_Softune_Dice_Kit\OBJ\croutine.obj"\r
+-a "C:\E\Dev\FreeRTOS\WorkingCopy3\Demo\MB96350_Softune_Dice_Kit\OBJ\DiceTask.obj"\r
 \r
index 72878df83e0256a5229b6db1f442e27e3156d55b..bfd5afb6f5de36733942eb62d7020e849bb2422d 100644 (file)
@@ -15,6 +15,7 @@
 -Xals\r
 -Xalr\r
 -na\r
+-NCI0302LIB\r
 -w 2\r
 -cwno\r
 -a\r
@@ -33,4 +34,5 @@
 "C:\E\Dev\FreeRTOS\WorkingCopy3\Demo\MB96350_Softune_Dice_Kit\OBJ\__STD_LIB_sbrk.obj"\r
 "C:\E\Dev\FreeRTOS\WorkingCopy3\Demo\MB96350_Softune_Dice_Kit\OBJ\heap_1.obj"\r
 "C:\E\Dev\FreeRTOS\WorkingCopy3\Demo\MB96350_Softune_Dice_Kit\OBJ\croutine.obj"\r
+"C:\E\Dev\FreeRTOS\WorkingCopy3\Demo\MB96350_Softune_Dice_Kit\OBJ\DiceTask.obj"\r
 \r
index 73cd6a161d9823816b8ba2c0ac0fbb3b4813208a..55040c630a18d5fc07f969633462fcba510048dd 100644 (file)
@@ -17,7 +17,7 @@ PrjInfo-0=Debug
 Active=Debug\r
 \r
 [MEMBER]\r
-F0=14\r
+F0=15\r
 F1=0 f Include Files\r
 F2=0 f FreeRTOS Source\r
 F3=0 c ..\..\Source\portable\Softune\MB96340\__STD_LIB_sbrk.c\r
@@ -28,10 +28,11 @@ F7=0 c ..\..\Source\portable\Softune\MB96340\port.c
 F8=0 c ..\..\Source\queue.c\r
 F9=0 c ..\..\Source\tasks.c\r
 F10=0 f Demo Source\r
-F11=0 c main.c\r
-F12=0 a mb96356rs.asm\r
-F13=0 a START.ASM\r
-F14=0 c vectors.c\r
+F11=0 c DiceTask.c\r
+F12=0 c main.c\r
+F13=0 a mb96356rs.asm\r
+F14=0 a START.ASM\r
+F15=0 c vectors.c\r
 \r
 [OPTIONFILE]\r
 FILE=options.dat\r
@@ -48,12 +49,22 @@ LST=LST\
 OPT=OPT\\r
 \r
 [MEMBER-Debug]\r
-F0=12\r
+F0=13\r
 F1=0 m 1 ABS\RTOSDemo.abs\r
-F2=1 c 1 vectors.c\r
+F2=2 c 1 vectors.c\r
 F2-1=- mb96356rs.h\r
-F3=1 c 1 main.c\r
+F2-2=- FreeRTOSConfig.h\r
+F3=10 c 1 main.c\r
 F3-1=- mb96356rs.h\r
+F3-2=- ..\..\Source\Include\FreeRTOS.h\r
+F3-3=- ..\..\..\..\..\..\devtools\Softune\LIB\907\INCLUDE\stddef.h\r
+F3-4=- ..\..\Source\Include\projdefs.h\r
+F3-5=- FreeRTOSConfig.h\r
+F3-6=- ..\..\Source\Include\portable.h\r
+F3-7=- ..\..\Source\portable\Softune\MB96340\portmacro.h\r
+F3-8=- DiceTask.h\r
+F3-9=- ..\..\Source\Include\task.h\r
+F3-10=- ..\..\Source\Include\list.h\r
 F4=0 a 1 mb96356rs.asm\r
 F5=0 a 1 START.ASM\r
 F6=14 c 1 ..\..\Source\tasks.c\r
@@ -131,6 +142,16 @@ F12-7=- ..\..\Source\portable\Softune\MB96340\portmacro.h
 F12-8=- ..\..\Source\Include\task.h\r
 F12-9=- ..\..\Source\Include\list.h\r
 F12-10=- ..\..\Source\Include\croutine.h\r
+F13=9 c 1 DiceTask.c\r
+F13-1=- ..\..\Source\Include\FreeRTOS.h\r
+F13-2=- ..\..\..\..\..\..\devtools\Softune\LIB\907\INCLUDE\stddef.h\r
+F13-3=- ..\..\Source\Include\projdefs.h\r
+F13-4=- FreeRTOSConfig.h\r
+F13-5=- mb96356rs.h\r
+F13-6=- ..\..\Source\Include\portable.h\r
+F13-7=- ..\..\Source\portable\Softune\MB96340\portmacro.h\r
+F13-8=- ..\..\Source\Include\task.h\r
+F13-9=- ..\..\Source\Include\list.h\r
 \r
 [BUILDMODE-Debug]\r
 kernel=0\r
index 1d170c92345fa73a74000555dc7941bf9952bea9..b4c841d26f4c05aa59a15ec33efdaee2a5597ce4 100644 (file)
@@ -18,9 +18,5 @@ AutoLoad=1
 WSP=C:\E\Dev\FreeRTOS\WorkingCopy3\Demo\MB96350_Softune_Dice_Kit\\r
 \r
 [EditState]\r
-STATE-1=..\..\Source\portable\Softune\MB96340\portmacro.h:54\r
-STATE-2=..\..\source\portable\softune\mb96340\port.c:52\r
-STATE-3=START.ASM:1\r
-STATE-4=main.c:202\r
-Count=4\r
+Count=0\r
 \r
index cd5bf1f5da4ebf0a3b020d54af24a20fdd0759c6..0561d2dd8e1e026a29f7c20fdbd5c5b718bfea20 100644 (file)
-/* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */\r
-/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */\r
-/* ELIGIBILITY FOR ANY PURPOSES.                                             */\r
-/*                 (C) Fujitsu Microelectronics Europe GmbH                  */\r
-/*---------------------------------------------------------------------------\r
-  MAIN.C\r
-  - description\r
-  - See README.TXT for project description and disclaimer.\r
-\r
-/*---------------------------------------------------------------------------*/\r
-\r
-\r
-#include "mb96356rs.h"\r
-\r
-#define DICE_MIN    1\r
-#define DICE_MAX    6\r
-#define DICERUN_MIN  600000L\r
-#define DICERUN_MAX 1200000L\r
-\r
-const char DICE7SEG1[11]={0x48, 0xeb, 0x8c, 0x89, 0x2b, 0x19, 0x18, 0xcb, 0x08, 0x09, 0xf7};\r
-const char DICE7SEG2[11]={0xa0, 0xf3, 0xc4, 0xc1, 0x93, 0x89, 0x88, 0xe3, 0x80, 0x81, 0x7f};\r
-\r
-unsigned char temp;\r
-unsigned char dice1, dice2;\r
-unsigned long dice1run, dice2run;\r
-unsigned long dice1state, dice2state;\r
-unsigned long dice1delay, dice2delay;\r
-unsigned long dice1delayrld, dice2delayrld;\r
-  \r
-/*===========================================================================*/\r
-/*====== MAIN ===============================================================*/\r
-/*===========================================================================*/\r
-\r
-void main(void)\r
-{\r
-  InitIrqLevels();\r
-  __set_il(7);     // allow all levels     \r
-  __EI();          // globally enable interrupts\r
-  \r
-  // initialize I/O-ports\r
-  \r
-  PIER00 = 0x03;   // Enable P00_0/INT8 and P00_1/INT9 as input\r
-  PDR00  = 0x00;\r
-  DDR00  = 0xfc;   // P00_0: SW2(INT8)   P00_1: SW3(INT9)\r
-\r
-/* Do not use when Background Debugging is enabled\r
-  PIER01 = 0x04;   // enable P01_2/SIN3 as input\r
-  PDR01  = 0x08;   // SOT3 = 1\r
-  DDR01  = 0xfb;   // SIN3 = input\r
+/*\r
+       FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry.\r
+\r
+       This file is part of the FreeRTOS.org distribution.\r
+\r
+       FreeRTOS.org is free software; you can redistribute it and/or modify\r
+       it under the terms of the GNU General Public License as published by\r
+       the Free Software Foundation; either version 2 of the License, or\r
+       (at your option) any later version.\r
+\r
+       FreeRTOS.org is distributed in the hope that it will be useful,\r
+       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+       GNU General Public License for more details.\r
+\r
+       You should have received a copy of the GNU General Public License\r
+       along with FreeRTOS.org; if not, write to the Free Software\r
+       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+\r
+       A special exception to the GPL can be applied should you wish to distribute\r
+       a combined work that includes FreeRTOS.org, without being obliged to provide\r
+       the source code for any proprietary components.  See the licensing section \r
+       of http://www.FreeRTOS.org for full details of how and when the exception\r
+       can be applied.\r
+\r
+    ***************************************************************************\r
+    ***************************************************************************\r
+    *                                                                         *\r
+    * SAVE TIME AND MONEY!  We can port FreeRTOS.org to your own hardware,    *\r
+    * and even write all or part of your application on your behalf.          *\r
+    * See http://www.OpenRTOS.com for details of the services we provide to   *\r
+    * expedite your project.                                                  *\r
+    *                                                                         *\r
+    ***************************************************************************\r
+    ***************************************************************************\r
+\r
+       Please ensure to read the configuration and relevant port sections of the\r
+       online documentation.\r
+\r
+       http://www.FreeRTOS.org - Documentation, latest information, license and \r
+       contact details.\r
+\r
+       http://www.SafeRTOS.com - A version that is certified for use in safety \r
+       critical systems.\r
+\r
+       http://www.OpenRTOS.com - Commercial support, development, porting, \r
+       licensing and training services.\r
 */\r
-  \r
-  PIER02 = 0x00;   // All inputs are disabled on this port \r
-  PDR02  = 0x00;\r
-  DDR02  = 0xff;\r
-    \r
-  PIER03 = 0x00;   // All inputs are disabled on this port \r
-  PDR03  = 0xff; \r
-  DDR03  = 0xff;   // Set Port3 as output (7Segment Display)\r
-  \r
-  PIER04 = 0x04;   // Enable P04_2/RX as input\r
-  PDR04  = 0x08;   // CAN TX = 1\r
-  DDR04  = 0xfb;   // CAN RX = input\r
-  \r
-  PIER05 = 0x00;   // All inputs are disabled on this port \r
-  ADER1  = 0;      // Use Port 5 as I/O-Port\r
-  PDR05  = 0x7f;\r
-  DDR05  = 0xff;   // Set Port5 as output (7Segment Display)\r
-  \r
-  PIER06 = 0x00;   // All inputs are disabled on this port \r
-  PDR06  = 0x00;\r
-  DDR06  = 0xff;\r
-  \r
-  while (1)\r
-  {\r
-    // DICE 1\r
-      \r
-    switch (dice1state)\r
-    {\r
-      case 0x00: // dice1 stopped\r
-                 if (PDR00_P0 == 1)              // Key SW2:INT8 pressed\r
-                 {\r
-                   dice1run = DICERUN_MIN;\r
-                   srand((unsigned char)dice1run);\r
-                   dice1state = 0x01;\r
-                 }\r
-\r
-                 break;\r
-                \r
-      case 0x01: // dice1 startup\r
-                 if (dice1run < DICERUN_MAX)     // variable running time\r
-                   dice1run++;\r
-                 else\r
-                   dice1run = DICERUN_MIN;\r
-            \r
-                 if (PDR00_P0 == 0)              // Key SW2:INT8 released\r
-                 {\r
-                   dice1delay    = 1;\r
-                   dice1delayrld = 1;\r
-                   dice1state = 0x02;\r
-                 }\r
-                                  \r
-                 break;\r
-\r
-      case 0x02: // dice1 running\r
-                 dice1run--;\r
-                 dice1delay--;\r
-\r
-                 if (!dice1delay)\r
-                 {\r
-                   do                       // get new random number\r
-                   {\r
-                    temp = rand() % 6 + 1;\r
-                   }\r
-                   while (temp == dice1);\r
-                   dice1 = temp;\r
-                   \r
-                   PDR03 = (PDR03 | 0xf7) & DICE7SEG1[dice1];\r
-                   dice1delayrld = dice1delayrld + 100;\r
-                   dice1delay = dice1delayrld;\r
-                 }\r
-\r
-                 if (dice1run == 0)         // dice stopped\r
-                 {\r
-                   PDR03 = (PDR03 | 0xf7) & DICE7SEG1[rand() % 6 + 1];\r
-                   dice1state = 0x00;\r
-                 }\r
-\r
-                 break;\r
-\r
-    }//switch (dice1state)\r
-      \r
-      \r
-    // DICE 2\r
-      \r
-    switch (dice2state)\r
-    {\r
-      case 0x00: // dice2 stopped\r
-                 if (PDR00_P1 == 1)              // Key SW3:INT9 pressed\r
-                 {\r
-                   dice2run = DICERUN_MIN;\r
-                   srand((unsigned char)dice1run);\r
-                   dice2state = 0x01;\r
-                 }\r
-\r
-                 break;\r
-                \r
-      case 0x01: // dice2 startup\r
-                 if (dice2run < DICERUN_MAX)     // variable running time\r
-                   dice2run++;\r
-                 else\r
-                   dice2run = DICERUN_MIN;\r
-            \r
-                 if (dice2 == DICE_MAX)          // simple 'random' number\r
-                   dice2 = DICE_MIN;\r
-                 else dice2++;\r
-\r
-                 if (PDR00_P1 == 0)              // Key SW3:INT9 released\r
-                 {\r
-                   dice2delay    = 1;\r
-                   dice2delayrld = 1;\r
-                   dice2state = 0x02;\r
-                 }\r
-                                  \r
-                 break;\r
-\r
-      case 0x02: // dice2 running\r
-                 dice2run--;\r
-                 dice2delay--;\r
-\r
-                 if (!dice2delay)\r
-                 {\r
-                   do                       // get new random number\r
-                   {\r
-                    temp = rand() % 6 + 1;\r
-                   }\r
-                   while (temp == dice2);\r
-                   dice2 = temp;\r
-                   \r
-                   PDR05 = DICE7SEG2[dice2];\r
-                   dice2delayrld = dice2delayrld + 100;\r
-                   dice2delay = dice2delayrld;\r
-                 }\r
-\r
-                 if (dice2run == 0)         // dice stopped\r
-                 {\r
-                   PDR05 = DICE7SEG2[rand() % 6 + 1];\r
-                   dice2state = 0x00;\r
-                 }\r
-\r
-                 break;\r
-\r
-    }//switch (dice2state)\r
-    \r
-  } // while(1)\r
 \r
+/* Kernel includes. */\r
+#include "FreeRTOS.h"\r
+#include "Task.h"\r
+\r
+/* Demo includes. */\r
+#include "DiceTask.h"\r
+\r
+static void prvSetupHardware( void );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void main( void )\r
+{\r
+       prvSetupHardware();\r
+\r
+       xTaskCreate( vDiceTask, ( signed char * ) "Dice", configMINIMAL_STACK_SIZE, ( void * ) 0, tskIDLE_PRIORITY, NULL );\r
+\r
+       vTaskStartScheduler();\r
+\r
+       while( 1 );\r
 }\r
+/*-----------------------------------------------------------*/\r
 \r
 void vApplicationIdleHook( void )\r
 {\r
 }\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvSetupHardware( void )\r
+{\r
+       /* Setup interrupt hardware - interrupts are kept disabled for now to\r
+       prevent any interrupts attempting to cause a context switch before the\r
+       scheduler has been started. */\r
+       InitIrqLevels();\r
+       portDISABLE_INTERRUPTS();\r
+       __set_il( 7 );  \r
+\r
+       /* Enable P00_0/INT8 and P00_1/INT9 as input. */\r
+       PIER00 = 0x03;\r
+       PDR00  = 0x00;\r
+       DDR00  = 0xfc;\r
+\r
+       /* Set Port3 as output (7Segment Display). */\r
+       DDR03  = 0xff;\r
+\r
+       /* Enable P04_2/RX as input. */\r
+       PIER04 = 0x04;\r
+\r
+       /* CAN TX = 1. */\r
+       PDR04  = 0x08;\r
+\r
+       /* CAN RX = input. */\r
+       DDR04  = 0xfb;\r
+\r
+       /* All inputs are disabled on this port. */\r
+       PIER05 = 0x00;\r
+\r
+       /* Use Port 5 as I/O-Port. */\r
+       ADER1  = 0;\r
+       PDR05  = 0x7f;\r
+\r
+       /* Set Port5 as output (7Segment Display). */\r
+       DDR05  = 0xff;\r
+\r
+       /* Disable inputs on the following ports. */\r
+       PIER02 = 0x00;\r
+       PDR02  = 0x00;\r
+       DDR02  = 0xff;\r
+       PIER03 = 0x00;\r
+       PDR03  = 0xff;\r
+       PIER06 = 0x00;\r
+       PDR06  = 0x00;\r
+       DDR06  = 0xff;\r
+}\r
 \r
index e14b6300a8e2d2f16ec1d67a12d39c25cce2b70d..e3b558dbb0b40a400c6d2be95ee31dc160bad723 100644 (file)
@@ -54,12 +54,13 @@ $2
 -Xals\r
 -Xalr\r
 -na\r
+-NCI0302LIB\r
 -w 2\r
 -Xdof\r
 $other\r
 -Xset_rora\r
 $time\r
-1232226688\r
+1233316909\r
 $end\r
 $3\r
 -dt s,d,r,a\r
@@ -69,7 +70,7 @@ $3
 -Xdof\r
 $other\r
 $time\r
-1232226688\r
+1233316440\r
 $end\r
 $4\r
 -Xdof\r
index 9b37089f5db626096f0b29733dd5f26e1aa83db7..509287e43a9ff1fe320bdae07fd6f10b20a2028d 100644 (file)
@@ -9,6 +9,7 @@
 -----------------------------------------------------------------------------*/\r
 \r
 #include "mb96356rs.h"\r
+#include "FreeRTOSConfig.h"\r
 \r
 /*---------------------------------------------------------------------------\r
    InitIrqLevels()\r
@@ -32,7 +33,9 @@ void InitIrqLevels(void)
   {\r
     ICR = (irq << 8) | DEFAULT_ILM_MASK;\r
   }\r
-  \r
+\r
+       ICR = ( (54 & 0xFF) << 8 ) | configKERNEL_INTERRUPT_PRIORITY;                   /* Reload Timer 0 */\r
+       ICR = ( (12 & 0xFF) << 8 ) | configKERNEL_INTERRUPT_PRIORITY;                   /* Delayed interrupt of 16FX Family */\r
 }\r
 \r
 /*---------------------------------------------------------------------------\r
@@ -40,8 +43,11 @@ void InitIrqLevels(void)
    Add your own prototypes here. Each vector definition needs is proto-\r
    type. Either do it here or include a header file containing them.\r
 -----------------------------------------------------------------------------*/\r
+__interrupt void               DefaultIRQHandler( void );\r
 \r
-__interrupt void DefaultIRQHandler (void);\r
+extern __interrupt void prvRLT0_TICKISR( void );\r
+extern __interrupt void vPortYield( void );\r
+extern __interrupt void vPortYieldDelayed( void );\r
 \r
 /*---------------------------------------------------------------------------\r
    Vector definiton for MB9635x\r
@@ -53,7 +59,9 @@ __interrupt void DefaultIRQHandler (void);
 -----------------------------------------------------------------------------*/\r
 \r
 #pragma intvect DefaultIRQHandler 11   /* Non-maskable Interrupt       */\r
-#pragma intvect DefaultIRQHandler 12   /* Delayed Interrupt            */\r
+\r
+#pragma intvect vPortYieldDelayed 12           /* Delayed Interrupt            */\r
+\r
 #pragma intvect DefaultIRQHandler 13   /* RC Timer                     */\r
 #pragma intvect DefaultIRQHandler 14   /* Main Clock Timer             */\r
 #pragma intvect DefaultIRQHandler 15   /* Sub Clock Timer              */\r
@@ -95,7 +103,7 @@ __interrupt void DefaultIRQHandler (void);
 #pragma intvect DefaultIRQHandler 51   /* PPG17                        */\r
 #pragma intvect DefaultIRQHandler 52   /* PPG18                        */\r
 #pragma intvect DefaultIRQHandler 53   /* PPG19                        */\r
-#pragma intvect DefaultIRQHandler 54   /* RLT0                         */\r
+#pragma intvect prvRLT0_TICKISR 54   /* RLT0                         */\r
 #pragma intvect DefaultIRQHandler 55   /* RLT1                         */\r
 #pragma intvect DefaultIRQHandler 56   /* RLT2                         */\r
 #pragma intvect DefaultIRQHandler 57   /* RLT3                         */\r
@@ -126,18 +134,18 @@ __interrupt void DefaultIRQHandler (void);
 #pragma intvect DefaultIRQHandler 92   /* LIN-UART 8 TX                */\r
 #pragma intvect DefaultIRQHandler 93   /* MAIN FLASH IRQ               */\r
 \r
+#pragma intvect vPortYield 122            /* INT #122       */\r
+\r
 /*---------------------------------------------------------------------------\r
    DefaultIRQHandler()\r
    This function is a placeholder for all vector definitions. Either use\r
    your own placeholder or add necessary code here. \r
 -----------------------------------------------------------------------------*/\r
-\r
-__interrupt \r
-void DefaultIRQHandler (void)\r
+__interrupt void DefaultIRQHandler( void )\r
 {\r
-    __DI();                              /* disable interrupts */\r
-    while(1)\r
-    {\r
-        __wait_nop();                    /* halt system */\r
-    }\r
+       __DI();                         /* disable interrupts */\r
+       while( 1 )\r
+       {\r
+               __wait_nop();   /* halt system */\r
+       }\r
 }\r