mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-06 14:17:41 -04:00
Backup point only. YRDK RX63N building but not linking.
This commit is contained in:
parent
aa85a68636
commit
2f199771d5
33 changed files with 524 additions and 34403 deletions
|
@ -19,21 +19,20 @@
|
|||
/***********************************************************************************************************************
|
||||
* File Name : hwsetup.c
|
||||
* Device(s) : RX
|
||||
* H/W Platform : RSK+RX63N
|
||||
* H/W Platform : YRDKRX63N
|
||||
* Description : Defines the initialisation routines used each time the MCU is restarted.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 22.11.2011 1.00 First Release
|
||||
* : 26.10.2011 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
***********************************************************************************************************************/
|
||||
#include <stdint.h>
|
||||
/* I/O Register and board definitions */
|
||||
#include "platform.h"
|
||||
/* Contains delcarations for the functions defined in this file */
|
||||
#include "hwsetup.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Private global variables and functions
|
||||
|
@ -69,69 +68,86 @@ void hardware_setup(void)
|
|||
***********************************************************************************************************************/
|
||||
void output_ports_configure(void)
|
||||
{
|
||||
/* Enable LEDs. */
|
||||
/* Start with LEDs off. */
|
||||
LED0 = LED_OFF;
|
||||
LED1 = LED_OFF;
|
||||
LED2 = LED_OFF;
|
||||
LED3 = LED_OFF;
|
||||
SYSTEM.PRCR.WORD = 0xA50B; /* Protect off */
|
||||
MPC.PWPR.BIT.B0WI = 0 ; /* Unlock protection register */
|
||||
MPC.PWPR.BIT.PFSWE = 1 ; /* Unlock MPC registers */
|
||||
|
||||
MSTP(EDMAC) = 0 ; /* Power up ethernet block */
|
||||
|
||||
/* Port 0 - DAC & ethernet IRQ */
|
||||
PORT0.PODR.BYTE = 0x00 ; /* All outputs low to start */
|
||||
PORT0.PDR.BYTE = 0x10 ; /* DA1 is an ouput, all others are inputs */
|
||||
|
||||
/* Port 1 - I2C and USB over-current & pull-up control */
|
||||
PORT1.PODR.BYTE = 0x00 ; /* All outputs low to start */
|
||||
PORT1.PDR.BYTE = 0x80 ; /* AUD_R (P1.7) is an output, all others are inputs (I2C lines setup by
|
||||
* I2C driver later */
|
||||
|
||||
/* Port 2 - USB control and some expansion signals */
|
||||
PORT2.PODR.BYTE = 0x02 ; /* All outputs low to start except backlight enable */
|
||||
PORT2.PDR.BYTE = 0x02 ; /* All inputs except backlight enable - some will be overridden by USB driver later */
|
||||
|
||||
/* Port 3 - Serial port & JTAG */
|
||||
PORT3.PODR.BYTE = 0x00 ; /* All outputs low to start */
|
||||
PORT3.PDR.BIT.B2 = 0x01 ; /* Transmit line for SCI6/ CAN 0 TxD is an output */
|
||||
|
||||
/* Port 4 - */
|
||||
PORT4.PODR.BYTE = 0x00 ; /* These are all inputs */
|
||||
PORT4.PDR.BYTE = 0x00 ; /* Analog inputs and switches, all inputs */
|
||||
PORT4.PMR.BYTE = 0x00 ;
|
||||
|
||||
/* Set LED pins as outputs. */
|
||||
LED0_PDR = 1;
|
||||
LED1_PDR = 1;
|
||||
LED2_PDR = 1;
|
||||
LED3_PDR = 1;
|
||||
/* Port 5 - */
|
||||
PORT5.PODR.BYTE = 0x00 ; /* All outputs low to start */
|
||||
PORT5.PDR.BYTE = 0x13 ; /* SCI 2 TxD, LCD_RS, PWMLP_OUT are outputs */
|
||||
MPC.P50PFS.BYTE = 0x0A ; /* P50 is TXD2. */
|
||||
MPC.P52PFS.BYTE = 0x0A ; /* P52 is RXD2. */
|
||||
PORT5.PMR.BYTE = 0x05 ; /* P50 and P52 are used for SCI2. */
|
||||
|
||||
/* Enable switches. */
|
||||
/* Set pins as inputs. */
|
||||
SW1_PDR = 0;
|
||||
SW2_PDR = 0;
|
||||
SW3_PDR = 0;
|
||||
/* Port A - Ethernet MDIO */
|
||||
PORTA.PODR.BYTE = 0x00 ; /* */
|
||||
PORTA.PMR.BYTE = 0x00 ; /* All GPIO for now */
|
||||
MPC.PA3PFS.BYTE = 0x11 ; /* PA3 is RMII MDIO */
|
||||
MPC.PA4PFS.BYTE = 0x11 ; /* PA4 is RMII MDC */
|
||||
MPC.PA5PFS.BYTE = 0x11 ; /* PA5 is RMII LINK_STA */
|
||||
PORTA.PMR.BYTE = 0x38 ; /* PA3-5 are used by Ethernet peripheral */
|
||||
PORTA.PDR.BYTE = 0xFF ; /* */
|
||||
|
||||
/* Port B - Ethernet signals */
|
||||
PORTB.PODR.BYTE = 0x00 ; /* */
|
||||
PORTB.PMR.BYTE = 0x00 ; /* All GPIO for now */
|
||||
MPC.PB0PFS.BYTE = 0x12 ; /* PB0 is RMII_RXD1 */
|
||||
MPC.PB1PFS.BYTE = 0x12 ; /* PB1 is RMII_RXD0 */
|
||||
MPC.PB2PFS.BYTE = 0x12 ; /* PB2 is REF50CK */
|
||||
MPC.PB3PFS.BYTE = 0x12 ; /* PB3 is RMI_RX_ERR */
|
||||
MPC.PB4PFS.BYTE = 0x12 ; /* PB4 is RMII_TXD_EN */
|
||||
MPC.PB5PFS.BYTE = 0x12 ; /* PB5 is RMII_TXD0 */
|
||||
MPC.PB6PFS.BYTE = 0x12 ; /* PB6 is RMII_TXD1 */
|
||||
MPC.PB7PFS.BYTE = 0x12 ; /* PB7 is RMII_CRS_DV */
|
||||
PORTB.PMR.BYTE = 0xFF ; /* All pins assigned to peripheral */
|
||||
PORTB.PDR.BYTE = 0xF0 ; /* */
|
||||
|
||||
/* Port C - SPI signals, chip selects, peripheral reset */
|
||||
PORTC.PODR.BYTE = 0x00 ; /* */
|
||||
PORTC.PMR.BYTE = 0x00 ; /* All GPIO for now */
|
||||
MPC.PC5PFS.BYTE = 0x0D ; /* PC5 is RSPCKA */
|
||||
MPC.PC6PFS.BYTE = 0x0D ; /* PC6 is MOSIA */
|
||||
MPC.PC7PFS.BYTE = 0x0D ; /* PC7 is MISOA */
|
||||
PORTC.PMR.BYTE = 0xE0 ; /* PC5-7 assigned to SPI peripheral */
|
||||
PORTC.PODR.BYTE = 0x17 ; /* All outputs low to start */
|
||||
PORTC.PDR.BYTE = 0x7F ; /* All outputs except MISO */
|
||||
|
||||
/* Set port mode registers for switches. */
|
||||
SW1_PMR = 0;
|
||||
SW2_PMR = 0;
|
||||
SW3_PMR = 0;
|
||||
|
||||
/* Initialize RSPI pins that are used with on-board SPI flash. */
|
||||
/* Set pin outputs to low to begin with. */
|
||||
PORT2.PODR.BIT.B7 = 0x00; /* RSPCKB */
|
||||
PORT2.PODR.BIT.B6 = 0x00; /* MOSIB */
|
||||
PORT3.PODR.BIT.B0 = 0x00; /* MISOB */
|
||||
PORT3.PODR.BIT.B1 = 0x00; /* SSLB0 */
|
||||
|
||||
/* All GPIO for now */
|
||||
PORT2.PMR.BIT.B7 = 0x00;
|
||||
PORT2.PMR.BIT.B6 = 0x00;
|
||||
PORT3.PMR.BIT.B0 = 0x00;
|
||||
PORT3.PMR.BIT.B1 = 0x00;
|
||||
|
||||
/* Unlock MPC registers to enable writing to them. */
|
||||
MPC.PWPR.BIT.B0WI = 0 ; /* Unlock protection register */
|
||||
MPC.PWPR.BIT.PFSWE = 1 ; /* Unlock MPC registers */
|
||||
|
||||
/* Set MPC for RSPI pins */
|
||||
MPC.P27PFS.BYTE = 0x0D;
|
||||
MPC.P26PFS.BYTE = 0x0D;
|
||||
MPC.P30PFS.BYTE = 0x0D;
|
||||
|
||||
/* RSPI pins assigned to RSPI peripheral. */
|
||||
PORT2.PMR.BIT.B7 = 1;
|
||||
PORT2.PMR.BIT.B6 = 1;
|
||||
PORT3.PMR.BIT.B0 = 1;
|
||||
PORT3.PMR.BIT.B1 = 1;
|
||||
|
||||
/* RSPCKB is output. */
|
||||
PORT2.PDR.BIT.B7 = 1;
|
||||
/* MOSIB is output. */
|
||||
PORT2.PDR.BIT.B6 = 1;
|
||||
/* MISOB is input. */
|
||||
PORT3.PDR.BIT.B0 = 0;
|
||||
/* SSLB0 is output. */
|
||||
PORT3.PDR.BIT.B1 = 1;
|
||||
|
||||
/* Configure the pin connected to the ADC Pot as an input */
|
||||
PORT4.PDR.BIT.B0 = 0;
|
||||
/* Port D - LED's */
|
||||
PORTD.PODR.BYTE = 0xFF ; /* All outputs LED's off */
|
||||
PORTD.PDR.BYTE = 0xFF ; /* All outputs */
|
||||
|
||||
/* Port E - LED's, WiFi & PMOD control */
|
||||
PORTE.PODR.BYTE = 0xFF ; /* All LED's off, all chip selects inactive */
|
||||
PORTE.PDR.BYTE = 0x7F ; /* All outputs except PMOD_MISO */
|
||||
|
||||
/* Port J - WiFi chip select */
|
||||
PORTJ.PODR.BYTE = 0x04 ; /* WiFi CS de-asserted at power up */
|
||||
PORTJ.PDR.BYTE = 0x04 ; /* WiFi CS is an output */
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
|
@ -18,7 +18,7 @@
|
|||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : hwsetup.h
|
||||
* Description : Hardware setup header file.
|
||||
* Description : Hardware setup header file..
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
|
@ -19,12 +19,12 @@
|
|||
/***********************************************************************************************************************
|
||||
* File Name : mcu_info.h
|
||||
* Device(s) : RX
|
||||
* H/W Platform : RSK+RX63N
|
||||
* Description : Information about the MCU on this board.
|
||||
* H/W Platform : YRDKRX63N
|
||||
* Description : Information about the MCU on this board (RDKRX63N).
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 28.11.2011 1.00 First Release
|
||||
* : 26.10.2011 1.00 First Release
|
||||
* : 13.03.2012 1.10 System clock speeds are now calculated from macros in r_bsp_config.h.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
#define MCU_RX63N (1)
|
||||
|
||||
/* Package. */
|
||||
#define PACKAGE_LQFP176 (1)
|
||||
#define PACKAGE_LQFP100 (1)
|
||||
|
||||
/* Memory size of your MCU. */
|
||||
#define ROM_SIZE_BYTES (1048576)
|
|
@ -18,18 +18,18 @@
|
|||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_bsp.h
|
||||
* H/W Platform : RSK+RX63N
|
||||
* H/W Platform : RDKRX63N
|
||||
* Description : Has the header files that should be included for this platform.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 13.01.2012 1.00 First Release
|
||||
* : 13.03.2012 1.10 Added locking.h and r_bsp_config.h #includes. Removed sbrk.h since heap size is not
|
||||
* : 12.03.2012 1.10 Added locking.h and r_bsp_config.h #includes. Removed sbrk.h since heap size is not
|
||||
* defined in r_bsp_config.h.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#ifndef PLATFORM_BOARD_RSKRX63N
|
||||
#define PLATFORM_BOARD_RSKRX63N
|
||||
#ifndef PLATFORM_BOARD_RDKRX63N
|
||||
#define PLATFORM_BOARD_RDKRX63N
|
||||
|
||||
/* Make sure that no other platforms have already been defined. Do not touch this! */
|
||||
#ifdef PLATFORM_DEFINED
|
||||
|
@ -43,12 +43,12 @@ INCLUDE APPROPRIATE MCU AND BOARD FILES
|
|||
***********************************************************************************************************************/
|
||||
#include "r_bsp_config.h"
|
||||
#include ".\mcu\rx63n\iodefine.h"
|
||||
#include ".\board\rskrx63n\rskrx63n.h"
|
||||
#include ".\board\rskrx63n\mcu_info.h"
|
||||
#include ".\board\rskrx63n\hwsetup.h"
|
||||
#include ".\board\rskrx63n\lcd.h"
|
||||
#include ".\board\rskrx63n\locking.h"
|
||||
#include ".\board\rdkrx63n\yrdkrx63n.h"
|
||||
#include ".\board\rdkrx63n\mcu_info.h"
|
||||
#include ".\board\rdkrx63n\hwsetup.h"
|
||||
#include ".\board\rdkrx63n\lcd.h"
|
||||
#include ".\board\rdkrx63n\locking.h"
|
||||
|
||||
#endif /* PLATFORM_BOARD_RSKRX63N */
|
||||
#endif /* PLATFORM_BOARD_RDKRX63N */
|
||||
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_bsp_config_reference.c
|
||||
* Device(s) : RX63x
|
||||
* Description : The file r_bsp_config.h is used to configure your BSP. r_bsp_config.h should be included
|
||||
* somewhere in your package so that the r_bsp code has access to it. This file (r_bsp_config_reference.h)
|
||||
* is just a reference file that the user can use to make their own r_bsp_config.h file.
|
||||
************************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 13.03.2012 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
#ifndef R_BSP_CONFIG_REF_HEADER_FILE
|
||||
#define R_BSP_CONFIG_REF_HEADER_FILE
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Configuration Options
|
||||
***********************************************************************************************************************/
|
||||
/* The 'BSP_DECLARE_STACK' macro is checked so that the stack is only declared in one place (resetprg.c). Every time a
|
||||
'#pragma stacksize' is encountered, the stack size is increased. This prevents multiplication of stack size. */
|
||||
#if defined(BSP_DECLARE_STACK)
|
||||
/* User Stack size in bytes. The Renesas RX toolchain sets the stack size using the #pragma stacksize directive. */
|
||||
#pragma stacksize su=0x1000
|
||||
/* Interrupt Stack size in bytes. The Renesas RX toolchain sets the stack size using the #pragma stacksize directive. */
|
||||
#pragma stacksize si=0x400
|
||||
#endif
|
||||
|
||||
/* Heap size in bytes. */
|
||||
#define HEAP_BYTES (0x400)
|
||||
|
||||
/* After reset MCU will operate in Supervisor mode. To switch to User mode, set this macro to '1'. For more information
|
||||
on the differences between these 2 modes see the CPU >> Processor Mode section of your MCU's hardware manual.
|
||||
0 = Stay in Supervisor mode.
|
||||
1 = Switch to User mode.
|
||||
*/
|
||||
#define RUN_IN_USER_MODE (0)
|
||||
|
||||
/* To get into User Boot Mode the user must control some pins on the MCU and also set some values in ROM. These values
|
||||
in ROM are described in the Option-Setting Memory section of the hardware manual. This macro sets these values so
|
||||
that User Boot Mode can be used. The user is still responsible for setting the MCU pins appropriately.
|
||||
0 = Single-Chip or USB Boot Mode
|
||||
1 = User Boot Mode
|
||||
*/
|
||||
#define USER_BOOT_ENABLE (0)
|
||||
|
||||
/* Set your desired ID code. NOTE, leave at the default (all 0xFF's) if you do not wish to use an ID code. If you set
|
||||
this value and program it into the MCU then you will need to remember the ID code because the debugger will ask for
|
||||
it when trying to connect. Note that the E1/E20 will ignore the ID code when programming the MCU during debugging.
|
||||
If you set this value and then forget it then you can clear the ID code by connecting up in serial boot mode using
|
||||
FDT. The ID Code is 16 bytes long. The macro below define the ID Code in 4-byte sections. */
|
||||
/* Lowest 4-byte section, address 0xFFFFFFA0. From MSB to LSB: Control Code, ID code 1, ID code 2, ID code 3. */
|
||||
#define ID_CODE_LONG_1 (0xFFFFFFFF)
|
||||
/* 2nd ID Code section, address 0xFFFFFFA4. From MSB to LSB: ID code 4, ID code 5, ID code 6, ID code 7. */
|
||||
#define ID_CODE_LONG_2 (0xFFFFFFFF)
|
||||
/* 3rd ID Code section, address 0xFFFFFFA8. From MSB to LSB: ID code 8, ID code 9, ID code 10, ID code 11. */
|
||||
#define ID_CODE_LONG_3 (0xFFFFFFFF)
|
||||
/* 4th ID Code section, address 0xFFFFFFAC. From MSB to LSB: ID code 12, ID code 13, ID code 14, ID code 15. */
|
||||
#define ID_CODE_LONG_4 (0xFFFFFFFF)
|
||||
|
||||
/* This macro lets other modules no if a RTOS is being used.
|
||||
0 = RTOS is not used.
|
||||
1 = RTOS is used.
|
||||
*/
|
||||
#define RTOS_USED (0)
|
||||
|
||||
/* Clock source select (CKSEL).
|
||||
0 = Low Speed On-Chip Oscillator (LOCO)
|
||||
1 = High Speed On-Chip Oscillator (HOCO)
|
||||
2 = Main Clock Oscillator
|
||||
3 = Sub-Clock Oscillator
|
||||
4 = PLL Circuit
|
||||
*/
|
||||
#define CLOCK_SOURCE (4)
|
||||
|
||||
/* Clock configuration options.
|
||||
The input clock frequency is specified and then the system clocks are set by specifying the multipliers used. The
|
||||
multiplier settings are used to set the clock registers in resetprg.c. If a 12MHz clock is used and the
|
||||
ICLK is 96MHz, PCLKA is 48MHz, PCLKB is 48MHz, FCLK is 48MHz, USB Clock is 48MHz, and BCLK is 12MHz then the
|
||||
settings would be:
|
||||
|
||||
XTAL_HZ = 12000000
|
||||
PLL_DIV = 1 (no division)
|
||||
PLL_MUL = 16 (12MHz x 16 = 192MHz)
|
||||
ICK_DIV = 2 : System Clock (ICLK) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / ICK_DIV) = 96MHz
|
||||
PCKA_DIV = 4 : Peripheral Clock A (PCLKA) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / PCKA_DIV) = 48MHz
|
||||
PCKB_DIV = 4 : Peripheral Clock B (PCLKB) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / PCKB_DIV) = 48MHz
|
||||
FCK_DIV = 4 : Flash IF Clock (FCLK) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / FCK_DIV) = 48MHz
|
||||
BCK_DIV = 8 : External Bus Clock (BCK) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / BCK_DIV) = 24MHz
|
||||
UCK_DIV = 4 : USB Clock (UCLK) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / UCK_DIV) = 48MHz
|
||||
*/
|
||||
/* XTAL - Input clock frequency in Hz */
|
||||
#define XTAL_HZ (12000000)
|
||||
/* PLL Input Frequency Divider Select (PLIDIV).
|
||||
Available divisors = /1 (no division), /2, /4
|
||||
*/
|
||||
#define PLL_DIV (1)
|
||||
/* PLL Frequency Multiplication Factor Select (STC).
|
||||
Available multipliers = x8, x10, x12, x16, x20, x24, x25, x50
|
||||
*/
|
||||
#define PLL_MUL (16)
|
||||
/* System Clock Divider (ICK).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define ICK_DIV (2)
|
||||
/* Peripheral Module Clock A Divider (PCKA).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define PCKA_DIV (4)
|
||||
/* Peripheral Module Clock B Divider (PCKB).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define PCKB_DIV (4)
|
||||
/* External Bus Clock Divider (BCK).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define BCK_DIV (8)
|
||||
/* Flash IF Clock Divider (FCK).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define FCK_DIV (4)
|
||||
/* IEBUS Clock Divider Select.
|
||||
Available divisors = /1 (no division), /2, /4, /6, /8, /16, /32, /64
|
||||
*/
|
||||
#define IEBCK_DIV (8)
|
||||
/* USB Clock Divider Select.
|
||||
Available divisors = /3, /4
|
||||
*/
|
||||
#define UCK_DIV (4)
|
||||
|
||||
#endif /* R_BSP_CONFIG_REF_HEADER_FILE */
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http:/*www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : yrdkrx63n.h
|
||||
* H/W Platform : YRDKRX63N
|
||||
* Description : Board specific definitions for the RDKRX63N.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 30.11.2011 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#ifndef RDK_RX63N_H
|
||||
#define RDK_RX63N_H
|
||||
|
||||
|
||||
/* Local defines */
|
||||
#define LED_ON (0)
|
||||
#define LED_OFF (1)
|
||||
|
||||
/* I/0 port 1 */
|
||||
#define USB_VBUSEN PORT1.PODR.BIT.B6
|
||||
#define AUDIO_OUT_R PORT1.PODR.BIT.B7
|
||||
|
||||
/* I/0 port 2 */
|
||||
#define BL_ENA PORT2.PODR.BIT.B1
|
||||
#define USB_DPUPEA PORT2.PODR.BIT.B3
|
||||
|
||||
/* I/O port 3 */
|
||||
#define CAN_WIFI_TX PORT3.PODR.BIT.B2
|
||||
|
||||
/* I/O port 4: switches and various peripherals */
|
||||
#define SW_ACTIVE (0)
|
||||
#define SW1 PORT4.PIDR.BIT.B0
|
||||
#define SW1_PMR PORT4.PMR.BIT.B0
|
||||
#define SW1_PDR PORT4.PDR.BIT.B0
|
||||
#define SW2 PORT4.PIDR.BIT.B1
|
||||
#define SW2_PMR PORT4.PMR.BIT.B1
|
||||
#define SW2_PDR PORT4.PDR.BIT.B1
|
||||
#define POTENTIOMETER PORT4.PODR.BIT.B2
|
||||
#define JN1_AN3 PORT4.PODR.BIT.B3
|
||||
#define SW3 PORT4.PIDR.BIT.B4
|
||||
#define SW3_PMR PORT4.PMR.BIT.B4
|
||||
#define SW3_PDR PORT4.PDR.BIT.B4
|
||||
#define MICROPHONE PORT4.PODR.BIT.B5
|
||||
#define AUDIO_IN_R PORT4.PODR.BIT.B6
|
||||
#define PWMLP_IN PORT4.PODR.BIT.B7
|
||||
|
||||
/* I/O port 5 */
|
||||
#define LCD_RS PORT5.PODR.BIT.B1
|
||||
#define BCLK PORT5.PODR.BIT.B3
|
||||
#define PWMLP_OUT PORT5.PODR.BIT.B4
|
||||
|
||||
/* I/O port A: Extension slot (JN2) and E/N pins */
|
||||
#define JN2_SSLA1_B PORTA.PODR.BIT.B0
|
||||
#define PMOD1_PIN8 PORTA.PODR.BIT.B1
|
||||
#define AMP_SHDN PORTA.PODR.BIT.B2
|
||||
#define ETH_MDIO PORTA.PODR.BIT.B3
|
||||
#define ETH_MDC PORTA.PODR.BIT.B4
|
||||
#define ETH_LINK PORTA.PODR.BIT.B5
|
||||
|
||||
/* I/O port B: Ethernet I/O pins definitions */
|
||||
#define RMII_RXD1 PORTB.PODR.BIT.B0
|
||||
#define RMII_RXD0 PORTB.PODR.BIT.B1
|
||||
#define ETH_CLK PORTB.PODR.BIT.B2
|
||||
#define RMII_RX_ER PORTB.PODR.BIT.B3
|
||||
#define RMII_TX_EN PORTB.PODR.BIT.B4
|
||||
#define RMII_TXD0 PORTB.PODR.BIT.B5
|
||||
#define RMII_TXD1 PORTB.PODR.BIT.B6
|
||||
#define ETH_CRS PORTB.PODR.BIT.B7
|
||||
|
||||
/* I/O port C: RSPI and peripheral I/O pins definitions */
|
||||
#define RSPI_CHANNEL_0 0
|
||||
#define RSPI_CHANNEL_1 1
|
||||
#define FLASH_CS PORTC.PODR.BIT.B0 /* SSL 1 */
|
||||
#define AUDIO_OUT_L PORTC.PODR.BIT.B1
|
||||
#define LCD_CS PORTC.PODR.BIT.B2 /* SSL 3 */
|
||||
#define LCD_RESET PORTC.PODR.BIT.B3
|
||||
#define SDMICRO_CS PORTC.PODR.BIT.B4 /* SSL 0 */
|
||||
#define RSPI_SCLOCK PORTC.PODR.BIT.B5
|
||||
#define RSPI_MOSI PORTC.PODR.BIT.B6
|
||||
#define RSPI_MISO PORTC.PODR.BIT.B7
|
||||
|
||||
/* I/O ports D & E: LEDs */
|
||||
#define LED4 PORTD.PODR.BIT.B5
|
||||
#define LED5 PORTE.PODR.BIT.B3
|
||||
#define LED6 PORTD.PODR.BIT.B2
|
||||
#define LED7 PORTE.PODR.BIT.B0
|
||||
#define LED8 PORTD.PODR.BIT.B4
|
||||
#define LED9 PORTE.PODR.BIT.B2
|
||||
#define LED10 PORTD.PODR.BIT.B1
|
||||
#define LED11 PORTD.PODR.BIT.B7
|
||||
#define LED12 PORTD.PODR.BIT.B3
|
||||
#define LED13 PORTE.PODR.BIT.B1
|
||||
#define LED14 PORTD.PODR.BIT.B0
|
||||
#define LED15 PORTD.PODR.BIT.B6
|
||||
|
||||
/* WiFi chip select */
|
||||
#define WIFI_CS PORTJ.PODR.BIT.B3
|
||||
|
||||
#endif /* RDK_RX63N_H */
|
||||
|
|
@ -1,254 +0,0 @@
|
|||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : lcd.c
|
||||
* Device(s) : RX
|
||||
* H/W Platform : RSK+RX63N
|
||||
* Description : Provides variable and function declarations for lcd.c file
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 22.11.2011 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
***********************************************************************************************************************/
|
||||
/* Processor-specific details */
|
||||
#include <machine.h>
|
||||
/* Standard string manipulation & formatting functions */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
/* Defines standard variable types used in this function */
|
||||
#include <stdint.h>
|
||||
/* Bring in board includes. */
|
||||
#include "platform.h"
|
||||
/* Following header file provides function prototypes for LCD controlling functions & macro defines */
|
||||
#include "lcd.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Private global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
static void lcd_delay(volatile int32_t nsecs);
|
||||
static void lcd_nibble_write(uint8_t data_or_ctrl, uint8_t value);
|
||||
static void lcd_write(uint8_t data_or_ctrl, uint8_t value);
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name : lcd_initialize
|
||||
* Description : Initializes the LCD display.
|
||||
* Arguments : none
|
||||
* Return Value : none
|
||||
***********************************************************************************************************************/
|
||||
void lcd_initialize(void)
|
||||
{
|
||||
/* Set LCD data pins as outputs. */
|
||||
PORT8.PDR.BYTE |= 0xF0;
|
||||
|
||||
/* Set LCD control pins as outputs. */
|
||||
RS_PIN_DDR = 1;
|
||||
E_PIN_DDR = 1;
|
||||
|
||||
/* Power Up Delay for the LCD Module */
|
||||
lcd_delay(50000000);
|
||||
|
||||
/* Display initialises in 8 bit mode - so send one write (seen as 8 bit) to set to 4 bit mode. */
|
||||
lcd_nibble_write(CTRL_WR, 0x03);
|
||||
lcd_delay(5000000);
|
||||
lcd_nibble_write(CTRL_WR, 0x03);
|
||||
lcd_delay(5000000);
|
||||
lcd_nibble_write(CTRL_WR, 0x03);
|
||||
lcd_delay(5000000);
|
||||
|
||||
/* Function Set */
|
||||
lcd_nibble_write(CTRL_WR, 0x02);
|
||||
lcd_delay(39000);
|
||||
lcd_nibble_write(CTRL_WR, 0x02);
|
||||
lcd_nibble_write(CTRL_WR, (LCD_DISPLAY_ON | LCD_TWO_LINE ));
|
||||
lcd_delay(39000);
|
||||
|
||||
/* Display ON/OFF control */
|
||||
lcd_write(CTRL_WR, LCD_CURSOR_OFF);
|
||||
lcd_delay(39000);
|
||||
|
||||
/* Display Clear */
|
||||
lcd_write(CTRL_WR, LCD_CLEAR);
|
||||
lcd_delay(2000000);
|
||||
|
||||
/* Entry Mode Set */
|
||||
lcd_write(CTRL_WR, 0x06);
|
||||
lcd_delay(39000);
|
||||
|
||||
/* Home the cursor */
|
||||
lcd_write(CTRL_WR, LCD_HOME_L1);
|
||||
lcd_delay(5000000);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name : lcd_clear
|
||||
* Description : Clears the LCD
|
||||
* Arguments : none
|
||||
* Return Value : none
|
||||
***********************************************************************************************************************/
|
||||
void lcd_clear(void)
|
||||
{
|
||||
/* Display Clear */
|
||||
lcd_write(CTRL_WR, LCD_CLEAR);
|
||||
lcd_delay(2000000);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name : lcd_display
|
||||
* Description : This function controls LCD writes to line 1 or 2 of the LCD.
|
||||
* You need to use the defines LCD_LINE1 and LCD_LINE2 in order to specify the starting position.
|
||||
* For example, to start at the 2nd position on line 1...
|
||||
* lcd_display(LCD_LINE1 + 1, "Hello")
|
||||
* Arguments : position -
|
||||
* Line number of display
|
||||
* string -
|
||||
* Pointer to null terminated string
|
||||
* Return Value : none
|
||||
***********************************************************************************************************************/
|
||||
void lcd_display(uint8_t position, uint8_t const * string)
|
||||
{
|
||||
/* Declare next position variable */
|
||||
static uint8_t next_pos = 0xFF;
|
||||
|
||||
/* Set line position if needed. We don't want to if we don't need to because LCD control operations take longer
|
||||
than LCD data operations. */
|
||||
if (next_pos != position)
|
||||
{
|
||||
if(position < LCD_LINE2)
|
||||
{
|
||||
/* Display on Line 1 */
|
||||
lcd_write(CTRL_WR, ((uint8_t)(LCD_HOME_L1 + position)));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Display on Line 2 */
|
||||
lcd_write(CTRL_WR, ((uint8_t)((LCD_HOME_L2 + position) - LCD_LINE2)));
|
||||
}
|
||||
|
||||
lcd_delay(39000);
|
||||
|
||||
/* set position index to known value */
|
||||
next_pos = position;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
/* Write character to LCD. */
|
||||
lcd_write(DATA_WR,*string++);
|
||||
|
||||
lcd_delay(43000);
|
||||
|
||||
/* Increment position index */
|
||||
next_pos++;
|
||||
}
|
||||
while(*string);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name : lcd_delay
|
||||
* Description : Implements LCD required delays.
|
||||
* Arguments : nsecs -
|
||||
* Number of nanoseconds to delay. RX600 has max clock of 100MHz which gives a cycle time of 10ns.
|
||||
* This means that nothing under 100ns should be input. 100ns would be 10 cycles which is still
|
||||
* being optimistic for getting in and out of this function.
|
||||
* Return Value : none
|
||||
***********************************************************************************************************************/
|
||||
static void lcd_delay(volatile int32_t nsecs)
|
||||
{
|
||||
while (0 < nsecs)
|
||||
{
|
||||
/* Subtract off 10 cycles per iteration. This number was obtained when using the Renesas toolchain at
|
||||
optimization level 2. The number to nanoseconds to subtract off below is calculated off of the ICLK speed. */
|
||||
nsecs -= (int32_t)((100.0)*(100000000.0/(float)ICLK_HZ));
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name : lcd_nibble_write
|
||||
* Description : Writes data to display. Sends command to display.
|
||||
* Arguments : value -
|
||||
* The value to write
|
||||
* data_or_ctrl -
|
||||
* Whether to write data or control.
|
||||
* 1 = DATA
|
||||
* 0 = CONTROL
|
||||
* Return Value : none
|
||||
***********************************************************************************************************************/
|
||||
static void lcd_nibble_write(uint8_t data_or_ctrl, uint8_t value)
|
||||
{
|
||||
/* Set Register Select pin high for Data */
|
||||
if (data_or_ctrl == DATA_WR)
|
||||
{
|
||||
/* Data write. */
|
||||
RS_PIN = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Control write. */
|
||||
RS_PIN = 0;
|
||||
}
|
||||
|
||||
/* tsu1 delay */
|
||||
lcd_delay(60);
|
||||
|
||||
/* EN enable chip (HIGH) */
|
||||
E_PIN = 1;
|
||||
|
||||
/* Output the data */
|
||||
PORT8.PODR.BYTE = (value << 4u);
|
||||
|
||||
/* tw delay */
|
||||
lcd_delay(450);
|
||||
|
||||
/* Latch data by dropping E */
|
||||
E_PIN = 0;
|
||||
|
||||
/* th2 delay */
|
||||
lcd_delay(10);
|
||||
|
||||
/* tc delay */
|
||||
lcd_delay(480);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name : lcd_write
|
||||
* Description : This function controls LCD writes to line 1 or 2 of the LCD. You need to use the defines LCD_LINE1 and
|
||||
* LCD_LINE2 in order to specify the starting position.
|
||||
* For example, to start at the 2nd position on line 1...
|
||||
* lcd_display(LCD_LINE1 + 1, "Hello")
|
||||
* Arguments : value -
|
||||
* The value to write
|
||||
* data_or_ctrl -
|
||||
* Whether to write data or control.
|
||||
* 1 = DATA
|
||||
* 0 = CONTROL
|
||||
* Return Value : none
|
||||
***********************************************************************************************************************/
|
||||
static void lcd_write(uint8_t data_or_ctrl, uint8_t value)
|
||||
{
|
||||
/* Write upper nibble first */
|
||||
lcd_nibble_write(data_or_ctrl, (uint8_t)((value & 0xF0) >> 4));
|
||||
|
||||
/* Write lower nibble second */
|
||||
lcd_nibble_write(data_or_ctrl, (uint8_t)(value & 0x0F));
|
||||
}
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : lcd.h
|
||||
* Device(s) : RX
|
||||
* H/W Platform : RSKRX630
|
||||
* Description : Provides variable and function declarations for lcd.c file
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 22.11.2011 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/* Multiple inclusion prevention macro */
|
||||
#ifndef LCD_H
|
||||
#define LCD_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
***********************************************************************************************************************/
|
||||
/* Defines standard integer variable types used in this file */
|
||||
#include <stdint.h>
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
/* RS register select pin */
|
||||
#define RS_PIN PORTJ.PODR.BIT.B5
|
||||
#define RS_PIN_DDR PORTJ.PDR.BIT.B5
|
||||
/* Display enable pin */
|
||||
#define E_PIN PORTF.PODR.BIT.B5
|
||||
#define E_PIN_DDR PORTF.PDR.BIT.B5
|
||||
/* Data write/read definition */
|
||||
#define DATA_WR 1
|
||||
/* Control write/read definition */
|
||||
#define CTRL_WR 0
|
||||
/* Maximum characters per line of LCD display. */
|
||||
#define NUMB_CHARS_PER_LINE 8
|
||||
/* Number of lines on the LCD display */
|
||||
#define MAXIMUM_LINES 2
|
||||
/* Character position of LCD line 1 */
|
||||
#define LCD_LINE1 0
|
||||
/* Character position of LCD line 2 */
|
||||
#define LCD_LINE2 16
|
||||
/* Clear LCD display and home cursor */
|
||||
#define LCD_CLEAR 0x01
|
||||
/* Move cursor to line 1 */
|
||||
#define LCD_HOME_L1 0x80
|
||||
/* Move cursor to line 2 */
|
||||
#define LCD_HOME_L2 0xC0
|
||||
/* Cursor auto decrement after R/W */
|
||||
#define CURSOR_MODE_DEC 0x04
|
||||
/* Cursor auto increment after R/W */
|
||||
#define CURSOR_MODE_INC 0x06
|
||||
/* Setup, 4 bits,2 lines, 5X7 */
|
||||
#define FUNCTION_SET 0x28
|
||||
/* Display ON with Cursor */
|
||||
#define LCD_CURSOR_ON 0x0E
|
||||
/* Display ON with Cursor off */
|
||||
#define LCD_CURSOR_OFF 0x0C
|
||||
/* Display on with blinking cursor */
|
||||
#define LCD_CURSOR_BLINK 0x0D
|
||||
/* Move Cursor Left One Position */
|
||||
#define LCD_CURSOR_LEFT 0x10
|
||||
/* Move Cursor Right One Position */
|
||||
#define LCD_CURSOR_RIGHT 0x14
|
||||
/* Enable LCD display */
|
||||
#define LCD_DISPLAY_ON 0x04
|
||||
/* Enable both LCD lines */
|
||||
#define LCD_TWO_LINE 0x08
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Exported global functions (to be accessed by other files)
|
||||
***********************************************************************************************************************/
|
||||
/* LCD initialisation function declaration */
|
||||
void lcd_initialize (void);
|
||||
|
||||
/* Update display function declaration */
|
||||
void lcd_display(uint8_t position, uint8_t const * string);
|
||||
|
||||
/* Clear LCD function delcaration */
|
||||
void lcd_clear (void);
|
||||
|
||||
/* End of multiple inclusion prevention macro */
|
||||
#endif
|
|
@ -1,118 +0,0 @@
|
|||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2011 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : locking.c
|
||||
* Description : This implements a locking mechanism that can be used by all code. The locking is done atomically so
|
||||
* common resources can be accessed safely.
|
||||
***********************************************************************************************************************/
|
||||
/**********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 07.03.2012 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
***********************************************************************************************************************/
|
||||
/* Fixed-size integer typedefs. */
|
||||
#include <stdint.h>
|
||||
/* bool support. */
|
||||
#include <stdbool.h>
|
||||
/* Has intrinsic support. Includes xchg() which is used in this code. */
|
||||
#include <machine.h>
|
||||
/* Includes board and MCU related header files. */
|
||||
#include "platform.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Typedef definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Exported global variables (to be accessed by other files)
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Private global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: R_BSP_Lock
|
||||
* Description : Attempt to acquire the lock that has been sent in.
|
||||
* Arguments : plock -
|
||||
* Pointer to lock structure with lock to try and acquire.
|
||||
* Return Value : true -
|
||||
* Lock was acquired.
|
||||
* false -
|
||||
* Lock was not acquired.
|
||||
***********************************************************************************************************************/
|
||||
bool R_BSP_Lock(bsp_lock_t * plock)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
/* Variable used in trying to acquire lock. Using the xchg instruction makes this atomic */
|
||||
int32_t is_locked = true;
|
||||
|
||||
/* This example uses the RX MCU's atomic xchg() instruction. plock->lock is the lock we are trying to reserve.
|
||||
The way this works is that 'is_locked' gets the value of the plock->lock and plock->lock gets the value of
|
||||
'is_locked' which we just set to 'true'. Basically this is an atomic 'swap' command. If the lock had not yet been
|
||||
reserved then its value would be 'false' and after the xchg() instruction finished 'is_locked' would have
|
||||
'false'. If it had already been reserved then 'is_locked' would have 'true' after the xchg() instruction. Since
|
||||
plock->lock was already 'true' and we just set it back to 'true' everything is ok. To see if we reserved the lock
|
||||
we just need to check the value of 'is_locked' after this instruction finishes. */
|
||||
|
||||
/* Try to acquire semaphore to obtain lock */
|
||||
xchg(&is_locked, &plock->lock);
|
||||
|
||||
/* Check to see if semaphore was successfully taken */
|
||||
if (is_locked == false)
|
||||
{
|
||||
/* Lock obtained, return success. */
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Lock was not obtained, another task already has it. */
|
||||
}
|
||||
|
||||
return ret;
|
||||
} /* End of function R_BSP_Lock() */
|
||||
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function Name: R_BSP_Unlock
|
||||
* Description : Release hold on lock.
|
||||
* Arguments : plock -
|
||||
* Pointer to lock structure with lock to release.
|
||||
* Return Value : true -
|
||||
* Lock was released.
|
||||
* false -
|
||||
* Lock was not released.
|
||||
***********************************************************************************************************************/
|
||||
bool R_BSP_Unlock(bsp_lock_t * plock)
|
||||
{
|
||||
/* Set lock back to unlocked. */
|
||||
plock->lock = false;
|
||||
|
||||
return true;
|
||||
} /* End of function R_BSP_Unlock() */
|
||||
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2011 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : locking.h
|
||||
* Description : This implements a locking mechanism that can be used by all code. The locking is done atomically so
|
||||
* common resources can be accessed safely.
|
||||
***********************************************************************************************************************/
|
||||
/**********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 07.03.2012 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
***********************************************************************************************************************/
|
||||
/* Fixed-size integer typedefs. */
|
||||
#include <stdint.h>
|
||||
/* bool support. */
|
||||
#include <stdbool.h>
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Typedef definitions
|
||||
***********************************************************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
/* The actual lock. int32_t is used because this is what the xchg() instruction takes as parameters. */
|
||||
int32_t lock;
|
||||
/* Could add a ID for locking and unlocking. In this could protect against any function being able to unlock. */
|
||||
} bsp_lock_t;
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Exported global variables
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Exported global functions (to be accessed by other files)
|
||||
***********************************************************************************************************************/
|
||||
bool R_BSP_Lock(bsp_lock_t * plock);
|
||||
bool R_BSP_Unlock(bsp_lock_t * plock);
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : rskrx63n.h
|
||||
* H/W Platform : RSK+RX63N
|
||||
* Description : Board specific definitions for the RSKRX630.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 28.11.2011 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#ifndef RSKRX63N_H
|
||||
#define RSKRX63N_H
|
||||
|
||||
/* Local defines */
|
||||
#define LED_ON (0)
|
||||
#define LED_OFF (1)
|
||||
#define SET_BIT_HIGH (1)
|
||||
#define SET_BIT_LOW (0)
|
||||
#define SET_BYTE_HIGH (0xFF)
|
||||
#define SET_BYTE_LOW (0x00)
|
||||
|
||||
/* Switches */
|
||||
#define SW_ACTIVE 0
|
||||
#define SW1 PORT3.PIDR.BIT.B2
|
||||
#define SW2 PORT0.PIDR.BIT.B0
|
||||
#define SW3 PORT0.PIDR.BIT.B7
|
||||
#define SW1_PDR PORT3.PDR.BIT.B2
|
||||
#define SW2_PDR PORT0.PDR.BIT.B0
|
||||
#define SW3_PDR PORT0.PDR.BIT.B7
|
||||
#define SW1_PMR PORT3.PMR.BIT.B2
|
||||
#define SW2_PMR PORT0.PMR.BIT.B0
|
||||
#define SW3_PMR PORT0.PMR.BIT.B7
|
||||
|
||||
/* LEDs */
|
||||
#define LED0 PORT0.PODR.BIT.B3
|
||||
#define LED1 PORT0.PODR.BIT.B5
|
||||
#define LED2 PORT1.PODR.BIT.B0
|
||||
#define LED3 PORT1.PODR.BIT.B1
|
||||
#define LED0_PDR PORT0.PDR.BIT.B3
|
||||
#define LED1_PDR PORT0.PDR.BIT.B5
|
||||
#define LED2_PDR PORT1.PDR.BIT.B0
|
||||
#define LED3_PDR PORT1.PDR.BIT.B1
|
||||
|
||||
/* Slave select. */
|
||||
#define FLASH_CS PORT3.PDR.BIT.B1 // SSLB0
|
||||
|
||||
#endif /* RSKRX63N_H */
|
Loading…
Add table
Add a link
Reference in a new issue