//****************************************************************************
// @Module        Parallel Ports
// @Filename      IO.c
// @Project       template.dav
//----------------------------------------------------------------------------
// @Controller    Infineon XE167FH-200F100
//
// @Compiler      Keil
//
// @Codegenerator 2.1
//
// @Description   This file contains functions that use the IO module.
//
//----------------------------------------------------------------------------
// @Date          9/8/2016 11:22:00
//
//****************************************************************************

// USER CODE BEGIN (IO_General,1)

// USER CODE END



//****************************************************************************
// @Project Includes
//****************************************************************************

#include "MAIN.h"

// USER CODE BEGIN (IO_General,2)

// USER CODE END


//****************************************************************************
// @Macros
//****************************************************************************

// USER CODE BEGIN (IO_General,3)

// USER CODE END


//****************************************************************************
// @Defines
//****************************************************************************

// USER CODE BEGIN (IO_General,4)

// USER CODE END


//****************************************************************************
// @Typedefs
//****************************************************************************

// USER CODE BEGIN (IO_General,5)

// USER CODE END


//****************************************************************************
// @Imported Global Variables
//****************************************************************************

// USER CODE BEGIN (IO_General,6)

// USER CODE END


//****************************************************************************
// @Global Variables
//****************************************************************************

// USER CODE BEGIN (IO_General,7)

// USER CODE END


//****************************************************************************
// @External Prototypes
//****************************************************************************

// USER CODE BEGIN (IO_General,8)

// USER CODE END


//****************************************************************************
// @Prototypes Of Local Functions
//****************************************************************************

// USER CODE BEGIN (IO_General,9)

// USER CODE END


//****************************************************************************
// @Function      void IO_vInit(void) 
//
//----------------------------------------------------------------------------
// @Description   This is the initialization function of the IO function 
//                library. It is assumed that the SFRs used by this library 
//                are in reset state. 
//
//----------------------------------------------------------------------------
// @Returnvalue   None
//
//----------------------------------------------------------------------------
// @Parameters    None
//
//----------------------------------------------------------------------------
// @Date          9/8/2016
//
//****************************************************************************

// USER CODE BEGIN (IO_Function,1)

// USER CODE END

