zcu111: add support for board led
This commit is contained in:
parent
b817db86b8
commit
85e8536fbe
@ -5,7 +5,6 @@
|
|||||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
# modifications.
|
# modifications.
|
||||||
#
|
#
|
||||||
# CONFIG_ARCH_LEDS is not set
|
|
||||||
# CONFIG_DEBUG_OPT_UNUSED_SECTIONS is not set
|
# CONFIG_DEBUG_OPT_UNUSED_SECTIONS is not set
|
||||||
CONFIG_ARCH="arm64"
|
CONFIG_ARCH="arm64"
|
||||||
CONFIG_ARCH_ARM64=y
|
CONFIG_ARCH_ARM64=y
|
||||||
|
@ -31,4 +31,46 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* LED definitions **********************************************************/
|
||||||
|
|
||||||
|
/* The ZCU111 PL has only one MIO LEDs, Others LED connected to PL.
|
||||||
|
*
|
||||||
|
* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in
|
||||||
|
* any way. The following definitions are used to access individual LEDs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* LED index values for use with board_userled() */
|
||||||
|
|
||||||
|
#define BOARD_LED1 0
|
||||||
|
#define BOARD_NLEDS 1
|
||||||
|
|
||||||
|
/* LED bits for use with board_userled_all() */
|
||||||
|
|
||||||
|
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
||||||
|
|
||||||
|
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board
|
||||||
|
* The following definitions describe how NuttX controls the LED:
|
||||||
|
*
|
||||||
|
* SYMBOL Meaning LED1 state
|
||||||
|
* ------------------ ----------------------- ----------
|
||||||
|
* LED_STARTED NuttX has been started OFF
|
||||||
|
* LED_HEAPALLOCATE Heap has been allocated OFF
|
||||||
|
* LED_IRQSENABLED Interrupts enabled OFF
|
||||||
|
* LED_STACKCREATED Idle stack created ON
|
||||||
|
* LED_INIRQ In an interrupt No change
|
||||||
|
* LED_SIGNAL In a signal handler No change
|
||||||
|
* LED_ASSERTION An assertion failed No change
|
||||||
|
* LED_PANIC The system has crashed Blinking
|
||||||
|
* LED_IDLE STM32 is is sleep mode Not used
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LED_STARTED 0
|
||||||
|
#define LED_HEAPALLOCATE 0
|
||||||
|
#define LED_IRQSENABLED 0
|
||||||
|
#define LED_STACKCREATED 1
|
||||||
|
#define LED_INIRQ 2
|
||||||
|
#define LED_SIGNAL 2
|
||||||
|
#define LED_ASSERTION 2
|
||||||
|
#define LED_PANIC 1
|
||||||
|
|
||||||
#endif /* __BOARDS_ARM64_ZYNQ_MPSOC_ZCU111_INCLUDE_BOARD_H */
|
#endif /* __BOARDS_ARM64_ZYNQ_MPSOC_ZCU111_INCLUDE_BOARD_H */
|
||||||
|
@ -23,6 +23,10 @@ include $(TOPDIR)/Make.defs
|
|||||||
CSRCS = zcu111_boardinit.c
|
CSRCS = zcu111_boardinit.c
|
||||||
CSRCS += zcu111_appinit.c
|
CSRCS += zcu111_appinit.c
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||||
|
CSRCS += zcu111_autoleds.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ETC_ROMFS),y)
|
ifeq ($(CONFIG_ETC_ROMFS),y)
|
||||||
RCSRCS = etc/init.d/rc.sysinit etc/init.d/rcS
|
RCSRCS = etc/init.d/rc.sysinit etc/init.d/rcS
|
||||||
endif
|
endif
|
||||||
|
@ -27,6 +27,20 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "zynq_mio.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
|
/* LEDs *********************************************************************/
|
||||||
|
|
||||||
|
/* Green LED on MIO23 */
|
||||||
|
|
||||||
|
#define LED_DS50 23
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
81
boards/arm64/zynq-mpsoc/zcu111/src/zcu111_autoleds.c
Normal file
81
boards/arm64/zynq-mpsoc/zcu111/src/zcu111_autoleds.c
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm64/zynq-mpsoc/zcu111/src/zcu111_autoleds.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 <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "chip.h"
|
||||||
|
#include "arm64_internal.h"
|
||||||
|
#include "zcu111.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_LEDS)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_initialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_initialize(void)
|
||||||
|
{
|
||||||
|
/* Configure LED GPIOs for output */
|
||||||
|
|
||||||
|
zynq_mio_setdirpin(LED_DS50, 1);
|
||||||
|
zynq_mio_setoutenpin(LED_DS50, 1);
|
||||||
|
zynq_mio_writepin(LED_DS50, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_on
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_on(int led)
|
||||||
|
{
|
||||||
|
if (led == BOARD_LED1)
|
||||||
|
{
|
||||||
|
zynq_mio_writepin(LED_DS50, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_off
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_off(int led)
|
||||||
|
{
|
||||||
|
if (led == BOARD_LED1)
|
||||||
|
{
|
||||||
|
zynq_mio_writepin(LED_DS50, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_ARCH_LEDS */
|
@ -76,10 +76,13 @@ void zynq_memory_initialize(void)
|
|||||||
|
|
||||||
void zynq_board_initialize(void)
|
void zynq_board_initialize(void)
|
||||||
{
|
{
|
||||||
|
/* resets the GPIO module by writing reset values to all registers */
|
||||||
|
|
||||||
|
zynq_mio_initialize();
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
/* Configure on-board LEDs if LED support has been selected. */
|
/* Configure on-board LEDs if LED support has been selected. */
|
||||||
|
|
||||||
/* board_autoled_initialize(); */
|
board_autoled_initialize();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user