Make buildroot a git submodule

This commit is contained in:
Michel-FK
2019-03-24 23:24:40 +01:00
parent eb4f2c0959
commit 4c4f5b8001
46 changed files with 46 additions and 102 deletions

1
FunKey/Config.in Normal file
View File

@@ -0,0 +1 @@
source "$BR2_EXTERNAL_FUNKEY_PATH/package/mednafen/Config.in"

View File

@@ -0,0 +1,4 @@
setenv bootargs console=ttyS0,115200 panic=5 console=tty0 rootwait fbcon=map:10 fbcon=font:VGA8x8 root=/dev/mmcblk0p2 earlyprintk rw
load mmc 0:1 0x41000000 zImage
load mmc 0:1 0x41800000 sun8i-v3s-funkey.dtb
bootz 0x41000000 - 0x41800000

File diff suppressed because it is too large Load Diff

View File

View File

@@ -0,0 +1,34 @@
image boot.vfat {
vfat {
files = {
"zImage",
"sun8i-v3s-funkey.dtb",
"boot.scr"
}
}
size = 8M
}
image sdcard.img {
hdimage {
}
partition u-boot {
in-partition-table = "no"
image = "u-boot-sunxi-with-spl.bin"
offset = 8192
size = 516096 # 512KB - 8192
}
partition boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}
partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
size = 0
}
}

View File

@@ -0,0 +1,154 @@
CONFIG_LOCALVERSION="-funkey"
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_CGROUPS=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_PERF_EVENTS=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_ARCH_SUNXI=y
# CONFIG_MACH_SUN4I is not set
# CONFIG_MACH_SUN5I is not set
# CONFIG_MACH_SUN6I is not set
# CONFIG_MACH_SUN7I is not set
# CONFIG_MACH_SUN9I is not set
CONFIG_HAVE_ARM_ARCH_TIMER=y
CONFIG_ARM_PSCI=y
CONFIG_HIGHMEM=y
CONFIG_ARM_APPENDED_DTB=y
CONFIG_ARM_ATAG_DTB_COMPAT=y
CONFIG_CPU_FREQ=y
CONFIG_CPUFREQ_DT=y
CONFIG_VFP=y
CONFIG_NEON=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
# CONFIG_INET_XFRM_MODE_BEET is not set
# CONFIG_INET_DIAG is not set
# CONFIG_IPV6 is not set
CONFIG_DNS_RESOLVER=y
# CONFIG_WIRELESS is not set
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_MTD=y
CONFIG_MTD_M25P80=y
CONFIG_MTD_SPI_NOR=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=1
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
CONFIG_NETDEVICES=y
# CONFIG_ETHERNET is not set
# CONFIG_WLAN is not set
CONFIG_INPUT_EVDEV=y
CONFIG_KEYBOARD_SUN4I_LRADC=y
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_NS2009=y
CONFIG_INPUT_MISC=y
CONFIG_INPUT_AXP20X_PEK=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=8
CONFIG_SERIAL_8250_RUNTIME_UARTS=8
CONFIG_SERIAL_8250_DW=y
CONFIG_SERIAL_OF_PLATFORM=y
# CONFIG_HW_RANDOM is not set
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MV64XXX=y
CONFIG_SPI=y
CONFIG_SPI_SUN6I=y
CONFIG_PTP_1588_CLOCK=y
CONFIG_GPIO_SYSFS=y
CONFIG_POWER_SUPPLY=y
CONFIG_THERMAL=y
CONFIG_CPU_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_SUNXI_WATCHDOG=y
CONFIG_MFD_AXP20X_I2C=y
CONFIG_MFD_AXP20X_RSB=y
CONFIG_MFD_SYSCON=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_REGULATOR_AXP20X=y
# CONFIG_RC_CORE is not set
CONFIG_DRM=y
CONFIG_DRM_SUN4I=y
CONFIG_DRM_PANEL_SIMPLE=y
CONFIG_DRM_DUMB_VGA_DAC=y
CONFIG_FB_SIMPLE=y
CONFIG_FB_SSD1307=y
CONFIG_BACKLIGHT_PWM=y
CONFIG_LOGO=y
CONFIG_SOUND=y
CONFIG_SND=y
# CONFIG_SND_DRIVERS is not set
# CONFIG_SND_ARM is not set
# CONFIG_SND_SPI is not set
CONFIG_SND_SOC=y
CONFIG_SND_SUN4I_CODEC=y
CONFIG_SND_SUN8I_CODEC=y
CONFIG_SND_SUN8I_CODEC_ANALOG=y
# CONFIG_HID_GENERIC is not set
# CONFIG_HID_A4TECH is not set
# CONFIG_HID_APPLE is not set
# CONFIG_HID_BELKIN is not set
# CONFIG_HID_CHERRY is not set
# CONFIG_HID_CHICONY is not set
# CONFIG_HID_CYPRESS is not set
# CONFIG_HID_EZKEY is not set
# CONFIG_HID_ITE is not set
# CONFIG_HID_KENSINGTON is not set
# CONFIG_HID_LOGITECH is not set
# CONFIG_HID_MICROSOFT is not set
# CONFIG_HID_MONTEREY is not set
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_GADGET=y
CONFIG_USB_ETH=m
CONFIG_USB_ETH_EEM=y
CONFIG_USB_MASS_STORAGE=m
CONFIG_USB_G_SERIAL=m
CONFIG_USB_G_ACM_MS=m
CONFIG_MMC=y
CONFIG_MMC_SUNXI=y
CONFIG_RTC_CLASS=y
# CONFIG_RTC_INTF_SYSFS is not set
# CONFIG_RTC_INTF_PROC is not set
CONFIG_DMADEVICES=y
CONFIG_DMA_SUN6I=y
CONFIG_STAGING=y
CONFIG_FB_TFT=y
CONFIG_FB_TFT_ST7789V=y
CONFIG_FB_FLEX=y
# CONFIG_SUN8I_A23_CCU is not set
# CONFIG_SUN8I_A33_CCU is not set
# CONFIG_SUN8I_H3_CCU is not set
CONFIG_SUN8I_DE2_CCU=y
# CONFIG_IOMMU_SUPPORT is not set
CONFIG_PWM_SUN4I=y
CONFIG_PHY_SUN4I_USB=y
CONFIG_NVMEM_SUNXI_SID=y
CONFIG_EXT4_FS=y
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
CONFIG_CONFIGFS_FS=y
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_NETWORK_FILESYSTEMS is not set
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_PRINTK_TIME=y
CONFIG_DEBUG_FS=y
CONFIG_KEYS=y
CONFIG_CRYPTO_CCM=y
CONFIG_CRYPTO_GCM=y
CONFIG_CRYPTO_CMAC=y
CONFIG_CRYPTO_ARC4=y
CONFIG_CRYPTO_DEV_SUN4I_SS=y

View File

