/* ######################################################################  
 *                                                                          
 *                              RAppID                                      
 *      Rapid Application Initialization and Documentation Tool             
 *                    freescale Virtual Garage                               
 *                   MPC5554 Configuration Tool                             
 *          Automatically Generated Initialization Code                      
 *                      For eSCI Module                                  
 * #######################################################################  
 *                                                                          
 *  Project Name: base                                           
 *                                                                          
 *  Project File: base.mat                                       
 *                                                                          
 *  Revision Number: 1.85                                          
 *                                                                          
 *  Tool Version: 1.1.1                                               
 *                                                                          
 *  Target Compiler: metrowerks                                           
 *                                                                          
 *  Target Part: 5554                                                  
 *                                                                          
 *  Part Errata Fixes: None                                           
 *                                                                          
 *  Project Last Save Date: 25-Sep-2008 20:48:19                                    
 *                                                                          
 *  FunctionName::esci_init::FunctionName                                
 *                                                                          
 *  Date : 25-Sep-2008  Time : 20:48:27.691                                       
 *
 * ####################################################################### */

// ******************  Dependent Include files Here **********************
#include "esci_init.h"

// ################### User Custom Code Section ######################### 
//  User Custom Code Section ::esci_init::includes_start::

//  ::includes_end::      User Custom Code Section ::esci_init::
// ################### User Custom Code Section ######################### 

// ************************** Pragma Section **************************

// ################### User Custom Code Section ######################### 
//  User Custom Code Section ::esci_init::custom_start::

//  ::custom_end::        User Custom Code Section ::esci__init::
// ################### User Custom Code Section ######################### 

/* eSCI Initialization Function */

void esci_init(void)
{

  ESCI_A_init();
  ESCI_B_init();
}                                       /* End of esci_init*/

/* ESCI_A Initialization Function */

void ESCI_A_init(void)
{

  /* Enable eSCI Module */
  ESCI_A.CR2.B.MDIS = 0;                /* set enable bit */

  /* Set the SCI registers */

  /* Set eSCI Control Register 1 */
  ESCI_A.CR1.R = 0x01A1002C;

  /* Set eSCI Control Register 2 */
  ESCI_A.CR2.R = 0x400;

  /* Set the LIN Control registers */

  /* Set LIN Control Register */
  ESCI_A.LCR.R = 0x00000000;

  /* Set the LIN CRC register */

  /* Set LIN CRC Registers */
  ESCI_A.LPR.R = 0xC5990000;
}

/* ESCI_B Initialization Function */

void ESCI_B_init(void)
{

  /* Enable eSCI Module */
  ESCI_B.CR2.B.MDIS = 0;                /* set enable bit */

  /* Set the SCI registers */

  /* Set eSCI Control Register 1 */
  ESCI_B.CR1.R = 0x00040000;

  /* Set eSCI Control Register 2 */
  ESCI_B.CR2.R = 0x0;

  /* Set the LIN Control registers */

  /* Set LIN Control Register */
  ESCI_B.LCR.R = 0x00000000;

  /* Set the LIN CRC register */

  /* Set LIN CRC Registers */
  ESCI_B.LPR.R = 0xC5990000;
}