void IO_vInit(void)
{
  // USER CODE BEGIN (IO_Function,2)

  // USER CODE END


  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P0:
  ///  -----------------------------------------------------------------------
  ///  P0.0 is used as alternate output for the EBC address line 0(A0)
  ///  - push/pull output is selected
  ///  P0.1 is used as alternate output for the EBC address line 1(A1)
  ///  - push/pull output is selected
  ///  P0.2 is used as alternate output for the EBC address line 2(A2)
  ///  - push/pull output is selected
  ///  P0.3 is used as alternate output for the EBC address line 3(A3)
  ///  - push/pull output is selected
  ///  P0.4 is used as alternate output for the EBC address line 4(A4)
  ///  - push/pull output is selected
  ///  P0.5 is used as alternate output for the EBC address line 5(A5)
  ///  - push/pull output is selected
  ///  P0.6 is used as alternate output for the EBC address line 6(A6)
  ///  - push/pull output is selected
  ///  P0.7 is used as alternate output for the EBC address line 7(A7)
  ///  - push/pull output is selected

  ///  P0.0 - P0.3 output driver characteristic: strong driver
  ///  P0.4 - P0.7 output driver characteristic: strong driver

  ///  P0.0 - P0.3 output edge characteristic: sharp edge mode
  ///  P0.4 - P0.7 output edge characteristic: sharp edge mode


  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P1:
  ///  -----------------------------------------------------------------------
  ///  P1.0 is used as alternate output for the EBC address line 8(A8)
  ///  - push/pull output is selected
  ///  P1.1 is used as alternate output for the EBC address line 9(A9)
  ///  - push/pull output is selected
  ///  P1.2 is used as alternate output for the EBC address line 10(A10)
  ///  - push/pull output is selected
  ///  P1.3 is used as alternate output for the EBC address line 11(A11)
  ///  - push/pull output is selected
  ///  P1.4 is used as alternate output for the EBC address line 12(A12)
  ///  - push/pull output is selected
  ///  P1.5 is used as alternate output for the EBC address line 13(A13)
  ///  - push/pull output is selected
  ///  P1.6 is used as alternate output for the EBC address line 14(A14)
  ///  - push/pull output is selected
  ///  P1.7 is used as alternate output for the EBC address line 15(A15)
  ///  - push/pull output is selected

  ///  P1.0 - P1.3 output driver characteristic: strong driver
  ///  P1.4 - P1.7 output driver characteristic: strong driver

  ///  P1.0 - P1.3 output edge characteristic: sharp edge mode
  ///  P1.4 - P1.7 output edge characteristic: sharp edge mode


  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P2:
  ///  -----------------------------------------------------------------------
  ///  P2.0 is used as alternate output for the EBC address/Data line 13(AD13)
  ///  - push/pull output is selected
  ///  P2.1 is used as alternate output for the EBC address/Data line 14(AD14)
  ///  - push/pull output is selected
  ///  P2.2 is used as alternate output for the EBC address/Data line 15(AD15)
  ///  - push/pull output is selected
  ///  P2.3 is used as alternate output for the EBC address line 16(A16)
  ///  - push/pull output is selected
  ///  P2.4 is used as alternate output for the EBC address line 17(A17)
  ///  - push/pull output is selected
  ///  P2.5 is used as alternate output for the EBC address line 18(A18)
  ///  - push/pull output is selected
  ///  P2.11 is used as alternate output for the EBC Byte High Enable 
  ///  Output(BHE_n)
  ///  - push/pull output is selected
  ///  P2.12 is used as alternate input for the External Bus Controller Ready 
  ///  signal (READY)

  ///  P2.0 - P2.3 output driver characteristic: strong driver
  ///  P2.4 - P2.7 output driver characteristic: strong driver
  ///  P2.8 - P2.13 output driver characteristic: strong driver

  ///  P2.0 - P2.3 output edge characteristic: sharp edge mode
  ///  P2.4 - P2.7 output edge characteristic: sharp edge mode
  ///  P2.8 - P2.13 output edge characteristic: sharp edge mode


  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P3:
  ///  -----------------------------------------------------------------------
  ///  P3.0 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.1 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.2 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.3 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.4 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.5 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.6 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.7 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level

  ///  P3.0 - P3.3 output driver characteristic: strong driver
  ///  P3.4 - P3.7 output driver characteristic: strong driver

  ///  P3.0 - P3.3 output edge characteristic: sharp edge mode
  ///  P3.4 - P3.7 output edge characteristic: sharp edge mode

  P3_IOCR00      =  0x0080;      // load port control register 0
  P3_IOCR01      =  0x0080;      // load port control register 1
  P3_IOCR02      =  0x0080;      // load port control register 2
  P3_IOCR03      =  0x0080;      // load port control register 3
  P3_IOCR04      =  0x0080;      // load port control register 4
  P3_IOCR05      =  0x0080;      // load port control register 5
  P3_IOCR06      =  0x0080;      // load port control register 6
  P3_IOCR07      =  0x0080;      // load port control register 7

  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P4:
  ///  -----------------------------------------------------------------------
  ///  P4.0 is used as alternate output for the EBC Chip Select0 bar(CS0)
  ///  - push/pull output is selected
  ///  P4.1 is used as alternate output for the EBC Chip Select1 bar(CS1)
  ///  - push/pull output is selected
  ///  P4.2 is used as alternate output for the EBC Chip Select2 bar(CS2)
  ///  - push/pull output is selected
  ///  P4.5 is used as alternate input for the CAPCOM2 input(CC2_29)
  ///  P4.6 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P4.7 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level

  ///  P4.0 - P4.3 output driver characteristic: strong driver
  ///  P4.4 - P4.7 output driver characteristic: strong driver

  ///  P4.0 - P4.3 output edge characteristic: sharp edge mode
  ///  P4.4 - P4.7 output edge characteristic: sharp edge mode

  P4_IOCR06      =  0x0080;      // load port control register 6
  P4_IOCR07      =  0x0080;      // load port control register 7

  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P5:
  ///  -----------------------------------------------------------------------
  ///  - no pin of port P5 is used
  ///  - Port5 Data register P5(Read only)


  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P6:
  ///  -----------------------------------------------------------------------
  ///  P6.1 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level

  ///  P6.0 - P6.3 output driver characteristic: strong driver

  ///  P6.0 - P6.3 output edge characteristic: sharp edge mode

  P6_IOCR01      =  0x0080;      // load port control register 1

  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P7:
  ///  -----------------------------------------------------------------------
  ///  P7.3 is used as alternate output for the USIC0 Channel0 Shift Data 
  ///  output(DOUT)
  ///  - push/pull output is selected
  ///  P7.4 is used as alternate input for the USIC0 Channel0 Shift Data 
  ///  input(DX0D)

  ///  P7.0 - P7.3 output driver characteristic: strong driver
  ///  P7.4 - P7.4 output driver characteristic: strong driver

  ///  P7.0 - P7.3 output edge characteristic: sharp edge mode
  ///  P7.4 - P7.4 output edge characteristic: sharp edge mode


  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P8:
  ///  -----------------------------------------------------------------------
  ///  P8.1 is used as alternate input for the CAN1 Receive input(RXDC1F)
  ///  P8.2 is used as alternate output for the CAN1 Transmit output(TXDC1D)
  ///  - push/pull output is selected

  ///  P8.0 - P8.3 output driver characteristic: strong driver
  ///  P8.4 - P8.6 output driver characteristic: strong driver

  ///  P8.0 - P8.3 output edge characteristic: sharp edge mode
  ///  P8.4 - P8.6 output edge characteristic: sharp edge mode


  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P9:
  ///  -----------------------------------------------------------------------
  ///  P9.0 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P9.1 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P9.2 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P9.3 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P9.4 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P9.5 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P9.6 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P9.7 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level

  ///  P9.0 - P9.3 output driver characteristic: strong driver
  ///  P9.4 - P9.7 output driver characteristic: strong driver

  ///  P9.0 - P9.3 output edge characteristic: sharp edge mode
  ///  P9.4 - P9.7 output edge characteristic: sharp edge mode

  P9_IOCR00      =  0x0080;      // load port control register 0
  P9_IOCR01      =  0x0080;      // load port control register 1
  P9_IOCR02      =  0x0080;      // load port control register 2
  P9_IOCR03      =  0x0080;      // load port control register 3
  P9_IOCR04      =  0x0080;      // load port control register 4
  P9_IOCR05      =  0x0080;      // load port control register 5
  P9_IOCR06      =  0x0080;      // load port control register 6
  P9_IOCR07      =  0x0080;      // load port control register 7

  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P10:
  ///  -----------------------------------------------------------------------
  ///  P10.0 is used as alternate output for the EBC address/Data line0(AD0)
  ///  - push/pull output is selected
  ///  P10.1 is used as alternate output for the EBC address/Data line1(AD1)
  ///  - push/pull output is selected
  ///  P10.2 is used as alternate output for the EBC address/Data line2(AD2)
  ///  - push/pull output is selected
  ///  P10.3 is used as alternate output for the EBC address/Data line3(AD3)
  ///  - push/pull output is selected
  ///  P10.4 is used as alternate output for the EBC address/Data line4(AD4)
  ///  - push/pull output is selected
  ///  P10.5 is used as alternate output for the EBC address/Data line5(AD5)
  ///  - push/pull output is selected
  ///  P10.6 is used as alternate output for the EBC address/Data line6(AD6)
  ///  - push/pull output is selected
  ///  P10.7 is used as alternate output for the EBC address/Data line7(AD7)
  ///  - push/pull output is selected
  ///  P10.8 is used as alternate output for the EBC address/Data line8(AD8)
  ///  - push/pull output is selected
  ///  P10.9 is used as alternate output for the EBC address/Data line9(AD9)
  ///  - push/pull output is selected
  ///  P10.10 is used as alternate output for the EBC address/Data 
  ///  line10(AD10)
  ///  - push/pull output is selected
  ///  P10.11 is used as alternate output for the EBC address/Data 
  ///  line11(AD11)
  ///  - push/pull output is selected
  ///  P10.12 is used as alternate output for the EBC address/Data 
  ///  line12(AD12)
  ///  - push/pull output is selected
  ///  P10.13 is used as alternate output for the EBC Write signal(WR)
  ///  - push/pull output is selected
  ///  P10.14 is used as alternate output for the EBC Read signal(RD)
  ///  - push/pull output is selected
  ///  P10.15 is used as alternate output for the EBC Address Latch 
  ///  Enable(ALE)
  ///  - push/pull output is selected

  ///  P10.0 - P10.3 output driver characteristic: strong driver
  ///  P10.4 - P10.7 output driver characteristic: strong driver
  ///  P10.8 - P10.11 output driver characteristic: strong driver
  ///  P10.12 - P10.15 output driver characteristic: strong driver

  ///  P10.0 - P10.3 output edge characteristic: sharp edge mode
  ///  P10.4 - P10.7 output edge characteristic: sharp edge mode
  ///  P10.8 - P10.11 output edge characteristic: sharp edge mode
  ///  P10.12 - P10.15 output edge characteristic: sharp edge mode


  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P11:
  ///  -----------------------------------------------------------------------
  ///  P11.0 is used as alternate input for the CAN0 Receive input(RXDC0F)
  ///  P11.1 is used as alternate output for the CAN0 Transmit Output(TXDC0F)
  ///  - push/pull output is selected
  ///  P11.2 is used as alternate output for the USIC3 Channel1 Shift Data 
  ///  output(DOUT)
  ///  - push/pull output is selected
  ///  P11.4 is used as alternate input for the USIC3 Channel1 Shift Data 
  ///  input(DX0B)
  ///  P11.5 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level

  ///  P11.0 - P11.3 output driver characteristic: strong driver
  ///  P11.4 - P11.5 output driver characteristic: strong driver

  ///  P11.0 - P11.3 output edge characteristic: sharp edge mode
  ///  P11.4 - P11.5 output edge characteristic: sharp edge mode

  P11_IOCR05     =  0x0080;      // load port control register 5

  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P15:
  ///  -----------------------------------------------------------------------
  ///  - no pin of port P15 is used
  ///  - Port15 Data register P15(Read only)



  // USER CODE BEGIN (IO_Function,3)

  // USER CODE END

} //  End of function IO_vInit




// USER CODE BEGIN (IO_General,10)

// USER CODE END