@@ -0,0 +1,74 @@
fb_st7789v.c | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
index a5d7c87..69f52af 100644
--- a/drivers/staging/fbtft/fb_st7789v.c
+++ b/drivers/staging/fbtft/fb_st7789v.c
@@ -86,6 +86,28 @@ enum st7789v_command {
static int init_display(struct fbtft_par *par)
{
/* turn off sleep mode */
+ /*write_reg(par, 0x11);
+ mdelay(120);
+
+ write_reg(par, 0x36, 0x00);
+ write_reg(par, 0x3A, 0x05);
+
+ write_reg(par, 0xB2,0x0C,0x0C,0x00,0x33,0x33);
+ write_reg(par, 0xB7,0x35);
+ write_reg(par, 0xBB,0x1A);
+ write_reg(par, 0xC0,0x2C);
+ write_reg(par, 0xC2,0x01);
+ write_reg(par, 0xC3,0x0B);
+ write_reg(par, 0xC4,0x20);
+ write_reg(par, 0xC6,0x0F);
+ write_reg(par, 0xD0,0xA4,0xA1);
+ write_reg(par, 0x21);
+ write_reg(par, 0xE0,0x00,0x19,0x1E,0x0A,0x09,0x15,0x3D,0x44,0x51,0x12,0x03,0x00,0x3F,0x3F);
+ write_reg(par, 0xE1,0x00,0x18,0x1E,0x0A,0x09,0x25,0x3F,0x43,0x52,0x33,0x03,0x00,0x3F,0x3F);
+ write_reg(par, 0x29);*/
+
+
+ /* turn off sleep mode */
write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
mdelay(120);
@@ -128,7 +150,14 @@ static int init_display(struct fbtft_par *par)
*/
write_reg(par, PWCTRL1, 0xA4, 0xA1);
+ /* Ystart at 80 , Yend at 240 */
+ write_reg(par, 0x2B, 0x00, 0x50, 0x00, 0xF0);
+
+ /* Display Inversion of colors */
+ write_reg(par, 0x21);
+
write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
+
return 0;
}
@@ -189,7 +218,7 @@ static int set_gamma(struct fbtft_par *par, u32 *curves)
* The masks are the same for both positive and negative voltage
* gamma curves.
*/
- static const u8 gamma_par_mask[] = {
+ const u8 gamma_par_mask[] = {
0xFF, /* V63[3:0], V0[3:0]*/
0x3F, /* V1[5:0] */
0x3F, /* V2[5:0] */
@@ -241,7 +270,7 @@ static int blank(struct fbtft_par *par, bool on)
static struct fbtft_display display = {
.regwidth = 8,
.width = 240,
- .height = 320,
+ .height = 240,
.gamma_num = 2,
.gamma_len = 14,
.gamma = DEFAULT_GAMMA,
@@ -263,3 +292,4 @@ MODULE_ALIAS("platform:st7789v");
MODULE_DESCRIPTION("FB driver for the ST7789V LCD Controller");
MODULE_AUTHOR("Dennis Menschel");
MODULE_LICENSE("GPL");
+

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
From 538e97d56bae968580ac046389243383b7559ab9 Mon Sep 17 00:00:00 2001
From: Michel Stempin <michel.stempin@wanadoo.fr>
Date: Tue, 19 Mar 2019 22:26:56 +0100
Subject: [PATCH 9/9] rotated screen 90 degrees CW
Signed-off-by: Michel Stempin <michel.stempin@wanadoo.fr>
---
arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts | 2 +-
drivers/staging/fbtft/fb_st7789v.c | 13 ++++++++++---
drivers/staging/fbtft/fbtft-core.c | 8 +++++++-
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
index 69f52af..e966993 100644
--- a/drivers/staging/fbtft/fb_st7789v.c
+++ b/drivers/staging/fbtft/fb_st7789v.c
@@ -150,9 +150,6 @@ static int init_display(struct fbtft_par *par)
*/
write_reg(par, PWCTRL1, 0xA4, 0xA1);
- /* Ystart at 80 , Yend at 240 */
- write_reg(par, 0x2B, 0x00, 0x50, 0x00, 0xF0);
-
/* Display Inversion of colors */
write_reg(par, 0x21);
@@ -190,6 +187,16 @@ static int set_var(struct fbtft_par *par)
return -EINVAL;
}
write_reg(par, MIPI_DCS_SET_ADDRESS_MODE, madctl_par);
+
+ // All offset operations are done after in fbtft_set_addr_win, not here
+ /* Ystart at 0 , Yend at 239 */
+ //write_reg(par, 0x2B, 0x00, 0x50, 0x00, 0xEF);
+ write_reg(par, 0x2B, 0x00, 0x00, 0x00, 0xEF);
+ //write_reg(par, 0x2B, 0x00, 0x50, 0x01, 0x3F);
+ /* Xstart at 80 , Xend at 319 */
+ write_reg(par, 0x2A, 0x00, 0x50, 0x01, 0x3F);
+ //write_reg(par, 0x2A, 0x00, 0x50, 0x00, 0xEF);
+
return 0;
}
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 6d0363d..fbb0934 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -391,9 +391,15 @@ static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,
fbtft_par_dbg(DEBUG_UPDATE_DISPLAY, par, "%s(start_line=%u, end_line=%u)\n",
__func__, start_line, end_line);
- if (par->fbtftops.set_addr_win)
+ // Carefull removing this. this will work only if the full screen is updated at once
+ /*if (par->fbtftops.set_addr_win){
par->fbtftops.set_addr_win(par, 0, start_line,
par->info->var.xres - 1, end_line);
+ }*/
+ if (par->fbtftops.set_addr_win){
+ par->fbtftops.set_addr_win(par, 80, start_line,
+ 320 - 1, end_line);
+ }
offset = start_line * par->info->fix.line_length;
len = (end_line - start_line + 1) * par->info->fix.line_length;
--
2.7.4

View File

@@ -0,0 +1,166 @@
--- /dev/null 2019-03-22 21:33:35.539154398 +0100
+++ a/arch/arm/boot/dts/sun8i-v3s-funkey.dts 2019-03-22 22:37:31.157868364 +0100
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2019 Michel Stempin <michel.stempin@wanadoo.fr>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ * a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ * b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun8i-v3s.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+/ {
+ model = "FunKey";
+ compatible = "funkey", "allwinner,sun8i-v3s";
+
+ aliases {
+ serial0 = &uart0;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ backlight: backlight {
+ compatible = "pwm-backlight";
+ pwms = <&pwm 0 1000000 0>;
+ brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
+ default-brightness-level = <100>;
+ };
+};
+
+&codec {
+ allwinner,audio-routing =
+ "Headphone", "HP",
+ "Headphone", "HPCOM",
+ "MIC1", "Mic",
+ "Mic", "HBIAS";
+ status = "okay";
+};
+
+&ehci0 {
+ status = "okay";
+};
+
+&i2c0 {
+ status = "okay";
+
+ axp209: pmic@34 {
+ compatible = "x-powers,axp209";
+ reg = <0x34>;
+ interrupts = <0>;
+
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+};
+
+&mmc0 {
+ pinctrl-0 = <&mmc0_pins_a>;
+ pinctrl-names = "default";
+ broken-cd;
+ bus-width = <4>;
+ vmmc-supply = <&reg_vcc3v3>;
+ status = "okay";
+};
+
+&ohci0 {
+ status = "okay";
+};
+
+#include "axp209.dtsi"
+
+&reg_dcdc2 {
+ regulator-always-on;
+ regulator-min-microvolt = <1000000>;
+ regulator-max-microvolt = <1400000>;
+ regulator-name = "vdd-cpu-sys-ephy";
+};
+
+&reg_dcdc3 {
+ regulator-always-on;
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3450000>;
+ regulator-name = "vcc-io-ephy-mcsi-usb";
+};
+
+&reg_ldo1 {
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3600000>;
+ regulator-name = "vcc-rtc";
+};
+
+&reg_ldo2 {
+ regulator-always-on;
+ regulator-min-microvolt = <2800000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-name = "avcc-pll";
+};
+
+&spi0 {
+ status = "okay";
+
+ st7789v@0 {
+ compatible = "sitronix,st7789v";
+ reg = <0>;
+
+ spi-max-frequency = <40000000>;
+ txbuflen = <115200>;
+ rotate = <90>;
+ fps = <42>;
+ buswidth = <8>;
+ reset-gpios = <&pio 4 1 GPIO_ACTIVE_LOW>; //PE1
+ dc-gpios = <&pio 2 0 GPIO_ACTIVE_LOW>; //PC0 (MISO)
+ debug = <0>;
+ };
+};
+
+&uart0 {
+ pinctrl-0 = <&uart0_pins_a>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&pwm {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pwm0_pins>;
+ status = "okay";
+};

View File

@@ -0,0 +1,12 @@
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 1f97ae8..e798bf1 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -932,6 +932,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
sun8i-h3-orangepi-plus2e.dtb \
sun8i-r16-bananapi-m2m.dtb \
sun8i-r16-parrot.dtb \
+ sun8i-v3s-funkey.dtb \
sun8i-v3s-licheepi-zero.dtb \
sun8i-v3s-licheepi-zero-dock.dtb \
sun8i-v3s-licheepi-zero-with-480x272-lcd.dtb \

View File

@@ -0,0 +1,163 @@
/*
* Copyright (C) 2019 Michel Stempin <michel.stempin@wanadoo.fr>
*
* This file is dual-licensed: you can use it either under the terms
* of the GPL or the X11 license, at your option. Note that this dual
* licensing only applies to this file, and not this project as a
* whole.
*
* a) This file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Or, alternatively,
*
* b) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/dts-v1/;
#include "sun8i-v3s.dtsi"
#include "sunxi-common-regulators.dtsi"
/ {
model = "FunKey";
compatible = "funkey", "allwinner,sun8i-v3s";
aliases {
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:115200n8";
};
backlight: backlight {
compatible = "pwm-backlight";
pwms = <&pwm 0 1000000 0>;
brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
default-brightness-level = <100>;
};
};
&codec {
allwinner,audio-routing =
"Headphone", "HP",
"Headphone", "HPCOM",
"MIC1", "Mic",
"Mic", "HBIAS";
status = "okay";
};
&ehci0 {
status = "okay";
};
&i2c0 {
status = "okay";
axp209: pmic@34 {
compatible = "x-powers,axp209";
reg = <0x34>;
interrupts = <0>;
interrupt-controller;
#interrupt-cells = <1>;
};
};
&mmc0 {
pinctrl-0 = <&mmc0_pins_a>;
pinctrl-names = "default";
broken-cd;
bus-width = <4>;
vmmc-supply = <&reg_vcc3v3>;
status = "okay";
};
&ohci0 {
status = "okay";
};
#include "axp209.dtsi"
&reg_dcdc2 {
regulator-always-on;
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1400000>;
regulator-name = "vdd-cpu-sys-ephy";
};
&reg_dcdc3 {
regulator-always-on;
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3450000>;
regulator-name = "vcc-io-ephy-mcsi-usb";
};
&reg_ldo1 {
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3600000>;
regulator-name = "vcc-rtc";
};
&reg_ldo2 {
regulator-always-on;
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <3300000>;
regulator-name = "avcc-pll";
};
&spi0 {
status = "okay";
st7789v@0 {
compatible = "sitronix,st7789v";
reg = <0>;
spi-max-frequency = <40000000>;
txbuflen = <115200>;
rotate = <90>;
fps = <42>;
buswidth = <8>;
reset-gpios = <&pio 4 1 GPIO_ACTIVE_LOW>; //PE1
dc-gpios = <&pio 2 0 GPIO_ACTIVE_LOW>; //PC0 (MISO)
debug = <0>;
};
};
&uart0 {
pinctrl-0 = <&uart0_pins_a>;
pinctrl-names = "default";
status = "okay";
};
&pwm {
pinctrl-names = "default";
pinctrl-0 = <&pwm0_pins>;
status = "okay";
};

View File

@@ -0,0 +1,86 @@
--- /dev/null 2019-03-22 21:33:35.539154398 +0100
+++ a/arch/arm/dts/sun8i-v3s-funkey.dts 2019-03-22 22:22:37.417295027 +0100
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2019 Michel Stempin <michel.stempin@wanadoo.fr>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ * a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ * b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun8i-v3s.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+/ {
+ model = "FunKey";
+ compatible = "funkey", "allwinner,sun8i-v3s";
+
+ aliases {
+ serial0 = &uart0;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+};
+
+&mmc0 {
+ pinctrl-0 = <&mmc0_pins_a>;
+ pinctrl-names = "default";
+ broken-cd;
+ bus-width = <4>;
+ vmmc-supply = <&reg_vcc3v3>;
+ status = "okay";
+};
+
+&uart0 {
+ pinctrl-0 = <&uart0_pins_a>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&usb_otg {
+ dr_mode = "otg";
+ status = "okay";
+};
+
+&usbphy {
+ usb0_id_det-gpio = <&pio 5 6 GPIO_ACTIVE_HIGH>;
+ status = "okay";
+};

View File

@@ -0,0 +1,12 @@
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 469dd71..e91a8d3 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -281,6 +281,7 @@ dtb-$(CONFIG_MACH_SUN8I_H3) += \
sun8i-h3-orangepi-plus2e.dtb \
sun8i-h3-nanopi-neo.dtb
dtb-$(CONFIG_MACH_SUN8I_V3S) += \
+ sun8i-v3s-funkey.dtb \
sun8i-v3s-licheepi-zero.dtb
dtb-$(CONFIG_MACH_SUN50I) += \
sun50i-a64-pine64-plus.dtb \

View File

@@ -0,0 +1,83 @@
/*
* Copyright (C) 2019 Michel Stempin <michel.stempin@wanadoo.fr>
*
* This file is dual-licensed: you can use it either under the terms
* of the GPL or the X11 license, at your option. Note that this dual
* licensing only applies to this file, and not this project as a
* whole.
*
* a) This file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Or, alternatively,
*
* b) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/dts-v1/;
#include "sun8i-v3s.dtsi"
#include "sunxi-common-regulators.dtsi"
/ {
model = "FunKey";
compatible = "funkey", "allwinner,sun8i-v3s";
aliases {
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:115200n8";
};
};
&mmc0 {
pinctrl-0 = <&mmc0_pins_a>;
pinctrl-names = "default";
broken-cd;
bus-width = <4>;
vmmc-supply = <&reg_vcc3v3>;
status = "okay";
};
&uart0 {
pinctrl-0 = <&uart0_pins_a>;
pinctrl-names = "default";
status = "okay";
};
&usb_otg {
dr_mode = "otg";
status = "okay";
};
&usbphy {
usb0_id_det-gpio = <&pio 5 6 GPIO_ACTIVE_HIGH>;
status = "okay";
};

View File

@@ -0,0 +1,5 @@
#!/bin/sh
# Swap
sed -i '/^\/swap/d' "${TARGET_DIR}/etc/fstab"
echo "/swap none swap defaults 0 0" >> "${TARGET_DIR}/etc/fstab"

View File

@@ -0,0 +1,65 @@
# FunKey
Intro
=====
This directory contains a buildroot-based external configuration for
building the FunKey.
How to build it
===============
Configure Buildroot
-------------------
There is only one FunKey defconfig files in Buildroot:
$ ./fun funkey_defconfig
Build the rootfs
----------------
Note: you will need to have access to the network, since Buildroot
will download the packages' sources.
You may now build your FunKey with:
$ ./have fun
(This may take a while, consider getting yourself a coffee ;-) )
Result of the build
-------------------
After building, you should obtain this tree:
FunKey/output/images/
+-- boot.scr
+-- boot.vfat
+-- rootfs.ext2
+-- rootfs.ext4 -> rootfs.ext2
+-- rootfs.tar
+-- sdcard.img
+-- sun8i-v3s-funkey.dtb
+-- u-boot.bin
+-- u-boot-sunxi-with-spl.bin
`-- zImage
How to write the SD card
========================
Once the build process is finished you will have an image called
"sdcard.img" in the FunKey/output/images/ directory.
Copy the bootable "sdcard.img" onto an SD card with "dd":
$ sudo dd if=<FunKey directory>/FunKey/output/images/sdcard.img of=/dev/sdX
Alternatively, you can use the Etcher graphical tool to burn the image
to the SD card safely and on any platform:
https://etcher.io/
Once the SD card is burned, insert it into your FunKey board, and
power it up. Your new system should come up now and start a console on
the UART0 serial port.

View File

@@ -0,0 +1,24 @@
#!/bin/sh
THIS=$(basename $0)
case "$1" in
start)
sleep 1
echo "$THIS: starting resizing the root partition" | tee /dev/kmsg &&
resize_rootfs &&
rm /etc/init.d/S02resize_rootfs
if [ $? -eq 0 ]; then
echo "$THIS: finished resizing the root partition, rebooting to enlarge the root filesystem" | tee /dev/kmsg
reboot
exit 0
else
echo "$THIS: cannot resize the root partition, aborting" | tee /dev/kmsg
exit 1
fi
;;
*)
echo "Usage: $0 start" >&2
exit 2
;;
esac

View File

@@ -0,0 +1,54 @@
#!/bin/sh
THIS=$(basename $0)
case "$1" in
start)
if [ ! -f /swap ]; then
ROOT_PART=$(df | grep /dev/root)
set $ROOT_PART
let LEFT="$4 * 1024"
if [ $LEFT -lt 134217728 ]; then
echo "$THIS: not enough free space for swap file found, aborting" | tee /dev/kmsg
exit 1
fi
echo "$THIS: no swap file found, creating it" | tee /dev/kmsg &&
dd if=/dev/zero of=/swap bs=1M count=128 &&
mkswap /swap &&
chmod 0600 /swap
if [ $? -eq 0 ]; then
echo "$THIS: created swap file" | tee /dev/kmsg
else
echo "$THIS: cannot create swap file, aborting" | tee /dev/kmsg
rm /swap
exit 2
fi
fi
echo "$THIS: enabling swap file" | tee /dev/kmsg &&
swapon -a
if [ $? -eq 0 ]; then
echo "$THIS: swap file enabled" | tee /dev/kmsg
else
echo "$THIS: cannot enable swap file, aborting" | tee /dev/kmsg
exit 3
fi
;;
stop)
echo "$THIS: disabling swap file" | tee /dev/kmsg &&
swapoff -a
if [ $? -eq 0 ]; then
echo "$THIS: swap file disabled" | tee /dev/kmsg
else
echo "$THIS: cannot disable swap file, aborting" | tee /dev/kmsg
exit 4
fi
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "Usage: $0 {start|stop|restart|reload}" >&2
exit 5
;;
esac

View File

@@ -0,0 +1,52 @@
#!/bin/sh
# Assure that the kernel has module support.
[ -e /proc/ksyms -o -e /proc/modules ] || exit 0
THIS=$(basename $0)
case "${1}" in
start)
# Exit if there's no modules file or there are no
# valid entries
if [ -r /etc/sysconfig/modules ]; then
egrep -qv '^($|#)' /etc/sysconfig/modules
if [ $? -ne 0 ]; then
echo "$THIS: no module found in /etc/sysconfig/modules" | tee/dev/kmsg
exit 0
fi
fi
echo "$THIS: loading modules from /etc/sysconfig/modules:" | tee/dev/kmsg
# Only try to load modules if the user has actually given us
# some modules to load.
while read MODULE ARGS; do
# Ignore comments and blank lines.
case "$MODULE" in
""|"#"*) continue ;;
esac
# Attempt to load the module, making
# sure to pass any arguments provided.
modprobe ${MODULE} ${ARGS} >/dev/null
# Print the module name if successful,
# otherwise take note.
if [ $? -eq 0 ]; then
echo "$THIS: loaded module ${MODULE}" | tee /dev/kmsg
else
echo "$THIS: failed to load module ${MODULE}" | tee /dev/kmsg
fi
done < /etc/sysconfig/modules
# Print a message about successfully loaded
# modules on the correct line.
echo "$THIS: finished loading modules" | tee /dev/kmsg
;;
*)
echo "Usage: ${0} {start}"
exit 1
;;
esac

View File

@@ -0,0 +1,209 @@
#!/bin/sh
#
# alsa-utils initscript
#
### BEGIN INIT INFO
# Provides: alsa-utils
# Required-Start: $local_fs $remote_fs
# Required-Stop: $remote_fs
# Default-Start: S
# Default-Stop: 0 1 6
# Short-Description: Restore and store ALSA driver settings
# Description: This script stores and restores mixer levels on
# shutdown and bootup.On sysv-rc systems: to
# disable storing of mixer levels on shutdown,
# remove /etc/rc[06].d/K50alsa-utils. To disable
# restoring of mixer levels on bootup, rename the
# "S50alsa-utils" symbolic link in /etc/rcS.d/ to
# "K50alsa-utils".
### END INIT INFO
# Don't use set -e; check exit status instead
# Exit silently if package is no longer installed
[ -x /usr/sbin/alsactl ] || exit 0
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MYNAME=/etc/init.d/alsa-utils
ALSACTLHOME=/run/alsa
[ -d "$ALSACTLHOME" ] || mkdir -p "$ALSACTLHOME"
. /lib/lsb/init-functions
. /usr/share/alsa/utils.sh
# $1 EXITSTATUS
# [$2 MESSAGE]
log_action_end_msg_and_exit()
{
log_action_end_msg "$1" ${2:+"$2"}
exit $1
}
# $1 PROGRAM
executable()
{
# If which is not available then we must be running before
# /usr is mounted on a system that has which in /usr/bin/.
# Conclude that $1 is not executable.
[ -x /bin/which ] || [ -x /usr/bin/which ] || return 1
which "$1" >/dev/null 2>&1
}
executable amixer || { echo "${MYNAME}: Error: No amixer program available." >&2 ; exit 1 ; }
# $1 <card ID> | "all"
restore_levels()
{
[ -f /var/lib/alsa/asound.state ] || return 1
CARD="$1"
[ "$1" = all ] && CARD=""
# Assume that if alsactl prints a message on stderr
# then it failed somehow. This works around the fact
# that alsactl doesn't return nonzero status when it
# can't restore settings for the card
if MSG="$(alsactl -E HOME="$ALSACTLHOME" restore $CARD 2>&1 >/dev/null)" && [ ! "$MSG" ] ; then
return 0
else
# Retry with the "force" option. This restores more levels
# but it results in much longer error messages.
alsactl -F restore $CARD >/dev/null 2>&1
log_action_cont_msg "warning: 'alsactl -E HOME="$ALSACTLHOME" restore${CARD:+ $CARD}' failed with error message '$MSG'"
return 1
fi
}
# $1 <card ID> | "all"
store_levels()
{
CARD="$1"
[ "$1" = all ] && CARD=""
if MSG="$(alsactl -E HOME="$ALSACTLHOME" store $CARD 2>&1)" ; then
sleep 1
return 0
else
log_action_cont_msg "warning: 'alsactl store${CARD:+ $CARD}' failed with error message '$MSG'"
return 1
fi
}
# $1 <card ID>
mute_and_zero_levels_on_card()
{
CARDOPT="-c $1"
for CTL in \
Master \
PCM \
Synth \
CD \
Line \
Mic \
"PCM,1" \
Wave \
Music \
AC97 \
"Master Digital" \
DAC \
"DAC,0" \
"DAC,1" \
Headphone \
Speaker \
Playback
do
mute_and_zero_level "$CTL"
done
# for CTL in \
# "Audigy Analog/Digital Output Jack" \
# "SB Live Analog/Digital Output Jack"
# do
# switch_control "$CTL" off
# done
return 0
}
# $1 <card ID> | "all"
mute_and_zero_levels()
{
TTZML_RETURNSTATUS=0
case "$1" in
all)
for CARD in $(echo_card_indices) ; do
mute_and_zero_levels_on_card "$CARD" || TTZML_RETURNSTATUS=1
done
;;
*)
mute_and_zero_levels_on_card "$1" || TTZML_RETURNSTATUS=1
;;
esac
return $TTZML_RETURNSTATUS
}
# $1 <card ID> | "all"
card_OK()
{
[ "$1" ] || bugout
if [ "$1" = all ] ; then
[ -d /proc/asound ]
return $?
else
[ -d "/proc/asound/card$1" ] || [ -d "/proc/asound/$1" ]
return $?
fi
}
# If a card identifier is provided in $2 then regard it as an error
# if that card is not present; otherwise don't regard it as an error.
case "$1" in
start)
EXITSTATUS=0
TARGET_CARD="$2"
case "$TARGET_CARD" in
""|all) TARGET_CARD=all ; log_action_begin_msg "Setting up ALSA" ;;
*) log_action_begin_msg "Setting up ALSA card ${TARGET_CARD}" ;;
esac
card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
preinit_levels "$TARGET_CARD" || EXITSTATUS=1
if ! restore_levels "$TARGET_CARD" ; then
sanify_levels "$TARGET_CARD" || EXITSTATUS=1
restore_levels "$TARGET_CARD" >/dev/null 2>&1 || :
fi
log_action_end_msg_and_exit "$EXITSTATUS"
;;
stop)
EXITSTATUS=0
TARGET_CARD="$2"
case "$TARGET_CARD" in
""|all) TARGET_CARD=all ; log_action_begin_msg "Shutting down ALSA" ;;
*) log_action_begin_msg "Shutting down ALSA card ${TARGET_CARD}" ;;
esac
card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
store_levels "$TARGET_CARD" || EXITSTATUS=1
#mute_and_zero_levels "$TARGET_CARD" || EXITSTATUS=1
log_action_end_msg_and_exit "$EXITSTATUS"
;;
restart|force-reload)
EXITSTATUS=0
$0 stop || EXITSTATUS=1
$0 start || EXITSTATUS=1
exit $EXITSTATUS
;;
reset)
TARGET_CARD="$2"
case "$TARGET_CARD" in
""|all) TARGET_CARD=all ; log_action_begin_msg "Resetting ALSA" ;;
*) log_action_begin_msg "Resetting ALSA card ${TARGET_CARD}" ;;
esac
card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
preinit_levels "$TARGET_CARD"
sanify_levels "$TARGET_CARD"
log_action_end_msg_and_exit "$?"
;;
*)
echo "Usage: $MYNAME {start [CARD]|stop [CARD]|restart [CARD]|reset [CARD]}" >&2
exit 3
;;
esac

View File

@@ -0,0 +1,10 @@
_______ __ __
| ___|.--.--.-----.| |/ |.-----.--.--.
| ___|| | | || < | -__| | |
|___| |_____|__|__||__|\\__||_____|___ |
FUN ON A KEYCHAIN |_____|
-----------------------------------------------------
Version 0.1
-----------------------------------------------------

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,34 @@
#!/bin/sh
#set -xv
if [ x"$THIS" != x ]; then
THIS="${THIS}: "
fi
log_action_msg () {
echo "${THIS}${@}." | tee /dev/kmsg
}
log_action_begin_msg () {
echo "${THIS}${@}..." | tee /dev/kmsg
}
log_action_cont_msg () {
echo "${THIS}${@}..." | tee /dev/kmsg
}
log_action_end_msg () {
local end
if [ -z "${2:-}" ]; then
end="."
else
end=" ($2)."
fi
if [ $1 -eq 0 ]; then
echo "${THIS}done${end}" | tee /dev/kmsg
else
echo "${THIS}failed${end}" | tee /dev/kmsg
fi
}

View File

@@ -0,0 +1,80 @@
#!/bin/sh
#set -x
THIS=$(basename $0)
echo "$THIS: resizing rootfs" | tee /dev/kmsg
if [ $(id -u) -ne 0 ]; then
echo "$THIS: this script must be run as root. Try 'sudo resize_rootfs'\n" | tee /dev/kmsg
exit 1
fi
ROOT_PART=$(cat /proc/cmdline | sed -n 's|^.*root=/dev/\([^ ]*\).*|\1|p')
PART_NUM=${ROOT_PART#mmcblk0p}
if [ "$PART_NUM" = "$ROOT_PART" ]; then
echo "$THIS: $ROOT_PART is not an SD card. Don't know how to expand" | tee /dev/kmsg
exit 2
fi
if [ "$PART_NUM" -ne 2 ]; then
echo "$THIS: your partition layout is not currently supported by this tool" | tee /dev/kmsg
exit 3
fi
LAST_PART_LINE=$(fdisk /dev/mmcblk0 -l | grep '^/' | tail -n 1)
set $LAST_PART_LINE
LAST_PART=${1#/dev/}
PART_START=${2}
if [ "$LAST_PART" != "$ROOT_PART" ]; then
echo "$THIS: $ROOT_PART is not the last partition. Don't know how to expand" | tee /dev/kmsg
exit 4
fi
# Return value will likely be error for fdisk as it fails to reload the
# partition table because the root fs is mounted
# NOTE: This script only works the genuine fdisk, NOT with the busybox one!!!
fdisk /dev/mmcblk0 <<EOF
p
d
$PART_NUM
n
p
$PART_NUM
$PART_START
n
p
w
EOF
sync
# Now set up an init.d script
cat <<EOF > /etc/init.d/S02resize2fs &&
#!/bin/sh
THIS=\$(basename \$0)
case "\$1" in
start)
sleep 1
echo "\$THIS: starting resizing the root filesystem" | tee /dev/kmsg &&
resize2fs /dev/$ROOT_PART &&
rm /etc/init.d/S02resize2fs
if [ \$? -eq 0 ]; then
echo "\$THIS: finished resizing the root filesystem" | tee /dev/kmsg
else
echo "\$THIS: cannot resize the root filesystem, aborting" | tee /dev/kmsg
fi
;;
*)
echo "Usage: \$0 start" >&2
exit 3
;;
esac
EOF
chmod +x /etc/init.d/S02resize2fs
echo "$THIS: the root partition has been resized" | tee /dev/kmsg
echo "$THIS: the system must reboot to enlarge the root filesystem" | tee /dev/kmsg

View File

@@ -0,0 +1,115 @@
#!/bin/sh
#set -x
THIS=$(basename $0)
case "${1}" in
start)
if [ ! -f /mass_storage ]; then
echo "$THIS: no shared storage file, create it" | tee /dev/kmsg
dd if=/dev/zero of=/mass_storage bs=1M seek=1024 count=0 &&
cat <<EOF | sfdisk /mass_storage
,,C
EOF
if [ $? -ne 0 ]; then
echo "$THIS: cannot create shared storage file" | tee /dev/kmsg
exit 1
fi
UNIT_LINE=$(fdisk -l /mass_storage | egrep Units)
set $UNIT_LINE
UNIT=${8}
PART_LINE=$(fdisk -l /mass_storage | egrep /mass_storage1)
set $PART_LINE
let START="${2} * $UNIT"
if [ x"$START" = x -o $START -eq 0 ]; then
echo "$THIS: cannot find shared storage file start" | tee /dev/kmsg
exit 2
fi
losetup -o$START /dev/loop0 /mass_storage &&
mkdosfs /dev/loop0 &&
losetup -d /dev/loop0
if [ $? -ne 0 ]; then
echo "$THIS: cannot format shared storage file" | tee /dev/kmsg
exit 3
fi
fi
lsmod | egrep -q ^g_mass_storage
if [ $? -eq 0 ]; then
echo "$THIS; shared storage already started" | tee /dev/kmsg
exit 4
fi
echo "$THIS: start shared storage" | tee /dev/kmsg
modprobe g_mass_storage file=/mass_storage
if [ $? -ne 0 ]; then
echo "$THIS: cannot start shared storage" | tee /dev/kmsg
exit 5
fi
echo "$THIS: shared storage started" | tee /dev/kmsg
;;
stop)
echo "$THIS: stop shared storage" | tee /dev/kmsg
lsmod | egrep -q ^g_mass_storage
if [ $? -eq 0 ]; then
modprobe -r g_mass_storage
if [ $? -ne 0 ]; then
echo "$THIS: cannot stop shared storage" | tee /dev/kmsg
exit 6
fi
else
echo "$THIS: shared storage not started" | tee /dev/kmsg
exit 7
fi
echo "$THIS: shared storage stopped" | tee /dev/kmsg
;;
mount)
if [ ! -f /mass_storage ]; then
echo "$THIS: no shared storage file" | tee /dev/kmsg
exit 8
fi
echo "$THIS: mounting shared storage" | tee /dev/kmsg
UNIT_LINE=$(fdisk -l /mass_storage | egrep Units)
set $UNIT_LINE
UNIT=${8}
PART_LINE=$(fdisk -l /mass_storage | egrep /mass_storage1)
set $PART_LINE
let START="${2} * $UNIT"
if [ x"$START" = x -o $START -eq 0 ]; then
echo "$THIS: cannot find shared storage file start" | tee /dev/kmsg
exit 9
fi
losetup -o$START /dev/loop0 /mass_storage &&
mount -t vfat /dev/loop0 /mnt/
if [ $? -ne 0 ]; then
echo "$THIS: cannot mount shared storage file" | tee /dev/kmsg
exit 10
fi
echo "$THIS: shared storage mounted" | tee /dev/kmsg
;;
umount)
losetup -a | egrep -q /mass_storage
if [ $? -ne 0 ]; then
echo "$THIS: no mounted shared storage file" | tee /dev/kmsg
exit 11
fi
echo "unmounting shared storage"
umount /mnt &
losetup -d /dev/loop0
if [ $? -ne 0 ]; then
echo "$THIS: cannot unmount shared storage" | tee /dev/kmsg
exit 12
fi
echo "$THIS: shared storage unmounted" | tee //dev/kmsg
;;
*)
echo "Usage ${0} {start|stop|mount|umount}"
exit 13
;;
esac

View File

@@ -0,0 +1,182 @@
# Shell snippet.
bugout() { echo "${MYNAME}: Programming error" >&2 ; exit 123 ; }
echo_card_indices()
{
if [ -f /proc/asound/cards ] ; then
sed -n -e's/^[[:space:]]*\([0-7]\)[[:space:]].*/\1/p' /proc/asound/cards
fi
}
filter_amixer_output()
{
sed \
-e '/Unable to find simple control/d' \
-e '/Unknown playback setup/d' \
-e '/^$/d'
}
# The following functions try to set many controls.
# No card has all the controls and so some of the attempts are bound to fail.
# Because of this, the functions can't return useful status values.
# $1 <control>
# $2 <level>
# $CARDOPT
unmute_and_set_level()
{
{ [ "$2" ] && [ "$CARDOPT" ] ; } || bugout
amixer $CARDOPT -q set "$1" "$2" unmute 2>&1 | filter_amixer_output || :
return 0
}
# $1 <control>
# $CARDOPT
mute_and_zero_level()
{
{ [ "$1" ] && [ "$CARDOPT" ] ; } || bugout
amixer $CARDOPT -q set "$1" "0%" mute 2>&1 | filter_amixer_output || :
return 0
}
# $1 <control>
# $2 "on" | "off"
# $CARDOPT
switch_control()
{
{ [ "$2" ] && [ "$CARDOPT" ] ; } || bugout
amixer $CARDOPT -q set "$1" "$2" 2>&1 | filter_amixer_output || :
return 0
}
# $1 <card ID>
sanify_levels_on_card()
{
CARDOPT="-c $1"
unmute_and_set_level "Master" "80%"
unmute_and_set_level "Master Mono" "80%" # See Bug#406047
unmute_and_set_level "Master Digital" "80%" # E.g., cs4237B
unmute_and_set_level "Playback" "80%"
unmute_and_set_level "Headphone" "70%"
unmute_and_set_level "PCM" "80%"
unmute_and_set_level "PCM,1" "80%" # E.g., ess1969
unmute_and_set_level "DAC" "80%" # E.g., envy24, cs46xx
unmute_and_set_level "DAC,0" "80%" # E.g., envy24
unmute_and_set_level "DAC,1" "80%" # E.g., envy24
unmute_and_set_level "Synth" "80%"
unmute_and_set_level "CD" "80%"
mute_and_zero_level "Mic"
mute_and_zero_level "IEC958" # Ubuntu #19648
# Intel P4P800-MX (Ubuntu bug #5813)
switch_control "Master Playback Switch" on
switch_control "Master Surround" on
# Trident/YMFPCI/emu10k1:
unmute_and_set_level "Wave" "80%"
unmute_and_set_level "Music" "80%"
unmute_and_set_level "AC97" "80%"
# DRC:
unmute_and_set_level "Dynamic Range Compression" "80%"
# Required for HDA Intel (hda-intel):
unmute_and_set_level "Front" "80%"
unmute_and_set_level "Master Front" "80%"
# Required for SB Live 7.1/24-bit (ca0106):
unmute_and_set_level "Analog Front" "80%"
# Required at least for Via 823x hardware on DFI K8M800-MLVF Motherboard with kernels 2.6.10-3/4 (see ubuntu #7286):
switch_control "IEC958 Capture Monitor" off
# Required for hardware allowing toggles for AC97 through IEC958,
# valid values are 0, 1, 2, 3. Needs to be set to 0 for PCM1.
unmute_and_set_level "IEC958 Playback AC97-SPSA" "0"
# Required for newer Via hardware (see Ubuntu #31784)
unmute_and_set_level "VIA DXS,0" "80%"
unmute_and_set_level "VIA DXS,1" "80%"
unmute_and_set_level "VIA DXS,2" "80%"
unmute_and_set_level "VIA DXS,3" "80%"
# Required on some notebooks with ICH4:
switch_control "Headphone Jack Sense" off
switch_control "Line Jack Sense" off
# Some machines need one or more of these to be on;
# others need one or more of these to be off:
#
# switch_control "External Amplifier" on
# switch_control "Audigy Analog/Digital Output Jack" on
# switch_control "SB Live Analog/Digital Output Jack" on
# D1984 -- Thinkpad T61/X61
switch_control "Speaker" on
switch_control "Headphone" on
# HDA-Intel w/ "Digital" capture mixer (See Ubuntu #193823)
unmute_and_set_level "Digital" "80%"
# On MacBookPro5,3 and later models (See Bug#597791)
unmute_and_set_level "Front Speaker" "80%"
# On MacBook5,2 models (See Bug#602973)
unmute_and_set_level "LFE" "80%"
# On Intel 82801H (See Bug#603550)
unmute_and_set_level "Speaker" "80%"
return 0
}
# $1 <card ID> | "all"
sanify_levels()
{
TTSDML_RETURNSTATUS=0
case "$1" in
all)
for CARD in $(echo_card_indices) ; do
sanify_levels_on_card "$CARD" || TTSDML_RETURNSTATUS=1
done
;;
*)
sanify_levels_on_card "$1" || TTSDML_RETURNSTATUS=1
;;
esac
return $TTSDML_RETURNSTATUS
}
# $1 <card ID>
preinit_levels_on_card()
{
CARDOPT="-c $1"
# Silly dance to activate internal speakers by default on PowerMac
# Snapper and Tumbler
id=$(cat /proc/asound/card$1/id 2>/dev/null)
if [ "$id" = "Snapper" -o "$id" = "Tumbler" ]; then
switch_control "Auto Mute" off
switch_control "PC Speaker" off
switch_control "Auto Mute" on
fi
}
# $1 <card ID> | "all"
preinit_levels()
{
TTSDML_RETURNSTATUS=0
case "$1" in
all)
for CARD in $(echo_card_indices) ; do
preinit_levels_on_card "$CARD" || TTSDML_RETURNSTATUS=1
done
;;
*)
preinit_levels_on_card "$1" || TTSDML_RETURNSTATUS=1
;;
esac
return $TTSDML_RETURNSTATUS
}

