| 1 | /***************************************************************************//** |
| 2 | * @file RDKRL78G14.h |
| 3 | * @brief Header file of the RDKRL78G14 Driver. |
| 4 | * @author DBogdan ([email protected]) |
| 5 | ******************************************************************************** |
| 6 | * Copyright 2012(c) Analog Devices, Inc. |
| 7 | * |
| 8 | * All rights reserved. |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or without |
| 11 | * modification, are permitted provided that the following conditions are met: |
| 12 | * - Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * - Redistributions in binary form must reproduce the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer in |
| 16 | * the documentation and/or other materials provided with the |
| 17 | * distribution. |
| 18 | * - Neither the name of Analog Devices, Inc. nor the names of its |
| 19 | * contributors may be used to endorse or promote products derived |
| 20 | * from this software without specific prior written permission. |
| 21 | * - The use of this software may or may not infringe the patent rights |
| 22 | * of one or more patent holders. This license does not release you |
| 23 | * from the requirement that you obtain separate licenses from these |
| 24 | * patent holders to use this software. |
| 25 | * - Use of the software either in source or binary form, must be run |
| 26 | * on or directly connected to an Analog Devices Inc. component. |
| 27 | * |
| 28 | * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR |
| 29 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
| 30 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 31 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 33 | * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 34 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 36 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 38 | * |
| 39 | ******************************************************************************** |
| 40 | * SVN Revision: $WCREV$ |
| 41 | *******************************************************************************/ |
| 42 | |
| 43 | #ifndef __RDKRL78G14_H__ |
| 44 | #define __RDKRL78G14_H__ |
| 45 | |
| 46 | /******************************************************************************/ |
| 47 | /***************************** Include Files **********************************/ |
| 48 | /******************************************************************************/ |
| 49 | |
| 50 | #include <ior5f104pj.h> // R5F104PJ definitions |
| 51 | #include <ior5f104pj_ext.h> // Declarations of extended SFR registers |
| 52 | #include <intrinsics.h> // Declarations of intrinsic functions |
| 53 | |
| 54 | /******************************************************************************/ |
| 55 | /************************* Operations Definitions *****************************/ |
| 56 | /******************************************************************************/ |
| 57 | |
| 58 | #define NOP __no_operation(); // No operation |
| 59 | #define EI __enable_interrupt(); // Enable interrupts |
| 60 | #define DI __disable_interrupt(); // Disable interrupts |
| 61 | |
| 62 | /******************************************************************************/ |
| 63 | /**************************** GPIO Definitions ********************************/ |
| 64 | /******************************************************************************/ |
| 65 | |
| 66 | /* External Reset Pin - P130 */ |
| 67 | #define EXTRST_PIN (1 << 0) |
| 68 | #define EXTRST_LOW P13 &= ~EXTRST_PIN |
| 69 | #define EXTRST_HIGH P13 |= EXTRST_PIN |
| 70 | |
| 71 | /* ST7579 CS Pin - P145 */ |
| 72 | #define ST7579_CS_PIN (1 << 5) |
| 73 | #define ST7579_CS_OUT PM14 &= ~ST7579_CS_PIN |
| 74 | #define ST7579_CS_LOW P14 &= ~ST7579_CS_PIN |
| 75 | #define ST7579_CS_HIGH P14 |= ST7579_CS_PIN |
| 76 | |
| 77 | /* ST7579 RS Pin - P146 */ |
| 78 | #define ST7579_RS_PIN (1 << 6) |
| 79 | #define ST7579_RS_OUT PM14 &= ~ST7579_RS_PIN |
| 80 | #define ST7579_RS_LOW P14 &= ~ST7579_RS_PIN |
| 81 | #define ST7579_RS_HIGH P14 |= ST7579_RS_PIN |
| 82 | |
| 83 | /* PMOD1 CS Pin - P83 */ |
| 84 | #define PMOD1_CS_PIN (1 << 3) |
| 85 | #define PMOD1_CS_OUT PM8 &= ~PMOD1_CS_PIN |
| 86 | #define PMOD1_CS_LOW P8 &= ~PMOD1_CS_PIN |
| 87 | #define PMOD1_CS_HIGH P8 |= PMOD1_CS_PIN |
| 88 | |
| 89 | /* PMOD1 MISO Pin */ |
| 90 | #define PMOD1_MISO_PIN (1 << 1) |
| 91 | #define PMOD1_MISO ((P7 & PMOD1_MISO_PIN) >> 1) |
| 92 | |
| 93 | /* PMOD1 GPIO1 Pin - P47 */ |
| 94 | #define PMOD1_GPIO1_PIN (1 << 7) |
| 95 | #define PMOD1_GPIO1_PIN_OUT PM4 &= ~PMOD1_GPIO1_PIN; |
| 96 | #define PMOD1_GPIO1_LOW P4 &= ~PMOD1_GPIO1_PIN; |
| 97 | #define PMOD1_GPIO1_HIGH P4 |= PMOD1_GPIO1_PIN; |
| 98 | |
| 99 | /* PMOD1 GPIO2 Pin - P46 */ |
| 100 | #define PMOD1_GPIO2_PIN (1 << 6) |
| 101 | #define PMOD1_GPIO2_PIN_OUT PM4 &= ~PMOD1_GPIO2_PIN; |
| 102 | #define PMOD1_GPIO2_LOW P4 &= ~PMOD1_GPIO2_PIN; |
| 103 | #define PMOD1_GPIO2_HIGH P4 |= PMOD1_GPIO2_PIN; |
| 104 | |
| 105 | /* PMOD1 GPIO3 Pin - P110 */ |
| 106 | #define PMOD1_GPIO3_PIN (1 << 0) |
| 107 | #define PMOD1_GPIO3_PIN_OUT PM11 &= ~PMOD1_GPIO3_PIN; |
| 108 | #define PMOD1_GPIO3_LOW P11 &= ~PMOD1_GPIO3_PIN; |
| 109 | #define PMOD1_GPIO3_HIGH P11 |= PMOD1_GPIO3_PIN; |
| 110 | |
| 111 | /* PMOD1 GPIO4 Pin - P111 */ |
| 112 | #define PMOD1_GPIO4_PIN (1 << 1) |
| 113 | #define PMOD1_GPIO4_PIN_OUT PM11 &= ~PMOD1_GPIO4_PIN; |
| 114 | #define PMOD1_GPIO4_LOW P11 &= ~PMOD1_GPIO4_PIN; |
| 115 | #define PMOD1_GPIO4_HIGH P11 |= PMOD1_GPIO4_PIN; |
| 116 | |
| 117 | /* PMOD2 CS Pin - P82 */ |
| 118 | #define PMOD2_CS_PIN (1 << 2) |
| 119 | #define PMOD2_CS_OUT PM8 &= ~PMOD2_CS_PIN |
| 120 | #define PMOD2_CS_LOW P8 &= ~PMOD2_CS_PIN |
| 121 | #define PMOD2_CS_HIGH P8 |= PMOD2_CS_PIN |
| 122 | |
| 123 | /******************************************************************************/ |
| 124 | /************************ Functions Declarations ******************************/ |
| 125 | /******************************************************************************/ |
| 126 | |
| 127 | /*! Resets the RDKRL78G14. */ |
| 128 | void RDKRL78G14_Reset(void); |
| 129 | |
| 130 | /*! Initializes the RDKRL78G14. */ |
| 131 | char RDKRL78G14_Init(void); |
| 132 | |
| 133 | #endif // __RDKRL78G14_H__ |