forked from xuos/xiuos
modify nuttx bug of lack of files
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_SKP16C26
|
||||
endif
|
||||
@@ -0,0 +1,110 @@
|
||||
boards/renesas/m16c/skp16c26/README.txt
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
1. The buildroot package can be used to build an M16C toolchain. The toolchain
|
||||
buildroot can be downloaded from buildroot in the NuttX GIT. Insructions
|
||||
for building the toolchain are provided below.
|
||||
|
||||
However, the target cannot be built because the GNU m16c-nuttx-elf-ld link fails with
|
||||
the following message:
|
||||
|
||||
m32c-nuttx-elf-ld: BFD (GNU Binutils) 2.19 assertion fail /home/Owner/projects/nuttx/buildroot/toolchain_build_m32c/binutils-2.19/bfd/elf32-m32c.c:482
|
||||
|
||||
Where the reference line is:
|
||||
|
||||
/* If the symbol is out of range for a 16-bit address,
|
||||
we must have allocated a plt entry. */
|
||||
BFD_ASSERT (*plt_offset != (bfd_vma) -1);
|
||||
|
||||
No workaround is known at this time. This is a show stopper for M16C.
|
||||
|
||||
2. A supported version of the M16C toolchain is available here:
|
||||
|
||||
http://www.kpitgnutools.com/index.php
|
||||
|
||||
This download is free but requires registration. Unfortunately, this v0901 of
|
||||
this toolchain shows the same behavior:
|
||||
|
||||
c:\Hew3\Tools\KPIT Cummins\GNUM16CM32C-ELF\v0901\m32c-elf\bin\m32c-elf-ld.exe: BFD (GNU Binutils) 2.19-GNUM16CM32C_v0901 assertion fail /home/kpit/fsfsrc/binutils-2.19/bfd/elf32-m32c.c:482
|
||||
|
||||
It is possible that this error messasge my be telling me -- a very roundabout way --
|
||||
that I have exceeded the FLASH region, but I think that unlikely (it is difficult
|
||||
to know if the link does not complete gracefully).
|
||||
|
||||
BUILDING THE R8C/M16C/M32C GNU TOOLCHAIN USING BUILDROOT
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
NOTE: See the toolchain issues above -- you may not want to waste your time.
|
||||
|
||||
1. CD to the correct directory.
|
||||
|
||||
Change to the directory just above the NuttX installation. If <nuttx-dir> is
|
||||
where NuttX is installed, then cd to <nuttx-dir>/..
|
||||
|
||||
2. Get and Install the buildroot Module
|
||||
|
||||
a. Using a release tarball:
|
||||
|
||||
cd <nuttx-dir>/..
|
||||
Download the appropriate buildroot package.
|
||||
unpack the buildroot package
|
||||
rename the directory to buildroot
|
||||
|
||||
b. Using GIT
|
||||
|
||||
Check out the buildroot module. GIT checkout instructions:
|
||||
|
||||
git clone hhttps://patacongo@bitbucket.org/nuttx/buildroot.git buildroot
|
||||
|
||||
Make the archive directory:
|
||||
|
||||
mkdir archive
|
||||
|
||||
The <nuttx-dir>/../buildroot is where the toolchain is built;
|
||||
The <nuttx-dir>/../archive directory is where toolchain sources will be downloaded.
|
||||
|
||||
3. Make sure that NuttX is configured
|
||||
|
||||
cd <nuttx-dir>
|
||||
tools/configure.sh <nuttx-configuration>
|
||||
|
||||
4. Configure and Make the buildroot
|
||||
|
||||
cd <buildroot-dir>
|
||||
cp boards/m32c-defconfig-4.2.4 .config
|
||||
make oldconfig
|
||||
make
|
||||
|
||||
This will download the large source packages for the toolchain and build the toolchain.
|
||||
The resulting binaries will be under buildroot/build_m32c. There will also be a
|
||||
large build directory called toolchain_build_m32c; this directory can be removed once
|
||||
the build completes successfully.
|
||||
|
||||
Cygwin GCC BUILD NOTES
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
On Cygwin, the buildroot 'make' command will fail with an error like:
|
||||
|
||||
"...
|
||||
build/genchecksum cc1-dummy > cc1-checksum.c
|
||||
opening cc1-dummy: No such file or directory
|
||||
..."
|
||||
|
||||
This is caused because on Cygwin, host executables will be generated with the extension .exe
|
||||
and, apparently, the make variable "exeext" is set incorrectly. A work around after the
|
||||
above occurs is:
|
||||
|
||||
cd toolchain_build_m32c/gcc-4.2.4-initial/gcc # Go to the directory where error occurred
|
||||
mv cc1-dummy.exe cc1-dummy # Rename the executable without .exe
|
||||
rm cc1-checksum.c # Get rid of the bad generated file
|
||||
|
||||
Then resume the buildroot make:
|
||||
|
||||
cd - # Back to the buildroot make directory
|
||||
make # Restart the build
|
||||
|
||||
GCC is built twice. First a initial, "bootstrap" GCC is produced in
|
||||
toolchain_build_m32c/gcc-4.2.4-initial, then the final GCC is produced in
|
||||
toolchain_build_m32c/gcc-4.2.4-final. The above error will occur twice: Once for
|
||||
the initial GCC build (see above) and once for the final GCC build. For the final GCC
|
||||
build, the workaround is the same except that the directory will be
|
||||
toolchain_build_m32c/gcc-4.2.4-final/gcc.
|
||||
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_DISABLE_POSIX_TIMERS is not set
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="skp16c26"
|
||||
CONFIG_ARCH_BOARD_SKP16C26=y
|
||||
CONFIG_ARCH_CHIP="m16c"
|
||||
CONFIG_ARCH_CHIP_M30262F8=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=128
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16945
|
||||
CONFIG_CONSOLE_SYSLOG=y
|
||||
CONFIG_DEFAULT_SMALL=y
|
||||
CONFIG_DISABLE_MOUNTPOINT=y
|
||||
CONFIG_DISABLE_MQUEUE=y
|
||||
CONFIG_ENDIAN_BIG=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=256
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=256
|
||||
CONFIG_PTHREAD_STACK_MIN=64
|
||||
CONFIG_RAM_SIZE=2048
|
||||
CONFIG_RAM_START=0x00400
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_SLCD=y
|
||||
CONFIG_SLCD_CONSOLE=y
|
||||
CONFIG_START_DAY=20
|
||||
CONFIG_START_MONTH=2
|
||||
CONFIG_START_YEAR=2009
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_TLS_NELEM=0
|
||||
CONFIG_USERMAIN_STACKSIZE=256
|
||||
CONFIG_USER_ENTRYPOINT="ostest_main"
|
||||
@@ -0,0 +1,120 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/include/board.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_M32262F8_SKP16C26_INCLUDE_BOARD_H
|
||||
#define __BOARDS_RENESAS_M32262F8_SKP16C26_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* User configuration checks ************************************************/
|
||||
|
||||
/* According to SKP16C26 documentation, "SIO/UART1 pins are used for
|
||||
* communication between the SKP16C26 board kernel and KD30 Debugger through
|
||||
* the ICD. Do not connect these pins to any other circuit, as UART1 cannot
|
||||
* be used in the user program.
|
||||
* For details, please see ICD (RTA-FoUSB-MON) User Manual on Target M16C
|
||||
* ROM Monitor Resources or related ICD application notes."
|
||||
*
|
||||
* However, the schematic appears to show that SIO/UART2 is actual
|
||||
* connection.
|
||||
* To be safe, we will error out on either selection:
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_M16C_UART1) || defined(CONFIG_M16C_UART2)
|
||||
# error "UART1/2 should not be used on SKP16C26"
|
||||
#endif
|
||||
|
||||
/* Hardware defintitions ****************************************************/
|
||||
|
||||
/* Xin Freq */
|
||||
|
||||
#define M16C_XIN_FREQ 20000000 /* 20MHz */
|
||||
|
||||
/* Interrupt Priority Levels ************************************************/
|
||||
|
||||
/* IPL settings */
|
||||
|
||||
#define M16C_DEFAULT_IPL 0 /* Default M16C Interrupt priority level */
|
||||
#undef M16C_INTERRUPT_IPL /* Default interrupt IPL to enabled nested interrupts */
|
||||
|
||||
/* Define any of the following to specify interrupt priorities. A default
|
||||
* value of 5 will be used for any unspecified values
|
||||
*/
|
||||
|
||||
#undef M16C_INT3_PRIO /* INT3 interrupt priority */
|
||||
#undef M16C_INT5_PRIO /* INT5 interrupt priority */
|
||||
#undef M16C_INT4_PRIO /* INT4 interrupt priority */
|
||||
#undef M16C_BCN_PRIO /* Bus collision detection interrupt priority */
|
||||
#undef M16C_DM0_PRIO /* DMA0 interrupt priority */
|
||||
#undef M16C_DM1_PRIO /* DMA1 interrupt priority */
|
||||
#undef M16C_KUP_PRIO /* Key input interrupt priority */
|
||||
#undef M16C_AD_PRIO /* A-D conversion interrupt priority */
|
||||
#undef M16C_S2T_PRIO /* UART2 transmit interrupt priority */
|
||||
#undef M16C_S2R_PRIO /* UART2 receive interrupt priority */
|
||||
#undef M16C_S0T_PRIO /* UART0 transmit interrupt priority */
|
||||
#undef M16C_S0R_PRIO /* UART0 receive interrupt priority */
|
||||
#undef M16C_S1T_PRIO /* UART1 transmit interrupt priority */
|
||||
#undef M16C_S1R_PRIO /* UART1 receive interrupt priority */
|
||||
#define M16C_TA0_PRIO 5 /* Timer A0 interrupt priority */
|
||||
#undef M16C_TA1_PRIO /* Timer A1 interrupt priority */
|
||||
#undef M16C_TA2_PRIO /* Timer A2 interrupt priority */
|
||||
#undef M16C_TA3_PRIO /* Timer A3 interrupt priority */
|
||||
#undef M16C_TA4_PRIO /* Timer A4 interrupt priority */
|
||||
#undef M16C_TB0_PRIO /* Timer B0 interrupt priority */
|
||||
#undef M16C_TB1_PRIO /* Timer B1 interrupt priority */
|
||||
#undef M16C_TB2_PRIO /* Timer B2 interrupt priority */
|
||||
#undef M16C_INT0_PRIO /* INT0 interrupt priority */
|
||||
#undef M16C_INT1_PRIO /* INT1 interrupt priority */
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* GREEN YELLOW RED */
|
||||
#define LED_STARTED 0 /* OFF OFF OFF */
|
||||
#define LED_HEAPALLOCATE 1 /* ON OFF OFF */
|
||||
#define LED_IRQSENABLED 2 /* OFF ON OFF */
|
||||
#define LED_STACKCREATED 3 /* ON ON OFF */
|
||||
#define LED_INIRQ 4 /* ON OFF ON */
|
||||
#define LED_SIGNAL 5 /* OFF ON ON */
|
||||
#define LED_ASSERTION 6 /* ON ON ON */
|
||||
#define LED_PANIC 7 /* NC** NC** ON* */
|
||||
|
||||
/* *=FLASHING **=if INIRQ, SIGNAL, or ASSERTION will be flashing */
|
||||
|
||||
/* BUTTON definitions *******************************************************/
|
||||
|
||||
#define SW1_PRESSED 0x01 /* Bit 0: 1=SW1 pressed */
|
||||
#define SW2_PRESSED 0x02 /* Bit 1: 1=SW2 pressed */
|
||||
#define SW3_PRESSED 0x04 /* Bit 2: 1=SW3 pressed */
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __BOARDS_RENESAS_M32262F8_SKP16C26_INCLUDE_BOARD_H */
|
||||
@@ -0,0 +1,54 @@
|
||||
############################################################################
|
||||
# boards/renesas/m16c/skp16c26/scripts/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/.config
|
||||
include $(TOPDIR)/tools/Config.mk
|
||||
|
||||
CROSSDEV = m32c-nuttx-elf-
|
||||
CC = $(CROSSDEV)gcc
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCPUFLAGS = -mcpu=m16c -fno-builtin
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
|
||||
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)skp16c26.ld
|
||||
|
||||
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
@@ -0,0 +1,124 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/scripts/skp16c26.ld
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
OUTPUT_ARCH(m32c)
|
||||
ENTRY(_stext)
|
||||
SECTIONS
|
||||
{
|
||||
/* "Far" flash memory begins at address 0xf0000 for the M20262F8 part and
|
||||
* ends at address 0xfffff (all parts). The program entry point is
|
||||
* the first address in flash
|
||||
*/
|
||||
|
||||
. = 0xf0000;
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got) /* Global offset table */
|
||||
_etext = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
_enronly = ABSOLUTE(.); /* End of read-only values */
|
||||
/* .ndata will be relocated */
|
||||
/* from this address */
|
||||
|
||||
/* The "variable" vector table will be fixed at the following address */
|
||||
|
||||
. = 0xffd00;
|
||||
.varvect : {
|
||||
_svarvect = ABSOLUTE(.);
|
||||
*(.varvect)
|
||||
_evarvect = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
/* Followed by the special page/fixed vector table. */
|
||||
|
||||
. = 0xffe00;
|
||||
.specpg : {
|
||||
_sspecpg = ABSOLUTE(.);
|
||||
*(.specpg)
|
||||
_especpg = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
. = 0xfffdc;
|
||||
.fixvect : {
|
||||
_sfixvect = ABSOLUTE(.);
|
||||
*(.fixvect)
|
||||
_efixvect = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
/* Internal "near" RAM begins at address 0x00400 (all parts) and ends at
|
||||
* address 0x00bff (M20262F6 and M20262F8 parts). With the RAM
|
||||
* region, used is .data followed by .bss. The remainder of RAM
|
||||
* carved up by the start-up code into stacks and heaps.
|
||||
*/
|
||||
|
||||
. = 0x00400;
|
||||
|
||||
.ndata : {
|
||||
_sndata = ABSOLUTE(.);
|
||||
*(.data)
|
||||
CONSTRUCTORS
|
||||
_endata = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
.nbss : { /* BSS */
|
||||
_snbss = ABSOLUTE(.);
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
_enbss = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
/* "Far" RAM begins at 0x10000. The SKP16C26 has no far RAM */
|
||||
|
||||
. = 0x10000;
|
||||
|
||||
.fdata : {
|
||||
_sfdata = ABSOLUTE(.);
|
||||
*(.fdata)
|
||||
CONSTRUCTORS
|
||||
_efdata = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
.fbss : { /* BSS */
|
||||
_sfbss = ABSOLUTE(.);
|
||||
*(.fbss)
|
||||
*(COMMON)
|
||||
_efbss = ABSOLUTE(.);
|
||||
}
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
############################################################################
|
||||
# boards/renesas/m16c/skp16c26/src/Makefile
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
CSRCS = m16c_leds.c m16c_buttons.c m16c_lcd.c m16c_lcdconsole.c
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
@@ -0,0 +1,101 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/src/m16c_buttons.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The SKP62C26 has 3 buttons control by bits 1, 2, and 3 in port 8. */
|
||||
|
||||
#define SW1_BIT (1 << 3) /* Bit 3, port 8 */
|
||||
#define SW2_BIT (1 << 2) /* Bit 2, port 8 */
|
||||
#define SW3_BIT (1 << 1) /* Bit 1, port 8 */
|
||||
|
||||
#define SW_PRESSED(p,b) (((p) & (b)) == 0)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_initialize
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
uint32_t board_button_initialize(void)
|
||||
{
|
||||
uint8_t regval;
|
||||
|
||||
regval = getreg8(M16C_PD8);
|
||||
regval |= (SW1_BIT | SW2_BIT | SW3_BIT);
|
||||
putreg8(regval, M16C_PD8);
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint32_t swset = 0;
|
||||
uint8_t regval = getreg8(M16C_P8);
|
||||
|
||||
if (SW_PRESSED(regval, SW1_BIT))
|
||||
{
|
||||
swset |= SW1_PRESSED;
|
||||
}
|
||||
|
||||
if (SW_PRESSED(regval, SW2_BIT))
|
||||
{
|
||||
swset |= SW2_PRESSED;
|
||||
}
|
||||
|
||||
if (SW_PRESSED(regval, SW3_BIT))
|
||||
{
|
||||
swset |= SW3_PRESSED;
|
||||
}
|
||||
|
||||
return swset;
|
||||
}
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
||||
@@ -0,0 +1,268 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/src/m16c_lcd.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "chip.h"
|
||||
|
||||
#ifdef CONFIG_SLCD
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* LCD dimensions ***********************************************************/
|
||||
|
||||
#define LCD_NLINES 2 /* Two lines */
|
||||
#define LCD_NCHARS 8 /* Eight characters per line */
|
||||
|
||||
/* LCD commands *************************************************************/
|
||||
|
||||
#define LCD_CLEAR 0x01 /* Clear LCD display and home cursor */
|
||||
#define CURSOR_MODE_DEC 0x04 /* Cursor auto decrement after R/W */
|
||||
#define CURSOR_MODE_INC 0x06 /* Cursor auto increment after R/W */
|
||||
#define LCD_CURSOR_ON 0x0e /* Display ON with Cursor */
|
||||
#define LCD_CURSOR_OFF 0x0c /* Display ON with Cursor off */
|
||||
#define LCD_CURSOR_BLINK 0x0d /* Display on with blinking cursor */
|
||||
#define LCD_CURSOR_LEFT 0x10 /* Move Cursor Left One Position */
|
||||
#define LCD_CURSOR_RIGHT 0x14 /* Move Cursor Right One Position */
|
||||
#define FUNCTION_SET 0x28 /* Setup, 4 bits,2 lines, 5X7 */
|
||||
#define LCD_CGRAM 0x40 /* Map characters to CG RAM */
|
||||
#define LCD_POS_L1(p) (0x80 | p) /* Move cursor to line 1, character p+1 */
|
||||
#define LCD_POS_L2(p) (0xc0 | p) /* Move cursor to line 2, character p+1 */
|
||||
#define LCD_HOME_L1 0x80 /* Move cursor to line 1 */
|
||||
#define LCD_HOME_L2 0xc0 /* Move cursor to line 2 */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static uint8_t g_nchars; /* Number of characters in lines 2 */
|
||||
static uint8_t g_line[LCD_NCHARS]; /* The content of lines 2 */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_lcddelay
|
||||
****************************************************************************/
|
||||
|
||||
static void up_lcddelay(uint16_t count)
|
||||
{
|
||||
uint32_t counter = (uint16_t)count << 8;
|
||||
while (counter--)
|
||||
{
|
||||
asm("\tnop\n\tnop\n\tnop\n" : :); /* 3 NOPs */
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_setrs
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_setrs(bool data)
|
||||
{
|
||||
/* Set/clear bit 1 of port 6 */
|
||||
|
||||
register uint8_t regval = getreg8(M16C_P6);
|
||||
if (data)
|
||||
{
|
||||
regval |= (1 << 0); /* High = data */
|
||||
}
|
||||
else
|
||||
{
|
||||
regval &= ~(1 << 0); /* Low = control */
|
||||
}
|
||||
|
||||
putreg8(regval, M16C_P6);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_seten
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_seten(void)
|
||||
{
|
||||
/* Set bit 1 of port 6 */
|
||||
|
||||
register uint8_t regval = getreg8(M16C_P6);
|
||||
regval |= (1 << 1);
|
||||
putreg8(regval, M16C_P6);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_clren
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_clren(void)
|
||||
{
|
||||
/* Clear bit 1 of port 6 */
|
||||
|
||||
register uint8_t regval = getreg8(M16C_P6);
|
||||
regval &= ~(1 << 1);
|
||||
putreg8(regval, M16C_P6);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_enpluse
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_enpulse(bool data)
|
||||
{
|
||||
up_seten(); /* EN enable chip (HIGH) */
|
||||
up_lcddelay(0); /* Short delay */
|
||||
up_clren(); /* Latch data by setting EN low */
|
||||
up_lcddelay(0); /* Short delay for data writes */
|
||||
if (!data) up_lcddelay(0); /* Longer delay for control writes */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_lcdwrite
|
||||
****************************************************************************/
|
||||
|
||||
void up_lcdwrite(bool data, uint8_t ch)
|
||||
{
|
||||
up_setrs(data); /* Set RS appropriately */
|
||||
|
||||
/* Write upper nibble first. Only the lower 4 bits of P9 are valid.
|
||||
* The upper four bits are reserved and must be zero.
|
||||
*/
|
||||
|
||||
putreg8(ch >> 4, M16C_P9);
|
||||
up_enpulse(data);
|
||||
|
||||
/* Write lower nibble second */
|
||||
|
||||
putreg8(ch & 0x0f, M16C_P9);
|
||||
up_enpulse(data);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_scroll
|
||||
****************************************************************************/
|
||||
|
||||
static void up_scroll(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Clear the display and position the cursor at the beginning of line 1 */
|
||||
|
||||
up_lcdwrite(false, LCD_CLEAR);
|
||||
up_lcdwrite(false, LCD_HOME_L1);
|
||||
|
||||
/* Copy line 2 to line 1 */
|
||||
|
||||
for (i = 0; i < g_nchars; i++)
|
||||
{
|
||||
up_lcdwrite(true, g_line[i]);
|
||||
}
|
||||
|
||||
/* Position the cursor at the beginning of line 2 */
|
||||
|
||||
up_lcdwrite(false, LCD_HOME_L2);
|
||||
g_nchars = 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_lcdinit
|
||||
****************************************************************************/
|
||||
|
||||
void up_lcdinit(void)
|
||||
{
|
||||
uint8_t regval;
|
||||
|
||||
/* Enable writing to PD9 by selecting bit 2 in the protection register */
|
||||
|
||||
regval = getreg8(M16C_PRCR);
|
||||
regval |= (1 << 2);
|
||||
putreg8(regval, M16C_PRCR);
|
||||
|
||||
/* We can't read PD9, so we can't OR the values in */
|
||||
|
||||
putreg8(0x0f, M16C_PD9);
|
||||
|
||||
/* Set EN (port 6 bit 1) and Set RS (port 6 bit 0) as outputs */
|
||||
|
||||
regval = getreg8(M16C_P6);
|
||||
regval |= (1 << 1) | (1 << 0);
|
||||
putreg8(regval, M16C_P6);
|
||||
|
||||
regval = getreg8(M16C_PD6);
|
||||
regval |= (1 << 1) | (1 << 0);
|
||||
putreg8(regval, M16C_PD6);
|
||||
|
||||
/* Set EN low */
|
||||
|
||||
up_clren();
|
||||
|
||||
/* Write the reset sequence */
|
||||
|
||||
up_lcdwrite(false, 0x33);
|
||||
up_lcddelay(20);
|
||||
up_lcdwrite(false, 0x32);
|
||||
up_lcddelay(20);
|
||||
up_lcdwrite(false, FUNCTION_SET); /* reset sequence */
|
||||
up_lcdwrite(false, FUNCTION_SET);
|
||||
up_lcdwrite(false, LCD_CURSOR_OFF);
|
||||
up_lcdwrite(false, LCD_CLEAR);
|
||||
up_lcdwrite(false, LCD_HOME_L1);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_lcdputc
|
||||
****************************************************************************/
|
||||
|
||||
void up_lcdputc(char ch)
|
||||
{
|
||||
/* Check for new line */
|
||||
|
||||
if (ch == '\n')
|
||||
{
|
||||
up_scroll();
|
||||
}
|
||||
|
||||
/* Should we wrap to truncate at the end of line??? Let's truncate.
|
||||
* In either case, let's ignore all other non-printable characters.
|
||||
*/
|
||||
|
||||
else if (g_nchars < LCD_NCHARS && isprint(ch))
|
||||
{
|
||||
up_lcdwrite(true, ch);
|
||||
g_line[g_nchars] = ch;
|
||||
g_nchars++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SLCD */
|
||||
@@ -0,0 +1,125 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/src/m16c_lcdconsole.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "skp16c26.h"
|
||||
|
||||
/* Only use the LCD as a console if there are is no serial console */
|
||||
|
||||
#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_M16C_UART0)
|
||||
# define HAVE_SERIALCONSOLE 1
|
||||
#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_M16C_UART1)
|
||||
# define HAVE_SERIALCONSOLE 1
|
||||
#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_M16C_UART2)
|
||||
# define HAVE_SERIALCONSOLE 1
|
||||
#else
|
||||
# undef HAVE_SERIALCONSOLE
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SERIALCONSOLE) && defined(CONFIG_SLCD) && \
|
||||
defined(CONFIG_SLCD_CONSOLE)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_earlyconsoleinit
|
||||
*
|
||||
* Description:
|
||||
* Performs the low level UART initialization early in debug so that the
|
||||
* serial console will be available during bootup.
|
||||
* This must be called before up_consoleinit.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef USE_EARLYSERIALINIT
|
||||
# warning "You probably need to define CONFIG_ARCH_LOWCONSOLE"
|
||||
void up_earlyconsoleinit(void)
|
||||
{
|
||||
/* There is probably a problem if we are here */
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_consoleinit
|
||||
*
|
||||
* Description:
|
||||
* Register serial console and serial ports. This assumes that
|
||||
* up_earlyconsoleinit was called previously.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if USE_SERIALDRIVER
|
||||
# warning "You probably need to define CONFIG_ARCH_LOWCONSOLE"
|
||||
void up_consoleinit(void)
|
||||
{
|
||||
/* There is probably a problem if we are here */
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_lowputc
|
||||
*
|
||||
* Description:
|
||||
* Output one character on the console
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_lowputc(char ch)
|
||||
{
|
||||
up_lcdputc(ch);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_putc
|
||||
*
|
||||
* Description:
|
||||
* Output one character on the console
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_putc(int ch)
|
||||
{
|
||||
up_lcdputc(ch);
|
||||
return ch;
|
||||
}
|
||||
|
||||
#endif /* !HAVE_SERIALCONSOLE && CONFIG_SLCD && CONFIG_SLCD_CONSOLE */
|
||||
@@ -0,0 +1,241 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/src/m16c_leds.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "chip.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The SKP62C26 has 3 LEDs control by bits
|
||||
* 0 and 2 in port 7 and bit 0 in port 8.
|
||||
*/
|
||||
|
||||
#define GREEN_LED (1 << 2) /* Bit 2, port 7 */
|
||||
#define YELLOW_LED (1 << 4) /* Bit 4, port 7 */
|
||||
#define RED_LED (1 << 0) /* Bit 0, port 8 */
|
||||
|
||||
#define GREEN_LED_ON 0
|
||||
#define GREEN_LED_OFF GREEN_LED
|
||||
#define GREEN_LED_MASK GREEN_LED
|
||||
#define GREEN_LED_PORT M16C_P7
|
||||
|
||||
#define YELLOW_LED_ON 0
|
||||
#define YELLOW_LED_OFF YELLOW_LED
|
||||
#define YELLOW_LED_MASK YELLOW_LED
|
||||
#define YELLOW_LED_PORT M16C_P7
|
||||
|
||||
#define GREENYELLOW_LED_MASK (GREEN_LED_MASK|YELLOW_LED_MASK)
|
||||
#define GREENYELLOW_LED_PORT M16C_P7
|
||||
#define GREENYELLOW_DIR_PORT M16C_PD7
|
||||
|
||||
#define RED_LED_ON 0
|
||||
#define RED_LED_OFF RED_LED
|
||||
#define RED_LED_MASK RED_LED
|
||||
#define RED_LED_PORT M16C_P8
|
||||
#define RED_DIR_PORT M16C_PD8
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const uint8_t g_ledstate[7] =
|
||||
{
|
||||
(GREEN_LED_OFF | YELLOW_LED_OFF | RED_LED_OFF), /* LED_STARTED */
|
||||
(GREEN_LED_ON | YELLOW_LED_OFF | RED_LED_OFF), /* LED_HEAPALLOCATE */
|
||||
(GREEN_LED_OFF | YELLOW_LED_ON | RED_LED_OFF), /* LED_IRQSENABLED */
|
||||
(GREEN_LED_ON | YELLOW_LED_ON | RED_LED_OFF), /* LED_STACKCREATED */
|
||||
(GREEN_LED_ON | YELLOW_LED_OFF | RED_LED_ON), /* LED_INIRQ */
|
||||
(GREEN_LED_OFF | YELLOW_LED_ON | RED_LED_ON), /* LED_SIGNAL */
|
||||
(GREEN_LED_ON | YELLOW_LED_ON | RED_LED_ON) /* LED_ASSERTION */
|
||||
};
|
||||
|
||||
static uint8_t g_prevled[3];
|
||||
static uint8_t g_nestlevel;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: m16c_setleds
|
||||
****************************************************************************/
|
||||
|
||||
static void m16c_setleds(uint8_t gybits, uint8_t rbit)
|
||||
{
|
||||
uint8_t regval;
|
||||
|
||||
regval = getreg8(GREENYELLOW_LED_PORT);
|
||||
regval &= ~GREENYELLOW_LED_MASK;
|
||||
regval |= gybits;
|
||||
putreg8(regval, GREENYELLOW_LED_PORT);
|
||||
|
||||
regval = getreg8(RED_LED_PORT);
|
||||
regval &= ~RED_LED_MASK;
|
||||
regval |= rbit;
|
||||
putreg8(regval, RED_LED_PORT);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
register uint8_t regval;
|
||||
|
||||
/* Make sure that the LEDs are in the OFF state */
|
||||
|
||||
regval = getreg8(GREENYELLOW_LED_PORT);
|
||||
regval |= (GREEN_LED_OFF | YELLOW_LED_OFF);
|
||||
putreg8(regval, GREENYELLOW_LED_PORT);
|
||||
|
||||
regval = getreg8(RED_LED_PORT);
|
||||
regval |= RED_LED_OFF;
|
||||
putreg8(regval, RED_LED_PORT);
|
||||
|
||||
/* Set the direction to output */
|
||||
|
||||
regval = getreg8(GREENYELLOW_DIR_PORT);
|
||||
regval |= (GREEN_LED | YELLOW_LED);
|
||||
putreg8(regval, GREENYELLOW_DIR_PORT);
|
||||
|
||||
regval = getreg8(RED_DIR_PORT);
|
||||
regval |= RED_LED;
|
||||
putreg8(regval, RED_DIR_PORT);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
uint8_t ledset;
|
||||
|
||||
/* If this is the ASSERTION led, preserve the Y&G bits from the last
|
||||
* setting and set the RED LED on.
|
||||
*/
|
||||
|
||||
if (led == LED_ASSERTION)
|
||||
{
|
||||
ledset = g_ledstate[g_prevled[g_nestlevel]];
|
||||
m16c_setleds(ledset & GREENYELLOW_LED_MASK, RED_LED_ON);
|
||||
}
|
||||
else if (led < LED_ASSERTION)
|
||||
{
|
||||
/* Otherwise, just show the LEDs corresponding to this state */
|
||||
|
||||
ledset = g_ledstate[led];
|
||||
m16c_setleds(ledset & GREENYELLOW_LED_MASK, ledset & RED_LED_MASK);
|
||||
|
||||
/* If this was a nested states (INIRQ, SIGNAL, or ASSERTION) then
|
||||
* stack up the previous value.
|
||||
*/
|
||||
|
||||
if (led > LED_STACKCREATED)
|
||||
{
|
||||
g_nestlevel++;
|
||||
}
|
||||
|
||||
g_prevled[g_nestlevel] = led;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
uint8_t ledset;
|
||||
|
||||
/* If this is the ASSERTION led then what we do depends on
|
||||
* the previous state
|
||||
*/
|
||||
|
||||
if (led == LED_ASSERTION)
|
||||
{
|
||||
/* If the previous state was one of the nested states
|
||||
* (INIRQ, SIGNAL, or ASSERTION),
|
||||
* then turn the green and yellow LEDs all off.
|
||||
* That way we can distinguish that case from the simple cases.
|
||||
*/
|
||||
|
||||
if (g_nestlevel > 0)
|
||||
{
|
||||
ledset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ledset = g_ledstate[g_prevled[0]];
|
||||
}
|
||||
|
||||
m16c_setleds(ledset & GREENYELLOW_LED_MASK, RED_LED_OFF);
|
||||
}
|
||||
else if (led > 0 && led < LED_ASSERTION)
|
||||
{
|
||||
/* If this was one of the nested states,
|
||||
* then we want to back to the LED setting
|
||||
* before entering that nested statel.
|
||||
*/
|
||||
|
||||
if (g_nestlevel > 0)
|
||||
{
|
||||
g_nestlevel--;
|
||||
led = g_prevled[g_nestlevel];
|
||||
}
|
||||
else if (led > LED_STACKCREATED)
|
||||
{
|
||||
/* This shouldn't happen */
|
||||
|
||||
led--;
|
||||
}
|
||||
|
||||
ledset = g_ledstate[led];
|
||||
m16c_setleds(ledset & GREENYELLOW_LED_MASK, ledset & RED_LED_MASK);
|
||||
g_prevled[g_nestlevel] = led;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
||||
@@ -0,0 +1,48 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/src/skp16c26.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_M32262F8_SKP16C26_SRC_SKP16C26_H
|
||||
#define __BOARDS_RENESAS_M32262F8_SKP16C26_SRC_SKP16C26_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __BOARDS_RENESAS_M32262F8_SKP16C26_SRC_SKP16C26_H */
|
||||
Reference in New Issue
Block a user