View File

@@ -0,0 +1,16 @@
CONFIG_ARM=y
CONFIG_ARCH_SUNXI=y
# CONFIG_ARMV7_NONSEC is not set
CONFIG_IDENT_STRING=" FunKey"
CONFIG_MACH_SUN8I_V3S=y
CONFIG_DRAM_CLK=360
CONFIG_DRAM_ZQ=14779
CONFIG_DEFAULT_DEVICE_TREE="sun8i-v3s-funkey"
CONFIG_BOOTDELAY=0
# CONFIG_CONSOLE_MUX is not set
CONFIG_SPL=y
# CONFIG_CMD_IMLS is not set
# CONFIG_CMD_FLASH is not set
# CONFIG_CMD_FPGA is not set
# CONFIG_NETDEVICES is not set
CONFIG_OF_LIBFDT_OVERLAY=y

View File

View File

@@ -0,0 +1,92 @@
BR2_arm=y
BR2_cortex_a7=y
BR2_DL_DIR="$(BR2_EXTERNAL_FUNKEY_PATH)/dl"
BR2_CCACHE=y
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/patches"
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_GENERIC_HOSTNAME="FunKey"
BR2_TARGET_GENERIC_ISSUE="Welcome to Buildroot for the FunKey"
BR2_ROOTFS_DEVICE_TABLE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/device_table.txt"
BR2_TARGET_GENERIC_ROOT_PASSWD="funkey"
BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
BR2_ROOTFS_USERS_TABLES="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/users_table.txt"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/rootfs-overlay"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/Lichee-Pi/linux"
BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="cda44c146b9b87290bc7c636ffa7d88cbfb03ace"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/linux.config"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-v3s-funkey"
BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/busybox.config"
BR2_PACKAGE_ALSA_UTILS=y
BR2_PACKAGE_ALSA_UTILS_ALSACONF=y
BR2_PACKAGE_ALSA_UTILS_ACONNECT=y
BR2_PACKAGE_ALSA_UTILS_ALSALOOP=y
BR2_PACKAGE_ALSA_UTILS_ALSAUCM=y
BR2_PACKAGE_ALSA_UTILS_ALSATPLG=y
BR2_PACKAGE_ALSA_UTILS_AMIDI=y
BR2_PACKAGE_ALSA_UTILS_AMIXER=y
BR2_PACKAGE_ALSA_UTILS_APLAY=y
BR2_PACKAGE_ALSA_UTILS_APLAYMIDI=y
BR2_PACKAGE_ALSA_UTILS_ARECORDMIDI=y
BR2_PACKAGE_ALSA_UTILS_ASEQDUMP=y
BR2_PACKAGE_ALSA_UTILS_ASEQNET=y
BR2_PACKAGE_ALSA_UTILS_BAT=y
BR2_PACKAGE_ALSA_UTILS_IECSET=y
BR2_PACKAGE_ALSA_UTILS_SPEAKER_TEST=y
BR2_PACKAGE_AUMIX=y
BR2_PACKAGE_E2FSPROGS=y
# BR2_PACKAGE_E2FSPROGS_FSCK is not set
BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y
BR2_PACKAGE_SDL=y
BR2_PACKAGE_SDL_GFX=y
BR2_PACKAGE_SDL_IMAGE=y
BR2_PACKAGE_SDL_MIXER=y
BR2_PACKAGE_SDL_SOUND=y
BR2_PACKAGE_SDL_SOUND_PLAYSOUND=y
BR2_PACKAGE_SDL_TTF=y
BR2_PACKAGE_XORG7=y
BR2_PACKAGE_XSERVER_XORG_SERVER=y
BR2_PACKAGE_XSERVER_XORG_SERVER_XVFB=y
BR2_PACKAGE_XAPP_TWM=y
BR2_PACKAGE_XAPP_XCLOCK=y
BR2_PACKAGE_XAPP_XINIT=y
BR2_PACKAGE_XAPP_XINPUT=y
BR2_PACKAGE_XAPP_XKILL=y
BR2_PACKAGE_XAPP_XPROP=y
BR2_PACKAGE_XAPP_XSET=y
BR2_PACKAGE_XAPP_XSETROOT=y
BR2_PACKAGE_XDRIVER_XF86_VIDEO_FBDEV=y
BR2_PACKAGE_XTERM=y
BR2_PACKAGE_DHCPCD=y
BR2_PACKAGE_DROPBEAR=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN=y
BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
BR2_PACKAGE_UTIL_LINUX_BINARIES=y
BR2_PACKAGE_NANO=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_GIT=y
BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/Lichee-Pi/u-boot"
BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="32ab1804cd7c5858be8009e35ca07502dc8765c7"
BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG=y
BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/uboot.config"
BR2_TARGET_UBOOT_NEEDS_DTC=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin"
BR2_TARGET_UBOOT_BOOT_SCRIPT=y
BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/boot.cmd"
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y
BR2_PACKAGE_MEDNAFEN=y

