forked from xuos/xiuos
support lt768 lcd
This commit is contained in:
parent
d27685965c
commit
dde22ee0b8
|
@ -34,6 +34,10 @@ ifeq ($(CONFIG_ARCH_LEDS),y)
|
|||
CSRCS += k210_leds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_K210_LCD),y)
|
||||
CSRCS += k210_lcd.c lcd_demo.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DEV_GPIO),y)
|
||||
CSRCS += k210_gpio.c
|
||||
endif
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "k210.h"
|
||||
#include "k210_clockconfig.h"
|
||||
#include "xidatong-riscv64.h"
|
||||
|
||||
#ifdef CONFIG_BSP_USING_CH438
|
||||
|
@ -75,5 +76,14 @@ int k210_bringup(void)
|
|||
board_ch438_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_K210_LCD
|
||||
k210_sysctl_init();
|
||||
ret = board_lcd_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_NOTICE, "board lcd initialize %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,219 @@
|
|||
/*
|
||||
* Copyright (c) 2022 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file k210_lcd.c
|
||||
* @brief LCD relative driver
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022.7.21
|
||||
*/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "k210_fpioa.h"
|
||||
#include "k210_gpiohs.h"
|
||||
#include "nuttx/arch.h"
|
||||
#include "nuttx/lcd/lt768.h"
|
||||
#include "nuttx/lcd/lt768_lib.h"
|
||||
#include "nuttx/lcd/k210_lcd.h"
|
||||
#ifdef CONFIG_LCD_LCDDRV_SPIIF
|
||||
#include "nuttx/lcd/lcddrv_spiif.h"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void test_delay(void)
|
||||
{
|
||||
volatile uint32_t i = 0;
|
||||
for (i = 0; i < 200; ++i)
|
||||
{
|
||||
__asm("NOP"); /* delay */
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_pin_init(void)
|
||||
{
|
||||
k210_fpioa_config(BSP_LCD_NRST, HS_GPIO(FPIOA_LCD_NRST) | K210_IOFLAG_GPIOHS);
|
||||
k210_fpioa_config(BSP_LCD_SCLK, HS_GPIO(FPIOA_LCD_SCLK) | K210_IOFLAG_GPIOHS);
|
||||
k210_fpioa_config(BSP_LCD_MOSI, HS_GPIO(FPIOA_LCD_MOSI) | K210_IOFLAG_GPIOHS);
|
||||
k210_fpioa_config(BSP_LCD_MISO, HS_GPIO(FPIOA_LCD_MISO) | K210_IOFLAG_GPIOHS);
|
||||
k210_fpioa_config(BSP_LCD_NCS, HS_GPIO(FPIOA_LCD_NCS) | K210_IOFLAG_GPIOHS);
|
||||
|
||||
k210_gpiohs_set_direction(FPIOA_LCD_MISO, GPIO_DM_INPUT);
|
||||
k210_gpiohs_set_direction(FPIOA_LCD_NRST, GPIO_DM_OUTPUT);
|
||||
k210_gpiohs_set_direction(FPIOA_LCD_SCLK, GPIO_DM_OUTPUT);
|
||||
k210_gpiohs_set_direction(FPIOA_LCD_MOSI, GPIO_DM_OUTPUT);
|
||||
k210_gpiohs_set_direction(FPIOA_LCD_NCS, GPIO_DM_OUTPUT);
|
||||
|
||||
lcd_set_pin(FPIOA_LCD_SCLK, GPIO_PV_HIGH);
|
||||
lcd_set_pin(FPIOA_LCD_NCS, GPIO_PV_HIGH);
|
||||
lcd_set_pin(FPIOA_LCD_NRST, GPIO_PV_HIGH);
|
||||
}
|
||||
|
||||
void lcd_backlight_init(bool enable)
|
||||
{
|
||||
k210_fpioa_config(BSP_LCD_BL_PIN, HS_GPIO(FPIOA_LCD_BL) | K210_IOFLAG_GPIOHS);
|
||||
k210_gpiohs_set_direction(FPIOA_LCD_BL, GPIO_DM_OUTPUT);
|
||||
k210_gpiohs_set_value(FPIOA_LCD_BL, enable);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LCD_LCDDRV_SPIIF
|
||||
int spiif_backlight(FAR struct lcddrv_lcd_s *lcd, int level)
|
||||
{
|
||||
lcd_backlight_init(true);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t lcd_transfer_byte(uint8_t dat)
|
||||
{
|
||||
uint8_t i, rx_data = 0;
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
CLK_H;
|
||||
|
||||
// MOSI during falling edge
|
||||
if((dat << i) & 0x80)
|
||||
{
|
||||
MOSI_H;
|
||||
}
|
||||
else
|
||||
{
|
||||
MOSI_L;
|
||||
}
|
||||
|
||||
CLK_L;
|
||||
|
||||
// MISO during rising edge
|
||||
rx_data <<= 1;
|
||||
if(lcd_get_pin(FPIOA_LCD_MISO))
|
||||
rx_data ++;
|
||||
}
|
||||
CLK_H;
|
||||
return rx_data;
|
||||
}
|
||||
|
||||
void LCD_CmdWrite(uint8_t cmd)
|
||||
{
|
||||
NCS_L;
|
||||
lcd_transfer_byte(0x00);
|
||||
lcd_transfer_byte(cmd);
|
||||
NCS_H;
|
||||
}
|
||||
|
||||
void LCD_DataWrite(uint8_t data)
|
||||
{
|
||||
NCS_L;
|
||||
lcd_transfer_byte(0x80);
|
||||
lcd_transfer_byte(data);
|
||||
NCS_H;
|
||||
}
|
||||
|
||||
void LCD_DataWrite_Pixel(uint8_t data)
|
||||
{
|
||||
NCS_L;
|
||||
lcd_transfer_byte(0x80);
|
||||
lcd_transfer_byte(data);
|
||||
NCS_H;
|
||||
NCS_L;
|
||||
lcd_transfer_byte(0x80);
|
||||
lcd_transfer_byte(data >> 8);
|
||||
NCS_H;
|
||||
}
|
||||
|
||||
uint8_t LCD_StatusRead(void)
|
||||
{
|
||||
uint8_t temp = 0;
|
||||
NCS_L;
|
||||
lcd_transfer_byte(0x40);
|
||||
temp = lcd_transfer_byte(0xff);
|
||||
NCS_H;
|
||||
return temp;
|
||||
}
|
||||
|
||||
uint8_t LCD_DataRead(void)
|
||||
{
|
||||
uint8_t temp = 0;
|
||||
NCS_L;
|
||||
lcd_transfer_byte(0xc0);
|
||||
temp = lcd_transfer_byte(0xff);
|
||||
NCS_H;
|
||||
return temp;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void lcd_drv_init(void)
|
||||
{
|
||||
uint8_t PwmControl = 100;
|
||||
|
||||
lcd_pin_init();
|
||||
lt768_init();
|
||||
Select_SFI_Dual_Mode0();
|
||||
|
||||
// PWM1 enable backlight
|
||||
LT768_PWM1_Init(1, 0, 200, 100, PwmControl);
|
||||
|
||||
// enable RGB output
|
||||
Display_ON();
|
||||
|
||||
Main_Image_Start_Address(LCD_START_ADDR);
|
||||
Main_Image_Width(LCD_XSIZE_TFT);
|
||||
Main_Window_Start_XY(0, 0);
|
||||
Canvas_Image_Start_address(LCD_START_ADDR);
|
||||
Canvas_image_width(LCD_XSIZE_TFT);
|
||||
Active_Window_XY(0, 0);
|
||||
Active_Window_WH(LCD_XSIZE_TFT, LCD_YSIZE_TFT);
|
||||
up_mdelay(10);
|
||||
Canvas_Image_Start_address(LCD_START_ADDR);
|
||||
|
||||
//fill blue background
|
||||
LT768_DrawSquare_Fill(0, 0, LCD_XSIZE_TFT, LCD_YSIZE_TFT, Blue);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: k210_lcd_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the LCD. Setup backlight (initially off)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_lcd_initialize(void)
|
||||
{
|
||||
/* Configure the LCD backlight (and turn the backlight off) */
|
||||
lcd_backlight_init(true);
|
||||
lcd_drv_init();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: k210_backlight
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_K210_LCD_BACKLIGHT is defined, then the board-specific
|
||||
* logic must provide this interface to turn the backlight on and off.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_K210_LCD_BACKLIGHT
|
||||
void k210_backlight(bool blon)
|
||||
{
|
||||
lcd_backlight_init(blon);
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,64 @@
|
|||
/****************************************************************************
|
||||
* lcd_demo.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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file lcd_demo.c
|
||||
* @brief
|
||||
* @version 1.0.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2022-07-21
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "nuttx/arch.h"
|
||||
#include "nuttx/lcd/lt768.h"
|
||||
#include "nuttx/lcd/lt768_lib.h"
|
||||
#include "nuttx/lcd/k210_lcd.h"
|
||||
|
||||
void LcdDemo(void)
|
||||
{
|
||||
// int x1 = 0, y1 = 0, x2 = LCD_XSIZE_TFT, y2 = LCD_YSIZE_TFT;
|
||||
int x1 = 100, y1 = 100, x2 = 200, y2 = 200;
|
||||
|
||||
Main_Image_Start_Address(LCD_START_ADDR);
|
||||
Main_Image_Width(LCD_XSIZE_TFT);
|
||||
Main_Window_Start_XY(0, 0);
|
||||
Canvas_Image_Start_address(LCD_START_ADDR);
|
||||
Canvas_image_width(LCD_XSIZE_TFT);
|
||||
Active_Window_XY(0, 0);
|
||||
Active_Window_WH(LCD_XSIZE_TFT, LCD_YSIZE_TFT);
|
||||
up_mdelay(10);
|
||||
Canvas_Image_Start_address(LCD_START_ADDR);
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
syslog(LOG_NOTICE, "Disp_demo %d\n", i);
|
||||
LT768_DrawSquare_Fill(x1, y1, x2, y2, Red);
|
||||
up_mdelay(2000);
|
||||
LT768_DrawSquare_Fill(x1, y1, x2, y2, Green);
|
||||
up_mdelay(2000);
|
||||
LT768_DrawSquare_Fill(x1, y1, x2, y2, Blue);
|
||||
up_mdelay(2000);
|
||||
}
|
||||
}
|
||||
|
|
@ -1454,6 +1454,10 @@ int nsh_foreach_var(FAR struct nsh_vtbl_s *vtbl, nsh_foreach_var_t cb,
|
|||
int cmd_Ch438(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_K210_LCD) && !defined(CONFIG_NSH_DISABLE_LCD)
|
||||
int cmd_Lcd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_APPLICATION_SENSOR_HCHO_TB600B_WQ_HCHO1OS) && !defined(CONFIG_NSH_DISABLE_HCHO_TB600B_WQ_HCHO1OS)
|
||||
int cmd_Hcho1os(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
|
|
|
@ -49,6 +49,19 @@ int cmd_Ch438(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_lcd
|
||||
****************************************************************************/
|
||||
#if defined(CONFIG_K210_LCD) && !defined(CONFIG_NSH_DISABLE_LCD)
|
||||
extern void LcdDemo(void);
|
||||
int cmd_Lcd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
nsh_output(vtbl, "Hello, LCD!\n");
|
||||
LcdDemo();
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_Hcho1os
|
||||
****************************************************************************/
|
||||
|
|
|
@ -600,6 +600,10 @@ static const struct cmdmap_s g_cmdmap[] =
|
|||
{ "ch438", cmd_Ch438, 1, 1, "[ch438 demo cmd.]" },
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_K210_LCD) && !defined(CONFIG_NSH_DISABLE_LCD)
|
||||
{ "lcd", cmd_Lcd, 1, 1, "[LCD demo cmd.]" },
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_APPLICATION_SENSOR_HCHO_TB600B_WQ_HCHO1OS) && !defined(CONFIG_NSH_DISABLE_HCHO_TB600B_WQ_HCHO1OS)
|
||||
{ "hcho1os", cmd_Hcho1os, 1, 1, "[get the concentration of formaldehyde with sensor tb600b_wq_hcho1os.]" },
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
comment "K210 Configuration Options"
|
||||
|
||||
menu "K210 Peripheral Support"
|
||||
|
||||
# These "hidden" settings determine whether a peripheral option is available
|
||||
# for the selected MCU
|
||||
|
||||
config K210_HAVE_UART0
|
||||
bool
|
||||
default y
|
||||
select UART0_SERIALDRIVER
|
||||
select ARCH_HAVE_SERIAL_TERMIOS
|
||||
|
||||
# These are the peripheral selections proper
|
||||
|
||||
config K210_UART0
|
||||
bool "UART0"
|
||||
default y
|
||||
select ARCH_HAVE_UART0
|
||||
select ARCH_HAVE_SERIAL_TERMIOS
|
||||
select K210_UART
|
||||
|
||||
config K210_HAVE_LCD
|
||||
bool
|
||||
default n
|
||||
|
||||
config K210_LCD
|
||||
bool "LCD"
|
||||
default y
|
||||
select K210_HAVE_LCD
|
||||
|
||||
config K210_LCD_BACKLIGHT
|
||||
bool "LCD BACKLIGHT"
|
||||
default y
|
||||
|
||||
endmenu
|
||||
|
||||
menu "K210 Others"
|
||||
|
||||
config K210_WITH_QEMU
|
||||
bool "qemu support"
|
||||
default n
|
||||
|
||||
endmenu
|
|
@ -57,6 +57,7 @@ CHIP_CSRCS = k210_allocateheap.c k210_clockconfig.c
|
|||
CHIP_CSRCS += k210_irq.c k210_irq_dispatch.c k210_systemreset.c
|
||||
CHIP_CSRCS += k210_lowputc.c k210_serial.c k210_fpioa.c
|
||||
CHIP_CSRCS += k210_start.c k210_timerisr.c k210_gpiohs.c k210_gpio.c
|
||||
CHIP_CSRCS += k210_sysctl.c
|
||||
|
||||
ifeq ($(CONFIG_BUILD_PROTECTED),y)
|
||||
CMN_CSRCS += riscv_task_start.c riscv_pthread_start.c
|
||||
|
|
1329
Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/nuttx/arch/risc-v/src/k210/encoding.h
Executable file
1329
Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/nuttx/arch/risc-v/src/k210/encoding.h
Executable file
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,153 @@
|
|||
/****************************************************************************
|
||||
* arch/risc-v/src/k210/k210_clockconfig.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 <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "k210_clockconfig.h"
|
||||
#include "k210_sysctl.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define OSC_FREQ 26000000UL
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static uint32_t g_cpu_clock = 390000000;//416000000;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: k210_get_cpuclk
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t k210_get_cpuclk(void)
|
||||
{
|
||||
return g_cpu_clock;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: k210_get_pll0clk
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_K210_WITH_QEMU
|
||||
uint32_t k210_get_pll0clk(void)
|
||||
{
|
||||
uint32_t pll0;
|
||||
uint32_t nr;
|
||||
uint32_t nf;
|
||||
uint32_t od;
|
||||
|
||||
pll0 = getreg32(K210_SYSCTL_PLL0);
|
||||
nr = PLL_CLK_R(pll0) + 1;
|
||||
nf = PLL_CLK_F(pll0) + 1;
|
||||
od = PLL_CLK_OD(pll0) + 1;
|
||||
|
||||
return OSC_FREQ / nr * nf / od;
|
||||
}
|
||||
|
||||
uint32_t k210_get_pll1clk(void)
|
||||
{
|
||||
uint32_t pll1;
|
||||
uint32_t nr;
|
||||
uint32_t nf;
|
||||
uint32_t od;
|
||||
|
||||
pll1 = getreg32(K210_SYSCTL_PLL1);
|
||||
nr = PLL_CLK_R(pll1) + 1;
|
||||
nf = PLL_CLK_F(pll1) + 1;
|
||||
od = PLL_CLK_OD(pll1) + 1;
|
||||
|
||||
return OSC_FREQ / nr * nf / od;
|
||||
}
|
||||
|
||||
uint32_t k210_get_pll2clk(void)
|
||||
{
|
||||
uint32_t pll2;
|
||||
uint32_t nr;
|
||||
uint32_t nf;
|
||||
uint32_t od;
|
||||
|
||||
pll2 = getreg32(K210_SYSCTL_PLL2);
|
||||
nr = PLL_CLK_R(pll2) + 1;
|
||||
nf = PLL_CLK_F(pll2) + 1;
|
||||
od = PLL_CLK_OD(pll2) + 1;
|
||||
|
||||
return OSC_FREQ / nr * nf / od;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: k210_clockconfig
|
||||
****************************************************************************/
|
||||
|
||||
void k210_clockconfig(void)
|
||||
{
|
||||
#ifndef CONFIG_K210_WITH_QEMU
|
||||
uint32_t clksel0;
|
||||
|
||||
/* Obtain clock selector for ACLK */
|
||||
clksel0 = getreg32(K210_SYSCTL_CLKSEL0);
|
||||
|
||||
if (1 == CLKSEL0_ACLK_SEL(clksel0))
|
||||
{
|
||||
/* PLL0 selected */
|
||||
g_cpu_clock = k210_get_pll0clk() / 2;
|
||||
|
||||
syslog(LOG_NOTICE, "g_cpu clock = %d sel %#x\r\n", g_cpu_clock, clksel0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* OSC selected */
|
||||
|
||||
g_cpu_clock = OSC_FREQ;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void k210_sysctl_init(void)
|
||||
{
|
||||
// sysctl_pll_set_freq(SYSCTL_PLL0, 800000000UL);
|
||||
// sysctl_pll_set_freq(SYSCTL_PLL1, 400000000UL);
|
||||
// sysctl_pll_set_freq(SYSCTL_PLL2, 45158400UL);
|
||||
sysctl_clock_set_threshold(SYSCTL_THRESHOLD_APB1, 2);
|
||||
|
||||
// sysctl_set_power_mode(SYSCTL_POWER_BANK0, SYSCTL_POWER_V18);
|
||||
// sysctl_set_power_mode(SYSCTL_POWER_BANK1, SYSCTL_POWER_V18);
|
||||
// sysctl_set_power_mode(SYSCTL_POWER_BANK2, SYSCTL_POWER_V18);
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/****************************************************************************
|
||||
* arch/risc-v/src/k210/k210_clockconfig.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 __ARCH_RISCV_SRC_K210_K210_CLOCKCONFIG_H
|
||||
#define __ARCH_RISCV_SRC_K210_K210_CLOCKCONFIG_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "k210_memorymap.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN uint32_t k210_get_cpuclk(void);
|
||||
EXTERN uint32_t k210_get_pll0clk(void);
|
||||
EXTERN void k210_clockconfig(void);
|
||||
EXTERN void k210_sysctl_init(void);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#undef EXTERN
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_RISCV_SRC_K210_K210_CLOCKCONFIG_H */
|
|
@ -38,6 +38,8 @@
|
|||
#include <stdbool.h>
|
||||
#include "k210_gpio_common.h"
|
||||
|
||||
#define HS_GPIO(n) (K210_IO_FUNC_GPIOHS0 + n)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions Prototypes
|
||||
****************************************************************************/
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/****************************************************************************
|
||||
* arch/risc-v/src/k210/k210_memorymap.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 __ARCH_RISCV_SRC_K210_K210_MEMORYMAP_H
|
||||
#define __ARCH_RISCV_SRC_K210_K210_MEMORYMAP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "hardware/k210_memorymap.h"
|
||||
#include "hardware/k210_uart.h"
|
||||
#include "hardware/k210_clint.h"
|
||||
#include "hardware/k210_plic.h"
|
||||
//#include "hardware/k210_sysctl.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Idle thread stack starts from _ebss */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#define K210_IDLESTACK_BASE (uintptr_t)&_ebss
|
||||
#else
|
||||
#define K210_IDLESTACK_BASE _ebss
|
||||
#endif
|
||||
|
||||
#define K210_IDLESTACK0_BASE (K210_IDLESTACK_BASE)
|
||||
#define K210_IDLESTACK0_TOP (K210_IDLESTACK0_BASE + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
#endif /* __ARCH_RISCV_SRC_K210_K210_MEMORYMAP_H */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,183 @@
|
|||
############################################################################
|
||||
# drivers/lcd/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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_LCD),y)
|
||||
|
||||
# Support for the generic LCD framebuffer front-end
|
||||
|
||||
ifeq ($(CONFIG_LCD_FRAMEBUFFER),y)
|
||||
CSRCS += lcd_framebuffer.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_DEV),y)
|
||||
CSRCS += lcd_dev.c
|
||||
endif
|
||||
|
||||
# Include support for Graphics LCD drivers
|
||||
|
||||
ifeq ($(CONFIG_LCD_FT80X),y)
|
||||
CSRCS += ft80x.c
|
||||
ifeq ($(CONFIG_LCD_FT80X_SPI),y)
|
||||
CSRCS += ft80x_spi.c
|
||||
else ifeq ($(CONFIG_LCD_FT80X_I2C),y)
|
||||
CSRCS += ft80x_i2c.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_LPM013M091A),y)
|
||||
CSRCS += lpm013m091a.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_P14201),y)
|
||||
CSRCS += p14201.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_UG2864AMBAG01),y)
|
||||
CSRCS += ug-2864ambag01.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_UG9664HSWAG01),y)
|
||||
CSRCS += ug-9664hswag01.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_SSD1306),y)
|
||||
CSRCS += ssd1306_base.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_SSD1306_SPI),y)
|
||||
CSRCS += ssd1306_spi.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_SSD1306_I2C),y)
|
||||
CSRCS += ssd1306_i2c.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_SSD1289),y)
|
||||
CSRCS += ssd1289.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_SSD1351),y)
|
||||
CSRCS += ssd1351.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_MIO283QT2),y)
|
||||
CSRCS += mio283qt2.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_MAX7219),y)
|
||||
CSRCS += max7219.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_MIO283QT9A),y)
|
||||
CSRCS += mio283qt9a.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_PCD8544),y)
|
||||
CSRCS += pcd8544.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_ST7565),y)
|
||||
CSRCS += st7565.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_ST7567),y)
|
||||
CSRCS += st7567.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_SHARP_MEMLCD),y)
|
||||
CSRCS += memlcd.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_ILI9225),y)
|
||||
CSRCS += ili9225.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_ILI9340),y)
|
||||
CSRCS += ili9340.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_ILI9341),y)
|
||||
CSRCS += ili9341.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_LT768),y)
|
||||
CSRCS += lt768.c lt768_lib.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_LCDDRV_SPIIF),y)
|
||||
CSRCS += lcddrv_spiif.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_RA8875),y)
|
||||
CSRCS += ra8875.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_ST7735),y)
|
||||
CSRCS += st7735.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_ST7789),y)
|
||||
CSRCS += st7789.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_GC9A01),y)
|
||||
CSRCS += gc9a01.c
|
||||
endif
|
||||
|
||||
endif # CONFIG_LCD
|
||||
|
||||
ifeq ($(CONFIG_SLCD),y)
|
||||
|
||||
# Include support for Alphanumeric/Segment LCD drivers
|
||||
|
||||
ifeq ($(CONFIG_LCD_BACKPACK),y)
|
||||
CSRCS += pcf8574_lcd_backpack.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_ST7032),y)
|
||||
CSRCS += st7032.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_HT16K33),y)
|
||||
CSRCS += ht16k33_14seg.c
|
||||
endif
|
||||
endif # CONFIG_SLCD
|
||||
|
||||
# Other LCD-related devices
|
||||
|
||||
ifeq ($(CONFIG_LCD_TDA19988),y)
|
||||
CSRCS += tda19988.c
|
||||
endif
|
||||
|
||||
# Include LCD driver build support (the nested if-then-else implements an OR)
|
||||
|
||||
ifeq ($(CONFIG_LCD),y)
|
||||
DEPPATH += --dep-path lcd
|
||||
VPATH += :lcd
|
||||
CFLAGS += ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)lcd}
|
||||
else ifeq ($(CONFIG_SLCD),y)
|
||||
DEPPATH += --dep-path lcd
|
||||
VPATH += :lcd
|
||||
CFLAGS += ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)lcd}
|
||||
else ifeq ($(CONFIG_LCD_OTHER),y)
|
||||
DEPPATH += --dep-path lcd
|
||||
VPATH += :lcd
|
||||
CFLAGS += ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)lcd}
|
||||
endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue