]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/HCS12_CodeWarrior_banked/CODE/_COM0.C
Update version number in readiness for V10.3.0 release. Sync SVN with reviewed releas...
[freertos] / FreeRTOS / Demo / HCS12_CodeWarrior_banked / CODE / _COM0.C
diff --git a/FreeRTOS/Demo/HCS12_CodeWarrior_banked/CODE/_COM0.C b/FreeRTOS/Demo/HCS12_CodeWarrior_banked/CODE/_COM0.C
new file mode 100644 (file)
index 0000000..e575af4
--- /dev/null
@@ -0,0 +1,205 @@
+/** ###################################################################\r
+**     THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.\r
+**     Filename  : COM0.C\r
+**     Project   : RTOSDemo\r
+**     Processor : MC9S12DP256BCPV\r
+**     Beantype  : AsynchroSerial\r
+**     Version   : Bean 02.231, Driver 01.08, CPU db: 2.87.283\r
+**     Compiler  : Metrowerks HC12 C Compiler\r
+**     Date/Time : 19/06/2005, 15:07\r
+**     Abstract  :\r
+**         This bean "AsynchroSerial" implements an asynchronous serial\r
+**         communication. The bean supports different settings of \r
+**         parity, word width, stop-bit and communication speed,\r
+**         user can select interrupt or polling handler.\r
+**         Communication speed can be changed also in runtime.\r
+**         The bean requires one on-chip asynchronous serial channel.\r
+**     Settings  :\r
+**         Serial channel              : SCI0\r
+**\r
+**         Protocol\r
+**             Init baud rate          : 38400baud\r
+**             Width                   : 8 bits\r
+**             Stop bits               : 1\r
+**             Parity                  : none\r
+**             Breaks                  : Disabled\r
+**\r
+**         Registers\r
+**             Input buffer            : SCI0DRL   [207]\r
+**             Output buffer           : SCI0DRL   [207]\r
+**             Control register        : SCI0CR1   [202]\r
+**             Mode register           : SCI0CR2   [203]\r
+**             Baud setting reg.       : SCI0BD    [200]\r
+**             Special register        : SCI0SR1   [204]\r
+**\r
+**         Input interrupt\r
+**             Vector name             : INT_SCI0\r
+**             Priority                : 1\r
+**\r
+**         Output interrupt\r
+**             Vector name             : INT_SCI0\r
+**             Priority                : 1\r
+**\r
+**         Used pins                   : \r
+**             ----------------------------------------------------\r
+**               Function | On package |    Name\r
+**             ----------------------------------------------------\r
+**                Input   |     89     |  PS0_RxD0\r
+**                Output  |     90     |  PS1_TxD0\r
+**             ----------------------------------------------------\r
+**\r
+**\r
+**         Used baud modes             :\r
+**             ----------------------------------------------------\r
+**               No. |    Mode ID      |  Baud rate\r
+**             ----------------------------------------------------\r
+**                0  |  Bm_38400baud   |  38400baud\r
+**                1  |  Bm_19200baud   |  19200baud\r
+**                2  |  Bm_9600baud    |  9600baud\r
+**                3  |  Bm_4800baud    |  4800baud\r
+**             ----------------------------------------------------\r
+**     Contents  :\r
+**         SetBaudRateMode - byte COM0_SetBaudRateMode(byte Mod);\r
+**\r
+**     (c) Copyright UNIS, spol. s r.o. 1997-2002\r
+**     UNIS, spol. s r.o.\r
+**     Jundrovska 33\r
+**     624 00 Brno\r
+**     Czech Republic\r
+**     http      : www.processorexpert.com\r
+**     mail      : info@processorexpert.com\r
+** ###################################################################*/\r
+\r
+/* MODULE COM0. */\r
+\r
+#pragma MESSAGE DISABLE C4002 /* WARNING C4002: Result not used is ignored */\r
+#pragma MESSAGE DISABLE C4301 /* INFORMATION C4301: Inline expansion done for function call */\r
+\r
+#include "COM0.h"\r
+#include "TickTimer.h"\r
+#include "Byte1.h"\r
+\r
+/* Definition of DATA and CODE segments for this bean. User can specify where\r
+   these segments will be located on "Build options" tab of the selected CPU bean. */\r
+#pragma DATA_SEG COM0_DATA             /* Data section for this module. */\r
+#pragma CODE_SEG COM0_CODE             /* Code section for this module. */\r
+\r
+\r
+#define OVERRUN_ERR      1             /* Overrun error flag bit   */\r
+#define FRAMING_ERR      2             /* Framing error flag bit   */\r
+#define PARITY_ERR       4             /* Parity error flag bit    */\r
+#define CHAR_IN_RX       8             /* Char is in RX buffer     */\r
+#define FULL_TX          16            /* Full transmit buffer     */\r
+#define RUNINT_FROM_TX   32            /* Interrupt is in progress */\r
+#define FULL_RX          64            /* Full receive buffer      */\r
+#define NOISE_ERR        128           /* Noise erorr flag bit     */\r
+#define IDLE_ERR         256           /* Idle character flag bit  */\r
+#define BREAK_ERR        512           /* Break detect             */\r
+\r
+static word SerFlag;                   /* Flags for serial communication */\r
+                                       /* Bits: 0 - OverRun error */\r
+                                       /*       1 - Framing error */\r
+                                       /*       2 - Parity error */\r
+                                       /*       3 - Char in RX buffer */\r
+                                       /*       4 - Full TX buffer */\r
+                                       /*       5 - Running int from TX */\r
+                                       /*       6 - Full RX buffer */\r
+                                       /*       7 - Noise error */\r
+                                       /*       8 - Idle character  */\r
+                                       /*       9 - Break detected  */\r
+                                       /*      10 - Unused */\r
+static word PrescHigh;\r
+static byte NumMode;                   /* Number of selected baud mode */\r
+\r
+\r
+/*\r
+** ===================================================================\r
+**     Method      :  HWEnDi (bean AsynchroSerial)\r
+**\r
+**     Description :\r
+**         This method is internal. It is used by Processor Expert\r
+**         only.\r
+** ===================================================================\r
+*/\r
+static void HWEnDi(void)\r
+{\r
+    SCI0CR2_TE = 1;                    /* Enable transmitter */\r
+    SCI0CR2_RE = 1;                    /* Enable receiver */\r
+    SCI0CR2_RIE = 1;                   /* Enable recieve interrupt */\r
+}\r
+\r
+/*\r
+** ===================================================================\r
+**     Method      :  COM0_SetBaudRateMode (bean AsynchroSerial)\r
+**\r
+**     Description :\r
+**         This method changes the channel communication speed (baud\r
+**         rate). This method can be used only if you specify a list\r
+**         of possible period settings at design time (see <Timing\r
+**         dialog box> - Runtime setting - from a list of values).\r
+**         Each of these settings constitutes a mode and Processor\r
+**         Expert^[TM] assigns them a mode identifier. The prescaler\r
+**         and compare values corresponding to each mode are\r
+**         calculated at design time. You may switch modes at\r
+**         runtime by referring only to a mode identifier. No\r
+**         run-time calculations are performed, all the calculations\r
+**         are performed at design time.\r
+**     Parameters  :\r
+**         NAME            - DESCRIPTION\r
+**         Mod             - Timing mode to set\r
+**     Returns     :\r
+**         ---             - Error code, possible codes:\r
+**                           ERR_OK - OK\r
+**                           ERR_SPEED - This device does not work in\r
+**                           the active speed mode\r
+** ===================================================================\r
+*/\r
+byte COM0_SetBaudRateMode(byte Mod)\r
+{\r
+  static const word COM0_PrescHigh[4] = {41,81,163,326};\r
+\r
+  if(Mod >= 4)                         /* Is mode in baud mode list */\r
+    return ERR_VALUE;                  /* If no then error */\r
+  NumMode = Mod;                       /* New baud mode */\r
+  PrescHigh = COM0_PrescHigh[Mod];     /* Prescaler in high speed mode */\r
+  SCI0BD = PrescHigh;                  /* Set prescaler bits */\r
+  return ERR_OK;                       /* OK */\r
+}\r
+\r
+/*\r
+** ===================================================================\r
+**     Method      :  COM0_Init (bean AsynchroSerial)\r
+**\r
+**     Description :\r
+**         This method is internal. It is used by Processor Expert\r
+**         only.\r
+** ===================================================================\r
+*/\r
+void COM0_Init(void)\r
+{\r
+  PrescHigh = 41;                      /* Precaler in high speed mode */\r
+  SerFlag = 0;                         /* Reset flags */\r
+  NumMode = 0;                         /* Number of selected baud mode */\r
+  /* SCI0CR1: LOOPS=0,SCISWAI=1,RSRC=0,M=0,WAKE=0,ILT=0,PE=0,PT=0 */\r
+  SCI0CR1 = 64;                        /* Set the SCI configuration */\r
+  /* SCI0SR2: ??=0,??=0,??=0,??=0,??=0,BRK13=0,TXDIR=0,RAF=0 */\r
+  SCI0SR2 = 0;                         /* Set the Break Character Length and Transmitter pin data direction in Single-wire mode */\r
+  SCI0SR1;                             /* Reset interrupt request flags */\r
+  /* SCI0CR2: SCTIE=0,TCIE=0,RIE=0,ILIE=0,TE=0,RE=0,RWU=0,SBK=0 */\r
+  SCI0CR2 = 0;                         /* Disable error interrupts */\r
+  SCI0BD = PrescHigh;                  /* Set prescaler bits */\r
+  HWEnDi();                            /* Enable/disable device according to status flags */\r
+}\r
+\r
+\r
+/* END COM0. */\r
+\r
+\r
+/*\r
+** ###################################################################\r
+**\r
+**     This file was created by UNIS Processor Expert 03.33 for \r
+**     the Motorola HCS12 series of microcontrollers.\r
+**\r
+** ###################################################################\r
+*/\r