2
FunKey/external.desc Normal file
View File

@@ -0,0 +1,2 @@
name: FUNKEY
desc: FunKey packages

1
FunKey/external.mk Normal file
View File

@@ -0,0 +1 @@
include $(sort $(wildcard $(BR2_EXTERNAL_FUNKEY_PATH)/package/*/*.mk))

View File

@@ -0,0 +1,482 @@
Disable OpenGL support.
Signed-off-by: "Michel Stempin" <michel.stempin@wanadoo.fr>
---
po/POTFILES.in | 2
src/drivers/Makefile.in | 12 +---
src/drivers/main.cpp | 2
src/drivers/video.cpp | 208 ++++-------------------------------------------------------------------
4 files changed, 17 insertions(+), 207 deletions(-)
diff -Naur a/po/POTFILES.in b/po/POTFILES.in
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -59,8 +59,6 @@
src/drivers/help.cpp
src/drivers/debugger.cpp
src/drivers/video-state.cpp
-src/drivers/opengl.cpp
-src/drivers/shader.cpp
src/drivers/hq2x.cpp
src/drivers/netplay.cpp
src/drivers/scalebit.c
diff -Naur a/src/drivers/Makefile.in b/src/drivers/Makefile.in
--- a/src/drivers/Makefile.in
+++ b/src/drivers/Makefile.in
@@ -124,7 +124,7 @@
am__libmdfnsdl_a_SOURCES_DIST = main.cpp input.cpp args.cpp help.cpp \
ers.cpp sound.cpp netplay.cpp input-config.cpp console.cpp \
cheat.cpp fps.cpp video-state.cpp remote.cpp rmdui.cpp \
- opengl.cpp shader.cpp overlay.cpp video.cpp nongl.cpp nnx.cpp \
+ overlay.cpp video.cpp nongl.cpp nnx.cpp \
thread_win32.cpp thread_sdl.cpp hqxx-common.cpp hq2x.cpp \
hq3x.cpp hq4x.cpp scale2x.c scale3x.c scalebit.c 2xSaI.cpp \
Joystick.cpp Joystick_SDL.cpp Joystick_Linux.cpp \
@@ -148,8 +148,8 @@
args.$(OBJEXT) help.$(OBJEXT) ers.$(OBJEXT) sound.$(OBJEXT) \
netplay.$(OBJEXT) input-config.$(OBJEXT) console.$(OBJEXT) \
cheat.$(OBJEXT) fps.$(OBJEXT) video-state.$(OBJEXT) \
- remote.$(OBJEXT) rmdui.$(OBJEXT) opengl.$(OBJEXT) \
- shader.$(OBJEXT) overlay.$(OBJEXT) video.$(OBJEXT) \
+ remote.$(OBJEXT) rmdui.$(OBJEXT) \
+ overlay.$(OBJEXT) video.$(OBJEXT) \
nongl.$(OBJEXT) nnx.$(OBJEXT) $(am__objects_1) \
$(am__objects_2) $(am__objects_3) Joystick.$(OBJEXT) \
Joystick_SDL.$(OBJEXT) $(am__objects_4) $(am__objects_5) \
@@ -405,8 +405,8 @@
noinst_LIBRARIES = libmdfnsdl.a
libmdfnsdl_a_SOURCES = main.cpp input.cpp args.cpp help.cpp ers.cpp \
sound.cpp netplay.cpp input-config.cpp console.cpp cheat.cpp \
- fps.cpp video-state.cpp remote.cpp rmdui.cpp opengl.cpp \
- shader.cpp overlay.cpp video.cpp nongl.cpp nnx.cpp \
+ fps.cpp video-state.cpp remote.cpp rmdui.cpp \
+ overlay.cpp video.cpp nongl.cpp nnx.cpp \
$(am__append_1) $(am__append_2) $(am__append_3) Joystick.cpp \
Joystick_SDL.cpp $(am__append_4) $(am__append_5) \
$(am__append_6)
@@ -485,7 +485,6 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netplay.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nnx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nongl.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opengl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/overlay.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prompt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote.Po@am__quote@
@@ -493,7 +492,6 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scale2x.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scale3x.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scalebit.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shader.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread_sdl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread_win32.Po@am__quote@
diff -Naur a/src/drivers/main.cpp b/src/drivers/main.cpp
--- a/src/drivers/main.cpp
+++ b/src/drivers/main.cpp
@@ -42,8 +42,6 @@
#include "input.h"
#include "Joystick.h"
#include "video.h"
-#include "opengl.h"
-#include "shader.h"
#include "sound.h"
#include "netplay.h"
#include "cheat.h"
diff -Naur a/src/drivers/video.cpp b/src/drivers/video.cpp
--- a/src/drivers/video.cpp
+++ b/src/drivers/video.cpp
@@ -25,8 +25,6 @@
#include <trio/trio.h>
#include "video.h"
-#include "opengl.h"
-#include "shader.h"
#include "nongl.h"
#include "overlay.h"
@@ -147,7 +145,7 @@
static const MDFNSetting GlobalVideoSettings[] =
{
- { "video.driver", MDFNSF_NOFLAGS, gettext_noop("Video output method/driver."), NULL, MDFNST_ENUM, "opengl", NULL, NULL, NULL, NULL, VDriver_List },
+ { "video.driver", MDFNSF_NOFLAGS, gettext_noop("Video output method/driver."), NULL, MDFNST_ENUM, "sdl", NULL, NULL, NULL, NULL, VDriver_List },
{ "video.fs", MDFNSF_NOFLAGS, gettext_noop("Enable fullscreen mode."), NULL, MDFNST_BOOL, "0", },
{ "video.glvsync", MDFNSF_NOFLAGS, gettext_noop("Attempt to synchronize OpenGL page flips to vertical retrace period."),
@@ -216,37 +214,6 @@
{ NULL, 0 },
};
-static const MDFNSetting_EnumList Shader_List[] =
-{
- { "none", SHADER_NONE, gettext_noop("None/Disabled") },
- { "autoip", SHADER_AUTOIP, gettext_noop("Auto Interpolation"), gettext_noop("Will automatically interpolate on each axis if the corresponding effective scaling factor is not an integer.") },
- { "autoipsharper", SHADER_AUTOIPSHARPER, gettext_noop("Sharper Auto Interpolation"), gettext_noop("Same as \"autoip\", but when interpolation is done, it is done in a manner that will reduce blurriness if possible.") },
- { "scale2x", SHADER_SCALE2X, "Scale2x" },
- { "sabr", SHADER_SABR, "SABR v3.0", gettext_noop("GPU-intensive.") },
- { "ipsharper", SHADER_IPSHARPER, gettext_noop("Sharper bilinear interpolation.") },
- { "ipxnoty", SHADER_IPXNOTY, gettext_noop("Linear interpolation on X axis only.") },
- { "ipynotx", SHADER_IPYNOTX, gettext_noop("Linear interpolation on Y axis only.") },
- { "ipxnotysharper", SHADER_IPXNOTYSHARPER, gettext_noop("Sharper version of \"ipxnoty\".") },
- { "ipynotxsharper", SHADER_IPYNOTXSHARPER, gettext_noop("Sharper version of \"ipynotx\".") },
-
- { "goat", SHADER_GOAT, gettext_noop("Simple approximation of a color TV CRT look."), gettext_noop("Intended for fullscreen modes with a vertical resolution of around 1000 to 1500 pixels. Doesn't simulate halation and electron beam energy distribution nuances.") },
-
- { NULL, 0 },
-};
-
-static const MDFNSetting_EnumList GoatPat_List[] =
-{
- { "goatron", ShaderParams::GOAT_MASKPAT_GOATRON, gettext_noop("Goatron"), gettext_noop("Brightest.") },
- { "goattron", ShaderParams::GOAT_MASKPAT_GOATRON },
- { "goatronprime", ShaderParams::GOAT_MASKPAT_GOATRONPRIME },
- { "goattronprime", ShaderParams::GOAT_MASKPAT_GOATRONPRIME },
-
- { "borg", ShaderParams::GOAT_MASKPAT_BORG, gettext_noop("Borg"), gettext_noop("Darkest.") },
- { "slenderman", ShaderParams::GOAT_MASKPAT_SLENDERMAN, gettext_noop("Slenderman"), gettext_noop("Spookiest?") },
-
- { NULL, 0 },
-};
-
void Video_MakeSettings(std::vector <MDFNSetting> &settings)
{
static const char *CSD_xres = gettext_noop("Full-screen horizontal resolution.");
@@ -270,9 +237,6 @@
static const char *CSD_special = gettext_noop("Enable specified special video scaler.");
static const char *CSDE_special = gettext_noop("The destination rectangle is NOT altered by this setting, so if you have xscale and yscale set to \"2\", and try to use a 3x scaling filter like hq3x, the image is not going to look that great. The nearest-neighbor scalers are intended for use with bilinear interpolation enabled, at high resolutions(such as 1280x1024; nn2x(or nny2x) + bilinear interpolation + fullscreen stretching at this resolution looks quite nice).");
- static const char *CSD_shader = gettext_noop("Enable specified OpenGL shader.");
- static const char *CSDE_shader = gettext_noop("Obviously, this will only work with the OpenGL \"video.driver\" setting, and only on cards and OpenGL implementations that support shaders, otherwise you will get a black screen, or Mednafen may display an error message when starting up. When a shader is enabled, the \"<system>.videoip\" setting is ignored.");
-
for(unsigned int i = 0; i < MDFNSystems.size() + 1; i++)
{
int nominal_width;
@@ -339,27 +303,6 @@
BuildSystemSetting(&setting, sysname, "special", CSD_special, CSDE_special, MDFNST_ENUM, "none", NULL, NULL, NULL, NULL, Special_List);
settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader", CSD_shader, CSDE_shader, MDFNST_ENUM, "none", NULL, NULL, NULL, NULL, Shader_List);
- settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader.goat.hdiv", gettext_noop("Constant RGB horizontal divergence."), nullptr, MDFNST_FLOAT, "0.50", "-2.00", "2.00");
- settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader.goat.vdiv", gettext_noop("Constant RGB vertical divergence."), nullptr, MDFNST_FLOAT, "0.50", "-2.00", "2.00");
- settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader.goat.pat", gettext_noop("Mask pattern."), nullptr, MDFNST_ENUM, "goatron", NULL, NULL, NULL, NULL, GoatPat_List);
- settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader.goat.tp", gettext_noop("Transparency of otherwise-opaque mask areas."), nullptr, MDFNST_FLOAT, "0.50", "0.00", "1.00");
- settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader.goat.fprog", gettext_noop("Force interlaced video to be treated as progressive."), gettext_noop("When disabled, the default, the \"video.deinterlacer\" setting is effectively ignored with respect to what appears on the screen. When enabled, it may be prudent to disable the scanlines effect controlled by the *.goat.slen setting, or else the scanline effect may look objectionable."), MDFNST_BOOL, "0");
- settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader.goat.slen", gettext_noop("Enable scanlines effect."), nullptr, MDFNST_BOOL, "1");
- settings.push_back(setting);
}
for(unsigned i = 0; i < sizeof(GlobalVideoSettings) / sizeof(GlobalVideoSettings[0]); i++)
@@ -377,15 +320,13 @@
int stretch;
int special;
int scanlines;
- ShaderType shader;
- ShaderParams shader_params;
} CommonVS;
static CommonVS _video;
static int _fullscreen;
static bool osd_alpha_blend;
-static unsigned int vdriver = VDRIVER_OPENGL;
+static unsigned int vdriver = VDRIVER_SOFTSDL;
static struct ScalerDefinition
{
@@ -417,8 +358,6 @@
static MDFNGI *VideoGI;
-static bool sdlhaveogl = false;
-
static int best_xres = 0, best_yres = 0;
static int cur_xres, cur_yres, cur_flags;
@@ -426,7 +365,6 @@
static ScalerDefinition *CurrentScaler = NULL;
static SDL_Surface *screen = NULL;
-static OpenGL_Blitter *ogl_blitter = NULL;
static SDL_Surface *IconSurface=NULL;
static MDFN_Rect screen_dest_rect;
@@ -456,12 +394,6 @@
static void ClearBackBuffer(void)
{
//printf("WOO: %u\n", Time::MonoMS());
- if(ogl_blitter)
- {
- ogl_blitter->ClearBackBuffer();
- }
- else
- {
// Don't use SDL_FillRect() on hardware surfaces, it's borked(causes a long wait) with DirectX.
// ...on second thought, memset() is likely borked on PPC with hardware surface memory due to use of "dcbz" on uncachable memory. :(
//
@@ -480,7 +412,6 @@
{
SDL_FillRect(screen, NULL, 0);
}
- }
}
void Video_Kill(void)
@@ -505,12 +436,6 @@
HelpSurface = NULL;
}
- if(ogl_blitter)
- {
- delete ogl_blitter;
- ogl_blitter = NULL;
- }
-
if(vdriver == VDRIVER_OVERLAY)
OV_Kill();
@@ -778,7 +703,6 @@
const std::string special_string = MDFN_GetSettingS(snp + std::string("special"));
const unsigned special_id = MDFN_GetSettingUI(snp + std::string("special"));
- const std::string goat_pat_string = MDFN_GetSettingS(snp + "shader.goat.pat");
_fullscreen = MDFN_GetSettingB("video.fs");
_video.xres = MDFN_GetSettingUI(snp + "xres");
@@ -793,14 +717,6 @@
_video.special = special_id;
- _video.shader = (ShaderType)MDFN_GetSettingI(snp + "shader");
- _video.shader_params.goat_hdiv = MDFN_GetSettingF(snp + "shader.goat.hdiv");
- _video.shader_params.goat_vdiv = MDFN_GetSettingF(snp + "shader.goat.vdiv");
- _video.shader_params.goat_pat = MDFN_GetSettingI(snp + "shader.goat.pat");
- _video.shader_params.goat_tp = MDFN_GetSettingF(snp + "shader.goat.tp");
- _video.shader_params.goat_slen = MDFN_GetSettingB(snp + "shader.goat.slen");
- _video.shader_params.goat_fprog = MDFN_GetSettingB(snp + "shader.goat.fprog");
-
CurrentScaler = nullptr;
for(auto& scaler : Scalers)
if(_video.special == scaler.id)
@@ -830,42 +746,7 @@
vdriver = MDFN_GetSettingI("video.driver");
- if(vdriver == VDRIVER_OPENGL)
- {
- if(!sdlhaveogl)
- {
- // SDL_GL_LoadLibrary returns 0 on success, -1 on failure
- if(SDL_GL_LoadLibrary(NULL) == 0)
- sdlhaveogl = true;
- else
- sdlhaveogl = false;
- }
-
- if(!sdlhaveogl)
- {
- MDFN_PrintError(_("Could not load OpenGL library, disabling OpenGL usage!"));
- vdriver = VDRIVER_SOFTSDL;
- }
- }
-
- if(vdriver == VDRIVER_OPENGL)
- {
- flags |= SDL_OPENGL;
-
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1 );
-
- #if SDL_VERSION_ATLEAST(1, 2, 10)
- SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, MDFN_GetSettingB("video.glvsync"));
- #endif
- }
- else if(vdriver == VDRIVER_SOFTSDL)
- {
-
- }
- else if(vdriver == VDRIVER_OVERLAY)
- {
-
- }
+ vdriver = VDRIVER_SOFTSDL;
exs = _fullscreen ? _video.xscalefs : _video.xscale;
eys = _fullscreen ? _video.yscalefs : _video.yscale;
@@ -935,18 +816,6 @@
//MDFN_printf(_("OpenGL: %s\n"), (cur_flags & SDL_OPENGL) ? _("Yes") : _("No"));
- if(cur_flags & SDL_OPENGL)
- {
- MDFN_AutoIndent aindps;
- char sp[128] = { 0 };
-
- if(_video.shader == SHADER_GOAT)
- trio_snprintf(sp, sizeof(sp), " (pat=%s, hdiv=%f, vdiv=%f, tp=%f, slen=%d, fprog=%d)",
- goat_pat_string.c_str(), _video.shader_params.goat_hdiv, _video.shader_params.goat_vdiv, _video.shader_params.goat_tp, _video.shader_params.goat_slen, _video.shader_params.goat_fprog);
-
- MDFN_printf(_("Shader: %s%s\n"), MDFN_GetSettingS(snp + "shader").c_str(), sp);
- }
-
MDFN_printf(_("Fullscreen: %s\n"), _fullscreen ? _("Yes") : _("No"));
MDFN_printf(_("Special Scaler: %s\n"), (special_id == NTVB_NONE) ? _("None") : special_string.c_str());
@@ -973,28 +842,13 @@
int rs, gs, bs, as;
- if(cur_flags & SDL_OPENGL)
- {
- try
- {
- ogl_blitter = new OpenGL_Blitter(_video.scanlines, _video.shader, _video.shader_params, screen->w, screen->h, &rs, &gs, &bs, &as);
- }
- catch(std::exception &e)
- {
- Video_Kill();
- throw;
- }
- }
- else
- {
- rs = screen->format->Rshift;
- gs = screen->format->Gshift;
- bs = screen->format->Bshift;
+ rs = screen->format->Rshift;
+ gs = screen->format->Gshift;
+ bs = screen->format->Bshift;
- as = 0;
- while(as == rs || as == gs || as == bs) // Find unused 8-bits to use as our alpha channel
+ as = 0;
+ while(as == rs || as == gs || as == bs) // Find unused 8-bits to use as our alpha channel
as += 8;
- }
//printf("%d %d %d %d\n", rs, gs, bs, as);
@@ -1075,13 +929,7 @@
{
ClearBackBuffer();
- if(cur_flags & SDL_OPENGL)
- {
- SDL_GL_SwapBuffers();
- //ogl_blitter->HardSync();
- }
- else
- SDL_Flip(screen);
+ SDL_Flip(screen);
}
MarkNeedBBClear();
@@ -1108,15 +956,10 @@
void BlitRaw(MDFN_Surface *src, const MDFN_Rect *src_rect, const MDFN_Rect *dest_rect, int source_alpha)
{
- if(ogl_blitter)
- ogl_blitter->BlitRaw(src, src_rect, dest_rect, (source_alpha != 0) && osd_alpha_blend);
- else
- {
SDL_to_MDFN_Surface_Wrapper m_surface(screen);
//MDFN_SrcAlphaBlitSurface(src, src_rect, &m_surface, dest_rect);
MDFN_StretchBlitSurface(src, *src_rect, &m_surface, *dest_rect, (source_alpha > 0) && osd_alpha_blend);
- }
bool cond1 = (dest_rect->x < screen_dest_rect.x || (dest_rect->x + dest_rect->w) > (screen_dest_rect.x + screen_dest_rect.w));
bool cond2 = (dest_rect->y < screen_dest_rect.y || (dest_rect->y + dest_rect->h) > (screen_dest_rect.y + screen_dest_rect.h));
@@ -1287,10 +1130,6 @@
}
#endif
- if(ogl_blitter)
- ogl_blitter->Blit(&bah_surface, &boohoo_rect, &dest_rect, &eff_src_rect, InterlaceField, evideoip, CurGame->rotated);
- else
- {
if(OverlayOK)
{
SDL_Rect tr;
@@ -1308,14 +1147,9 @@
MDFN_StretchBlitSurface(&bah_surface, boohoo_rect, &m_surface, dest_rect, false, _video.scanlines, &eff_src_rect, CurGame->rotated, InterlaceField);
}
- }
}
else // No special scaler:
{
- if(ogl_blitter)
- ogl_blitter->Blit(eff_source_surface, &eff_src_rect, &dest_rect, &eff_src_rect, InterlaceField, evideoip, CurGame->rotated);
- else
- {
if(OverlayOK)
{
SDL_Rect tr;
@@ -1333,7 +1167,6 @@
MDFN_StretchBlitSurface(eff_source_surface, eff_src_rect, &m_surface, dest_rect, false, _video.scanlines, &eff_src_rect, CurGame->rotated, InterlaceField);
}
- }
}
}
@@ -1512,10 +1345,6 @@
ib.reset(new MDFN_Surface(NULL, sr.w, sr.h, sr.w, MDFN_PixelFormat(MDFN_COLORSPACE_RGB, real_rs, real_gs, real_bs, real_as)));
- if(ogl_blitter)
- ogl_blitter->ReadPixels(ib.get(), &sr);
- else
- {
if(SDL_MUSTLOCK(screen))
SDL_LockSurface(screen);
@@ -1529,7 +1358,6 @@
if(SDL_MUSTLOCK(screen))
SDL_UnlockSurface(screen);
- }
tr.x = tr.y = 0;
@@ -1629,25 +1457,13 @@
// but that gets awfully complicated and prone to bugs when dealing with double/triple-buffered video...).
//
// std::max so we don't position it offscreen if the user has selected xscalefs or yscalefs values that are too large.
- if(!(cur_flags & SDL_OPENGL))
- {
- fps_offsx = std::max<int32>(screen_dest_rect.x, 0);
- fps_offsy = std::max<int32>(screen_dest_rect.y, 0);
- }
+ fps_offsx = std::max<int32>(screen_dest_rect.x, 0);
+ fps_offsy = std::max<int32>(screen_dest_rect.y, 0);
FPS_DrawToScreen(screen, real_rs, real_gs, real_bs, real_as, fps_offsx, fps_offsy);
}
- if(!(cur_flags & SDL_OPENGL))
- {
- if(!OverlayOK)
+ if(!OverlayOK)
SDL_Flip(screen);
- }
- else
- {
- PumpWrap();
- SDL_GL_SwapBuffers();
- //ogl_blitter->HardSync();
- }
}
void Video_PtoV(const int in_x, const int in_y, int32 *out_x, int32 *out_y)

View File

@@ -0,0 +1,37 @@
Removed buggy test for GCC 81740 bug.
Signed-off-by: "Michel Stempin" <michel.stempin@wanadoo.fr>
---
tests.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- mednafen-0.9.48.orig/src/tests.cpp
+++ mednafen-0.9.48/src/tests.cpp
@@ -766,6 +766,8 @@ void NO_INLINE NO_CLONE TestGCC80631(voi
assert(TestGCC80631_Sub(p) == 0);
}
+// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82750
+#ifdef BUGGY_TEST_GCC81740
NO_INLINE NO_CLONE void TestGCC81740_Sub(int* p, unsigned count)
{
static const int good[20] = { 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 10, 5, 6, 7, 8, 15, 10, 11, 12, 13 };
@@ -791,7 +793,7 @@ NO_INLINE NO_CLONE void TestGCC81740(voi
TestGCC81740_Sub(&v[0][0], sizeof(v) / sizeof(int));
}
-
+#endif
template<typename A, typename B>
void NO_INLINE NO_CLONE TestSUCompare_Sub(A a, B b)
@@ -2045,7 +2047,9 @@ bool MDFN_RunMathTests(void)
TestGCC70941();
TestGCC71488();
TestGCC80631();
+#ifdef BUGGY_TEST_GCC81740
TestGCC81740();
+#endif
TestModTern();
TestBWNotMask31GTZ();

View File

@@ -0,0 +1,24 @@
config BR2_PACKAGE_MEDNAFEN
bool "mednafen"
help
The mednafen game engine.
https://mednafen.github.io/
if BR2_PACKAGE_MEDNAFEN
config BR2_PACKAGE_MEDNAFEN_FAST
bool "optimise for speed over accuracy"
default y
help
Optimise for fast math functions, at the expense of accuracy.
Say 'y' if you need speed and can live with inaccuracies in
the results. Say 'n' (the default) if accuracy is of utmost
importance.
This basically uses gcc's -Ofast optimisation level, which in
turn is basically using gcc's -ffast-math. See the gcc manual
for what this means.
endif

View File

@@ -0,0 +1,29 @@
################################################################################
#
# mednafen
#
################################################################################
MEDNAFEN_VERSION = 0.9.48
MEDNAFEN_SOURCE = mednafen-$(MEDNAFEN_VERSION).tar.xz
MEDNAFEN_SITE = http://downloads.sourceforge.net/sourceforge/mednafen
MEDNAFEN_LICENSE = GPL-2.0+
MEDNAFEN_LICENSE_FILES = COPYING
MEDNAFEN_DEPENDENCIES = sdl zlib
MEDNAFEN_CFLAGS = $(TARGET_CFLAGS) -ggdb -O3 -ftree-vectorize
ifeq ($(BR2_PACKAGE_MEDNAFEN_FAST),y)
MEDNAFEN_CFLAGS += -ffast-math -funsafe-math-optimizations
endif
ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
MEDNAFEN_CFLAGS += -D__ARM_NEON__ -mfpu=neon -mvectorize-with-neon-quad
endif
MEDNAFEN_CONF_OPTS += CFLAGS="$(MEDNAFEN_CFLAGS)"
MEDNAFEN_CONF_OPTS += --without-libsndfile
MEDNAFEN_CONF_ENV += SDL_CONFIG="$(STAGING_DIR)/usr/bin/sdl-config"
$(eval $(autotools-package))