arm: Adding new arm machine, Kinetis K64 MK64FN1M0
PATCH 1/1 arm: Adding new arm machine, Kinetis K64 MK64FN1M0
From: Gabriel Augusto Costa <[email protected]>
I add a new arm machine with some peripherals. The machine is mk64fn1m0, a cortex-m4 microcontroller from NXP Kinetis family. The machine can run a simple arm binary file using UART0 in polling mode.
I prepared two patchs to include this machine:
PATCH v1: Include the machine and peripherals devices;
PATCH v2: Change the make file to compile this machine.
Also, I made a folder tree to accomodate this machine more or less like u-boot. In my opinion put all files in the same folder "/hw/arm" is not a good idea, or put all code in an unique file, because machines from the same family sharing the same peripherals.
The folder tree struct is machine/family/peripheral, as an example:
kinetis/k64/peripheral.
So, in this way the code will be more maintainable.
--- hw/arm/kinetis/k64/mk64fn1m0.c | 170 +++++++++ hw/arm/kinetis/k64/peripheral/flextimer.c | 139 +++++++ hw/arm/kinetis/k64/peripheral/mcg.c | 225 ++++++++++++ hw/arm/kinetis/k64/peripheral/pmux.c | 423 ++++++++++++++++++++++ hw/arm/kinetis/k64/peripheral/sim.c | 292 +++++++++++++++ hw/arm/kinetis/k64/peripheral/uart.c | 369 +++++++++++++++++++ include/hw/arm/kinetis/k64/peripheral/flextimer.h | 62 ++++ include/hw/arm/kinetis/k64/peripheral/mcg.h | 47 +++ include/hw/arm/kinetis/k64/peripheral/pmux.h | 73 ++++ include/hw/arm/kinetis/k64/peripheral/sim.h | 56 +++ include/hw/arm/kinetis/k64/peripheral/uart.h | 85 +++++ 11 files changed, 1941 insertions(+) create mode 100755 hw/arm/kinetis/k64/mk64fn1m0.c create mode 100755 hw/arm/kinetis/k64/peripheral/flextimer.c create mode 100755 hw/arm/kinetis/k64/peripheral/mcg.c create mode 100755 hw/arm/kinetis/k64/peripheral/pmux.c create mode 100755 hw/arm/kinetis/k64/peripheral/sim.c create mode 100755 hw/arm/kinetis/k64/peripheral/uart.c create mode 100755 include/hw/arm/kinetis/k64/peripheral/flextimer.h create mode 100755 include/hw/arm/kinetis/k64/peripheral/mcg.h create mode 100755 include/hw/arm/kinetis/k64/peripheral/pmux.h create mode 100755 include/hw/arm/kinetis/k64/peripheral/sim.h create mode 100755 include/hw/arm/kinetis/k64/peripheral/uart.h
hw/arm/kinetis/k64/mk64fn1m0.c new file +170 -0
@@ -0,0 +1,170 @@ +/* +* Kinetis K64 MK64FN1M0 microcontroller emulation. +* +* Copyright (c) 2017 Advantech Wireless +* Written by Gabriel Costa <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 or +* (at your option) any later version. +*/ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/sysbus.h" +#include "hw/ssi/ssi.h" +#include "hw/arm/arm.h" +#include "hw/devices.h" +#include "qemu/timer.h" +#include "hw/i2c/i2c.h" +#include "net/net.h" +#include "hw/boards.h" +#include "qemu/log.h" +#include "exec/address-spaces.h" +#include "sysemu/sysemu.h" +#include "hw/char/pl011.h" +#include "hw/misc/unimp.h" +#include "cpu.h" +#include "hw/arm/kinetis/k64/peripheral/sim.h" +#include "hw/arm/kinetis/k64/peripheral/mcg.h" +#include "hw/arm/kinetis/k64/peripheral/flextimer.h" +#include "hw/arm/kinetis/k64/peripheral/pmux.h" +#include "hw/arm/kinetis/k64/peripheral/uart.h" + +#define FLASH_SIZE 1024*1024 +#define FLASH_BASE_ADDRESS 0x00000000 +#define SRAM_SIZE 192*1024 +#define SRAM_BASE_ADDRESS 0x20000000 + +#define NUM_IRQ_LINES 85 + +/* System controller. */ + +static void do_sys_reset (void *opaque,int n,int level) +{ +if (level) { +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); + } +} + +/* Interruptions at pag.77 K64P144M120F5RM.pdf */ + +static void mk64fn1m0_init_mach (MachineState *ms,const char *kernel_filename) +{ +DeviceState *nvic; + +MemoryRegion *system_memory =get_system_memory (); +MemoryRegion *sram =g_new (MemoryRegion,1 ); +MemoryRegion *flash =g_new (MemoryRegion,1 ); + +memory_region_init_ram (flash,NULL ,"k64.flash" ,FLASH_SIZE , &error_fatal); +memory_region_set_readonly (flash, true); +memory_region_add_subregion (system_memory,FLASH_BASE_ADDRESS , flash); + +memory_region_init_ram (sram,NULL ,"k64.sram" ,SRAM_SIZE , &error_fatal); +memory_region_add_subregion (system_memory,SRAM_BASE_ADDRESS , sram); + + nvic =armv7m_init (system_memory,FLASH_SIZE ,NUM_IRQ_LINES , + ms->kernel_filename, ms->cpu_type); + +qdev_connect_gpio_out_named (nvic,"SYSRESETREQ" ,0 , +qemu_allocate_irq (&do_sys_reset,NULL ,0 )); + +sysbus_create_simple (TYPE_KINETIS_K64_SIM ,0x40048000 ,NULL ); + +sysbus_create_simple (TYPE_KINETIS_K64_MCG ,0x40064000 ,NULL ); + +sysbus_create_simple (TYPE_KINETIS_K64_PMUX ,0x40049000 , +qdev_get_gpio_in (nvic,59 )); +sysbus_create_simple (TYPE_KINETIS_K64_PMUX ,0x4004A000 , +qdev_get_gpio_in (nvic,60 )); +sysbus_create_simple (TYPE_KINETIS_K64_PMUX ,0x4004B000 , +qdev_get_gpio_in (nvic,61 )); +sysbus_create_simple (TYPE_KINETIS_K64_PMUX ,0x4004C000 , +qdev_get_gpio_in (nvic,62 )); +sysbus_create_simple (TYPE_KINETIS_K64_PMUX ,0x4004D000 , +qdev_get_gpio_in (nvic,63 )); + +sysbus_create_simple (TYPE_KINETIS_K64_FLEXTIMER ,0x40038000 , +qdev_get_gpio_in (nvic,42 )); +sysbus_create_simple (TYPE_KINETIS_K64_FLEXTIMER ,0x40039000 , +qdev_get_gpio_in (nvic,43 )); +sysbus_create_simple (TYPE_KINETIS_K64_FLEXTIMER ,0x4003A000 , +qdev_get_gpio_in (nvic,44 )); + +/* dev = sysbus_create_simple(TYPE_KINETIS_SPI, 0x4002C000, +qdev_get_gpio_in(nvic, 31)); *SPI0*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_SPI, 0x4002D000, +qdev_get_gpio_in(nvic, 33)); *SPI1*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_ADC, 0x4003B000, +qdev_get_gpio_in(nvic, 31)); *ADC0*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_DAC, 0x4002F000, +qdev_get_gpio_in(nvic, 33)); *DAC0*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_I2C, 0x40066000, +qdev_get_gpio_in(nvic, 31)); *I2C0*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_I2C, 0x40067000, +qdev_get_gpio_in(nvic, 33)); *I2C1*/ + +// sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006A000, +// qdev_get_gpio_in(nvic, 31)); /*UART0*/ +kinetis_k64_uart_create (0x4006A000 ,qdev_get_gpio_in (nvic,31 ), + serial_hds[0 ]); +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006B000, +qdev_get_gpio_in(nvic, 33)); *UART1*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006C000, +qdev_get_gpio_in(nvic, 35)); *UART2*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006D000, +qdev_get_gpio_in(nvic, 37)); *UART3*/ + +/* dev = sysbus_create_simple(TYPE_KINETIS_SPI, 0x400AC000, +qdev_get_gpio_in(nvic, 65)); *SPI2*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_ADC, 0x400BB000, +qdev_get_gpio_in(nvic, 73)); *ADC1*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_I2C, 0x400E6000, +qdev_get_gpio_in(nvic, 74)); *I2C2*/ + +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x400EA000, +qdev_get_gpio_in(nvic, 66)); *UART4*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x400EB000, +qdev_get_gpio_in(nvic, 68)); *UART5*/ + +create_unimplemented_device ("peripheral_bridge_0" ,0x40000000 ,0x1000 ); +create_unimplemented_device ("Crossbar_Switch" ,0x40004000 ,0x1000 ); +create_unimplemented_device ("DMA_Controller" ,0x40008000 ,0x1000 ); +create_unimplemented_device ("DMA_Controller_t" ,0x40009000 ,0x1000 ); +create_unimplemented_device ("FlexBus" ,0x4000C000 ,0x1000 ); +create_unimplemented_device ("MPU" ,0x4000D000 ,0x1000 ); +create_unimplemented_device ("Flash_mem_ctrl" ,0x4001F000 ,0x1000 ); +create_unimplemented_device ("Flash_mem" ,0x40020000 ,0x1000 ); +create_unimplemented_device ("DMA_ch_multiplexer" ,0x40021000 ,0x1000 ); +} + +static void mk64fn1m0_init (MachineState *machine) +{ +const char *kernel_filename = machine->kernel_filename; +mk64fn1m0_init_mach (machine, kernel_filename); +} + +static void mk64fn1m0_class_init (ObjectClass *oc,void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); + + mc->desc ="Kinetis K64 MCU (Cortex-M4)" ; + mc->init = mk64fn1m0_init; + mc->ignore_memory_transaction_failures = true; + mc->default_cpu_type =ARM_CPU_TYPE_NAME ("cortex-m4" ); + mc->max_cpus =1 ; +} + +static const TypeInfo mk64_type = { + .name =MACHINE_TYPE_NAME ("mk64fn1m0" ), + .parent =TYPE_MACHINE , + .class_init = mk64fn1m0_class_init, +}; + +static void mk64fn1m0_machine_init (void ) +{ +type_register_static (&mk64_type); +} + +type_init (mk64fn1m0_machine_init)
hw/arm/kinetis/k64/peripheral/flextimer.c new file +139 -0
140 lines not on this page · raw message
hw/arm/kinetis/k64/peripheral/mcg.c new file +225 -0
226 lines not on this page · raw message
hw/arm/kinetis/k64/peripheral/pmux.c new file +423 -0
424 lines not on this page · raw message
hw/arm/kinetis/k64/peripheral/sim.c new file +292 -0
293 lines not on this page · raw message
hw/arm/kinetis/k64/peripheral/uart.c new file +369 -0
370 lines not on this page · raw message
include/hw/arm/kinetis/k64/peripheral/flextimer.h new file +62 -0
63 lines not on this page · raw message
include/hw/arm/kinetis/k64/peripheral/mcg.h new file +47 -0
48 lines not on this page · raw message
include/hw/arm/kinetis/k64/peripheral/pmux.h new file +73 -0
74 lines not on this page · raw message
include/hw/arm/kinetis/k64/peripheral/sim.h new file +56 -0
57 lines not on this page · raw message
include/hw/arm/kinetis/k64/peripheral/uart.h new file +85 -0
86 lines not on this page · raw message
Signature · 1 line
2.1.4
Quoted 8 lines · On 19 October 2017 at 13:50, <[email protected]> wrote:
From: Gabriel Augusto Costa <[email protected]>
I add a new arm machine with some peripherals. The machine is mk64fn1m0, a cortex-m4 microcontroller from NXP Kinetis family. The machine can run a simple arm binary file using UART0 in polling mode.
I prepared two patchs to include this machine:
PATCH v1: Include the machine and peripherals devices;
PATCH v2: Change the make file to compile this machine.
Thanks for these patches.
Quoted 7 lines
Also, I made a folder tree to accomodate this machine more or less like u-boot. In my opinion put all files in the same folder "/hw/arm" is not a good idea, or put all code in an unique file, because machines from the same family sharing the same peripherals.
The folder tree struct is machine/family/peripheral, as an example:
kinetis/k64/peripheral.
So, in this way the code will be more maintainable.
There's an inevitable conflict between:
* these peripherals are all for this board so they should go in a subdirectory for these boards
* these peripherals are all of the same type so they should go in a subdirectory for devices of that type
Whichever way you slice things it will split things that in some sense should go together.
However, QEMU has made a decision that we put devices of a specific type in the same directory (roughly following what the Linux kernel does). So can you please follow the structure we have? Having a mix of the two schemes is much worse than consistently following either.
Quoted 14 lines
Signed-off-by Gabriel Augusto Costa <[email protected]>--- hw/arm/kinetis/k64/mk64fn1m0.c | 170 +++++++++ hw/arm/kinetis/k64/peripheral/flextimer.c | 139 +++++++ hw/arm/kinetis/k64/peripheral/mcg.c | 225 ++++++++++++ hw/arm/kinetis/k64/peripheral/pmux.c | 423 ++++++++++++++++++++++ hw/arm/kinetis/k64/peripheral/sim.c | 292 +++++++++++++++ hw/arm/kinetis/k64/peripheral/uart.c | 369 +++++++++++++++++++ include/hw/arm/kinetis/k64/peripheral/flextimer.h | 62 ++++ include/hw/arm/kinetis/k64/peripheral/mcg.h | 47 +++ include/hw/arm/kinetis/k64/peripheral/pmux.h | 73 ++++ include/hw/arm/kinetis/k64/peripheral/sim.h | 56 +++ include/hw/arm/kinetis/k64/peripheral/uart.h | 85 +++++ 11 files changed, 1941 insertions(+)
This patch is much too large to review. Please can you split it up into a number of smaller logical patchsets? (Usually for a new board and SoC one patch per new device is what makes most sense. If you get much over 250 lines in one patch you should consider whether there's a logical split of it possible.)
https://wiki.qemu.org/Contribute/SubmitAPatch has some other helpful suggestions for patch submissions and is generally worth reading I think.
If you could structure your next revision of this series to include a cover letter email that would also be helpful; some of our automatic patch handling tools can't deal with multi-patch series that don't have the cover letter.
thanks
-- PMM
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH v1] arm: Adding new arm machine, Kinetis K64 MK64FN1M0
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'3ac7610368 arm: Adding new arm machine, Kinetis K64 MK64FN1M0
=== OUTPUT BEGIN ===
Checking PATCH 1/1: arm: Adding new arm machine, Kinetis K64 MK64FN1M0...
ERROR: do not set execute permissions for source files
#24: FILE: hw/arm/kinetis/k64/mk64fn1m0.c
ERROR: spaces required around that '*' (ctx:VxV)
#62: FILE: hw/arm/kinetis/k64/mk64fn1m0.c:34:
+#define FLASH_SIZE 1024*1024
^
ERROR: Macros with complex values should be enclosed in parenthesis #62: FILE: hw/arm/kinetis/k64/mk64fn1m0.c:34:
+#define FLASH_SIZE 1024*1024
ERROR: spaces required around that '*' (ctx:VxV)
#64: FILE: hw/arm/kinetis/k64/mk64fn1m0.c:36:
+#define SRAM_SIZE 192*1024
^
ERROR: Macros with complex values should be enclosed in parenthesis #64: FILE: hw/arm/kinetis/k64/mk64fn1m0.c:36:
+#define SRAM_SIZE 192*1024
ERROR: trailing whitespace
#97: FILE: hw/arm/kinetis/k64/mk64fn1m0.c:69:
+ $
ERROR: trailing whitespace
#104: FILE: hw/arm/kinetis/k64/mk64fn1m0.c:76:
+ $
ERROR: trailing whitespace
#122: FILE: hw/arm/kinetis/k64/mk64fn1m0.c:94:
+ $
ERROR: do not use C99 // comments
#136: FILE: hw/arm/kinetis/k64/mk64fn1m0.c:108:
+// sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006A000,
ERROR: do not use C99 // comments
#137: FILE: hw/arm/kinetis/k64/mk64fn1m0.c:109:
+// qdev_get_gpio_in(nvic, 31)); /*UART0*/
ERROR: trailing whitespace
#139: FILE: hw/arm/kinetis/k64/mk64fn1m0.c:111:
+ serial_hds[0]); $
ERROR: trailing whitespace
#158: FILE: hw/arm/kinetis/k64/mk64fn1m0.c:130:
+ $
ERROR: adding a line without newline at end of file #198: FILE: hw/arm/kinetis/k64/mk64fn1m0.c:170:
+type_init(mk64fn1m0_machine_init)
ERROR: do not set execute permissions for source files #201: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c
ERROR: trailing whitespace
#216: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:11:
+ $
ERROR: trailing whitespace
#233: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:28:
+#include "hw/arm/kinetis/k64/peripheral/flextimer.h" $
ERROR: do not use C99 // comments
#242: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:37:
+// VMSTATE_UINT32(CONTROLS[0], kinetis_k64_flextimer_state),
ERROR: trailing whitespace
#270: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:65:
+ $
ERROR: do not use C99 // comments
#277: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:72:
+// kinetis_k64_flextimer_state *s = (kinetis_k64_flextimer_state *)opaque;
ERROR: trailing whitespace
#278: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:73:
+^I$
ERROR: code indent should never use tabs
#278: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:73:
+^I$
ERROR: trailing whitespace
#282: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:77:
+ $
ERROR: switch and case should be at the same indent #283: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:78:
+ switch (offset) {
+ default:
ERROR: do not use C99 // comments
#294: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:89:
+// kinetis_k64_flextimer_state *s = (kinetis_k64_flextimer_state *)opaque;
ERROR: switch and case should be at the same indent #296: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:91:
+ switch (offset) {
+ default:
ERROR: trailing whitespace
#315: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:110:
+ $
ERROR: trailing whitespace
#328: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:123:
+ dc->desc = "Kinetis K64 series FlexTimer"; $
ERROR: adding a line without newline at end of file #344: FILE: hw/arm/kinetis/k64/peripheral/flextimer.c:139:
+type_init(kinetis_k64_flextimer_register_types)
ERROR: do not set execute permissions for source files #347: FILE: hw/arm/kinetis/k64/peripheral/mcg.c
ERROR: trailing whitespace
#362: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:11:
+ $
ERROR: trailing whitespace
#405: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:54:
+ $
ERROR: trailing whitespace
#426: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:75:
+/* printf("kinetis_k64_mcg_write: Offset = 0x%02X, Value = 0x%02X\n", $
ERROR: trailing whitespace
#427: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:76:
+ (unsigned int)offset, (unsigned int)value);*/ $
ERROR: trailing whitespace
#428: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:77:
+ $
ERROR: switch and case should be at the same indent #429: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:78:
+ switch (offset) {
+ case 0x00: /**< MCG Control 1 Register, offset: 0x0 */
[...]
+ case 0x01: /**< MCG Control 2 Register, offset: 0x1 */
[...]
+ case 0x02: /**< MCG Control 3 Register, offset: 0x2 */
[...]
+ case 0x03: /**< MCG Control 4 Register, offset: 0x3 */
[...]
+ case 0x04: /**< MCG Control 5 Register, offset: 0x4 */
[...]
+ case 0x05: /**< MCG Control 6 Register, offset: 0x5 */
[...]
+ case 0x06: /**< MCG Status Register, offset: 0x6 */
[...]
+ case 0x08: /**< MCG Status and Control Register, offset: 0x8 */
[...]
+ case 0x0A: /**< MCG Auto Trim Compare Value High Register, offset: 0xA*/
[...]
+ case 0x0B: /**< MCG Auto Trim Compare Value Low Register, offset: 0xB */
[...]
+ case 0x0C: /**< MCG Control 7 Register, offset: 0xC */
[...]
+ case 0x0D: /**< MCG Control 8 Register, offset: 0xD */
[...]
+ default:
ERROR: do not use C99 // comments
#431: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:80:
+ if (value & 1<<2){ //IREFS
ERROR: spaces required around that '<<' (ctx:VxV) #431: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:80:
+ if (value & 1<<2){ //IREFS
^
ERROR: space required before the open brace '{' #431: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:80:
+ if (value & 1<<2){ //IREFS
ERROR: trailing statements should be on next line #431: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:80:
+ if (value & 1<<2){ //IREFS
ERROR: trailing whitespace
#432: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:81:
+ s->S = 0; $
ERROR: trailing whitespace
#433: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:82:
+ s->S |= 1<<3; // 10 Enconding 2 - External ref clk is selected $
WARNING: line over 80 characters
#433: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:82:
+ s->S |= 1<<3; // 10 Enconding 2 - External ref clk is selected
ERROR: do not use C99 // comments
#433: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:82:
+ s->S |= 1<<3; // 10 Enconding 2 - External ref clk is selected
ERROR: spaces required around that '<<' (ctx:VxV) #433: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:82:
+ s->S |= 1<<3; // 10 Enconding 2 - External ref clk is selected
^
ERROR: spaces required around that '>>' (ctx:VxV) #435: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:84:
+ if ((s->C1 & 0x80) && (value>>6 == 0)){
^ERROR: space required before the open brace '{' #435: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:84:
+ if ((s->C1 & 0x80) && (value>>6 == 0)){
ERROR: trailing whitespace
#436: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:85:
+ s->S |= 1<<2; // 11 Enconding 3 - Output of the PLL is selected $
WARNING: line over 80 characters
#436: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:85:
+ s->S |= 1<<2; // 11 Enconding 3 - Output of the PLL is selected
ERROR: do not use C99 // comments
#436: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:85:
+ s->S |= 1<<2; // 11 Enconding 3 - Output of the PLL is selected
ERROR: spaces required around that '<<' (ctx:VxV) #436: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:85:
+ s->S |= 1<<2; // 11 Enconding 3 - Output of the PLL is selected
^
ERROR: do not use C99 // comments
#451: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:100:
+ if (s->C5 & 1<<6){ //PLLCLKEN0
ERROR: spaces required around that '<<' (ctx:VxV) #451: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:100:
+ if (s->C5 & 1<<6){ //PLLCLKEN0
^
ERROR: space required before the open brace '{' #451: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:100:
+ if (s->C5 & 1<<6){ //PLLCLKEN0
ERROR: trailing statements should be on next line #451: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:100:
+ if (s->C5 & 1<<6){ //PLLCLKEN0
ERROR: trailing whitespace
#452: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:101:
+ s->S |= 1<<6; //LOCK0 $
ERROR: do not use C99 // comments
#452: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:101:
+ s->S |= 1<<6; //LOCK0
ERROR: spaces required around that '<<' (ctx:VxV) #452: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:101:
+ s->S |= 1<<6; //LOCK0
^
ERROR: do not use C99 // comments
#457: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:106:
+ if (s->C6 & 1<<6){ //PLLS
ERROR: spaces required around that '<<' (ctx:VxV) #457: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:106:
+ if (s->C6 & 1<<6){ //PLLS
^
ERROR: space required before the open brace '{' #457: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:106:
+ if (s->C6 & 1<<6){ //PLLS
ERROR: trailing statements should be on next line #457: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:106:
+ if (s->C6 & 1<<6){ //PLLS
ERROR: trailing whitespace
#458: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:107:
+ s->S |= 1<<5; //PLLST $
ERROR: do not use C99 // comments
#458: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:107:
+ s->S |= 1<<5; //PLLST
ERROR: spaces required around that '<<' (ctx:VxV) #458: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:107:
+ s->S |= 1<<5; //PLLST
^
ERROR: trailing whitespace
#459: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:108:
+ } $
ERROR: trailing whitespace
#489: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:138:
+ $
ERROR: switch and case should be at the same indent #490: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:139:
+ switch (offset) {
+ case 0x00: /**< MCG Control 1 Register, offset: 0x0 */
[...]
+ case 0x01: /**< MCG Control 2 Register, offset: 0x1 */
[...]
+ case 0x02: /**< MCG Control 3 Register, offset: 0x2 */
[...]
+ case 0x03: /**< MCG Control 4 Register, offset: 0x3 */
[...]
+ case 0x04: /**< MCG Control 5 Register, offset: 0x4 */
[...]
+ case 0x05: /**< MCG Control 6 Register, offset: 0x5 */
[...]
+ case 0x06: /**< MCG Status Register, offset: 0x6 */
[...]
+ case 0x08: /**< MCG Status and Control Register, offset: 0x8 */
[...]
+ case 0x0A: /**< MCG Auto Trim Compare Value High Register, offset: 0xA*/
[...]
+ case 0x0B: /**< MCG Auto Trim Compare Value Low Register, offset: 0xB */
[...]
+ case 0x0C: /**< MCG Control 7 Register, offset: 0xC */
[...]
+ case 0x0D: /**< MCG Control 8 Register, offset: 0xD */
[...]
+ default:
ERROR: trailing whitespace
#528: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:177:
+ qemu_log_mask(LOG_GUEST_ERROR, $
ERROR: trailing whitespace
#534: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:183:
+ return value; $
ERROR: trailing whitespace
#547: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:196:
+ $
ERROR: trailing whitespace
#560: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:209:
+ dc->desc = "Kinetis K64 series MCG"; $
ERROR: adding a line without newline at end of file #576: FILE: hw/arm/kinetis/k64/peripheral/mcg.c:225:
+type_init(kinetis_k64_mcg_register_types)
ERROR: do not set execute permissions for source files #579: FILE: hw/arm/kinetis/k64/peripheral/pmux.c
ERROR: trailing whitespace
#594: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:11:
+ $
ERROR: trailing whitespace
#596: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:13:
+ $
ERROR: trailing whitespace
#663: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:80:
+ $
ERROR: trailing whitespace
#664: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:81:
+ s->PCR00 = 0x00000000; $
ERROR: trailing whitespace
#665: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:82:
+ s->PCR01 = 0x00000000; $
ERROR: trailing whitespace
#666: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:83:
+ s->PCR02 = 0x00000000; $
ERROR: trailing whitespace
#667: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:84:
+ s->PCR03 = 0x00000000; $
ERROR: trailing whitespace
#668: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:85:
+ s->PCR04 = 0x00000000; $
ERROR: trailing whitespace
#669: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:86:
+ s->PCR05 = 0x00000000; $
ERROR: trailing whitespace
#670: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:87:
+ s->PCR06 = 0x00000000; $
ERROR: trailing whitespace
#671: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:88:
+ s->PCR07 = 0x00000000; $
ERROR: trailing whitespace
#672: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:89:
+ s->PCR08 = 0x00000000; $
ERROR: trailing whitespace
#673: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:90:
+ s->PCR09 = 0x00000000; $
ERROR: trailing whitespace
#674: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:91:
+ s->PCR10 = 0x00000000; $
ERROR: trailing whitespace
#675: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:92:
+ s->PCR11 = 0x00000000; $
ERROR: trailing whitespace
#676: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:93:
+ s->PCR12 = 0x00000000; $
ERROR: trailing whitespace
#677: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:94:
+ s->PCR13 = 0x00000000; $
ERROR: trailing whitespace
#678: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:95:
+ s->PCR14 = 0x00000000; $
ERROR: trailing whitespace
#679: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:96:
+ s->PCR15 = 0x00000000; $
ERROR: trailing whitespace
#680: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:97:
+ s->PCR16 = 0x00000000; $
ERROR: trailing whitespace
#681: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:98:
+ s->PCR17 = 0x00000000; $
ERROR: trailing whitespace
#682: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:99:
+ s->PCR18 = 0x00000000; $
ERROR: trailing whitespace
#683: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:100:
+ s->PCR19 = 0x00000000; $
ERROR: trailing whitespace
#684: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:101:
+ s->PCR20 = 0x00000000; $
ERROR: trailing whitespace
#685: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:102:
+ s->PCR21 = 0x00000000; $
ERROR: trailing whitespace
#686: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:103:
+ s->PCR22 = 0x00000000; $
ERROR: trailing whitespace
#687: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:104:
+ s->PCR23 = 0x00000000; $
ERROR: trailing whitespace
#688: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:105:
+ s->PCR24 = 0x00000000; $
ERROR: trailing whitespace
#689: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:106:
+ s->PCR25 = 0x00000000; $
ERROR: trailing whitespace
#690: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:107:
+ s->PCR26 = 0x00000000; $
ERROR: trailing whitespace
#691: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:108:
+ s->PCR27 = 0x00000000; $
ERROR: trailing whitespace
#692: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:109:
+ s->PCR28 = 0x00000000; $
ERROR: trailing whitespace
#693: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:110:
+ s->PCR29 = 0x00000000; $
ERROR: trailing whitespace
#694: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:111:
+ s->PCR30 = 0x00000000; $
ERROR: trailing whitespace
#695: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:112:
+ s->PCR31 = 0x00000000; $
ERROR: trailing whitespace
#696: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:113:
+ s->GPCLR = 0x00000000; $
ERROR: trailing whitespace
#697: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:114:
+ s->GPCHR = 0x00000000; $
ERROR: trailing whitespace
#698: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:115:
+ s->ISFR = 0x00000000; $
ERROR: trailing whitespace
#699: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:116:
+ s->DFER = 0x00000000; $
ERROR: trailing whitespace
#700: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:117:
+ s->DFCR = 0x00000000; $
ERROR: trailing whitespace
#712: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:129:
+ $
ERROR: switch and case should be at the same indent #713: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:130:
+ switch (offset) {
+ case 0x00: /**< Pin Control Register n, offset: 0x0, step: 0x4 */
[...]
+ case 0x04:
[...]
+ case 0x08:
[...]
+ case 0x0C:
[...]
+ case 0x10:
[...]
+ case 0x14:
[...]
+ case 0x18:
[...]
+ case 0x1C:
[...]
+ case 0x20:
[...]
+ case 0x24:
[...]
+ case 0x28:
[...]
+ case 0x2C:
[...]
+ case 0x30:
[...]
+ case 0x34:
[...]
+ case 0x38:
[...]
+ case 0x3C:
[...]
+ case 0x40:
[...]
+ case 0x44:
[...]
+ case 0x48:
[...]
+ case 0x4C:
[...]
+ case 0x50:
[...]
+ case 0x54:
[...]
+ case 0x58:
[...]
+ case 0x5C:
[...]
+ case 0x60:
[...]
+ case 0x64:
[...]
+ case 0x68:
[...]
+ case 0x6C:
[...]
+ case 0x70:
[...]
+ case 0x74:
[...]
+ case 0x78:
[...]
+ case 0x7C:
[...]
+ case 0x80: /**< Global Pin Control Low Register, offset: 0x80 */
[...]
+ case 0x84: /**< Global Pin Control High Register, offset: 0x84 */
[...]
+ case 0xA0: /**< Interrupt Status Flag Register, offset: 0xA0 */
[...]
+ case 0xC0: /**< Digital Filter Enable Register, offset: 0xC0 */
[...]
+ case 0xC4: /**< Digital Filter Clock Register, offset: 0xC4 */
[...]
+ case 0xC8: /**< Digital Filter Width Register, offset: 0xC8 */
[...]
+ default:
ERROR: trailing whitespace
#717: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:134:
+ case 0x04: $
ERROR: trailing whitespace
#720: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:137:
+ case 0x08: $
ERROR: trailing whitespace
#723: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:140:
+ case 0x0C: $
ERROR: trailing whitespace
#726: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:143:
+ case 0x10: $
ERROR: trailing whitespace
#729: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:146:
+ case 0x14: $
ERROR: trailing whitespace
#732: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:149:
+ case 0x18: $
ERROR: trailing whitespace
#735: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:152:
+ case 0x1C: $
ERROR: trailing whitespace
#738: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:155:
+ case 0x20: $
ERROR: trailing whitespace
#741: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:158:
+ case 0x24: $
ERROR: trailing whitespace
#744: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:161:
+ case 0x28: $
ERROR: trailing whitespace
#747: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:164:
+ case 0x2C: $
ERROR: trailing whitespace
#750: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:167:
+ case 0x30: $
ERROR: trailing whitespace
#753: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:170:
+ case 0x34: $
ERROR: trailing whitespace
#756: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:173:
+ case 0x38: $
ERROR: trailing whitespace
#759: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:176:
+ case 0x3C: $
ERROR: trailing whitespace
#762: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:179:
+ case 0x40: $
ERROR: trailing whitespace
#765: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:182:
+ case 0x44: $
ERROR: trailing whitespace
#768: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:185:
+ case 0x48: $
ERROR: trailing whitespace
#828: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:245:
+ $
ERROR: trailing whitespace
#841: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:258:
+ $
ERROR: switch and case should be at the same indent #842: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:259:
+ switch (offset) {
+ case 0x00: /**< Pin Control Register n, offset: 0x0, step: 0x4 */
[...]
+ case 0x04:
[...]
+ case 0x08:
[...]
+ case 0x0C:
[...]
+ case 0x10:
[...]
+ case 0x14:
[...]
+ case 0x18:
[...]
+ case 0x1C:
[...]
+ case 0x20:
[...]
+ case 0x24:
[...]
+ case 0x28:
[...]
+ case 0x2C:
[...]
+ case 0x30:
[...]
+ case 0x34:
[...]
+ case 0x38:
[...]
+ case 0x3C:
[...]
+ case 0x40:
[...]
+ case 0x44:
[...]
+ case 0x48:
[...]
+ case 0x4C:
[...]
+ case 0x50:
[...]
+ case 0x54:
[...]
+ case 0x58:
[...]
+ case 0x5C:
[...]
+ case 0x60:
[...]
+ case 0x64:
[...]
+ case 0x68:
[...]
+ case 0x6C:
[...]
+ case 0x70:
[...]
+ case 0x74:
[...]
+ case 0x78:
[...]
+ case 0x7C:
[...]
+ case 0x80: /**< Global Pin Control Low Register, offset: 0x80 */
[...]
+ case 0x84: /**< Global Pin Control High Register, offset: 0x84 */
[...]
+ case 0xA0: /**< Interrupt Status Flag Register, offset: 0xA0 */
[...]
+ case 0xC0: /**< Digital Filter Enable Register, offset: 0xC0 */
[...]
+ case 0xC4: /**< Digital Filter Clock Register, offset: 0xC4 */
[...]
+ case 0xC8: /**< Digital Filter Width Register, offset: 0xC8 */
[...]
+ default:
ERROR: trailing whitespace
#846: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:263:
+ case 0x04: $
ERROR: trailing whitespace
#849: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:266:
+ case 0x08: $
ERROR: trailing whitespace
#852: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:269:
+ case 0x0C: $
ERROR: trailing whitespace
#855: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:272:
+ case 0x10: $
ERROR: trailing whitespace
#858: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:275:
+ case 0x14: $
ERROR: trailing whitespace
#861: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:278:
+ case 0x18: $
ERROR: trailing whitespace
#864: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:281:
+ case 0x1C: $
ERROR: trailing whitespace
#867: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:284:
+ case 0x20: $
ERROR: trailing whitespace
#870: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:287:
+ case 0x24: $
ERROR: trailing whitespace
#873: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:290:
+ case 0x28: $
ERROR: trailing whitespace
#876: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:293:
+ case 0x2C: $
ERROR: trailing whitespace
#879: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:296:
+ case 0x30: $
ERROR: trailing whitespace
#882: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:299:
+ case 0x34: $
ERROR: trailing whitespace
#885: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:302:
+ case 0x38: $
ERROR: trailing whitespace
#888: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:305:
+ case 0x3C: $
ERROR: trailing whitespace
#891: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:308:
+ case 0x40: $
ERROR: trailing whitespace
#894: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:311:
+ case 0x44: $
ERROR: trailing whitespace
#897: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:314:
+ case 0x48: $
ERROR: trailing whitespace
#962: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:379:
+/* printf("kinetis_k64_pmux_read: Offset = 0x%08X, Value = 0x%08X\n", $
ERROR: trailing whitespace
#977: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:394:
+ $
ERROR: trailing whitespace
#990: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:407:
+ dc->desc = "Kinetis K64 series PMUX"; $
ERROR: adding a line without newline at end of file #1006: FILE: hw/arm/kinetis/k64/peripheral/pmux.c:423:
+type_init(kinetis_k64_pmux_register_types)
ERROR: do not set execute permissions for source files #1009: FILE: hw/arm/kinetis/k64/peripheral/sim.c
ERROR: trailing whitespace
#1024: FILE: hw/arm/kinetis/k64/peripheral/sim.c:11:
+ $
ERROR: trailing whitespace
#1026: FILE: hw/arm/kinetis/k64/peripheral/sim.c:13:
+ $
ERROR: trailing whitespace
#1077: FILE: hw/arm/kinetis/k64/peripheral/sim.c:64:
+ $
ERROR: trailing whitespace
#1110: FILE: hw/arm/kinetis/k64/peripheral/sim.c:97:
+ $
ERROR: switch and case should be at the same indent #1111: FILE: hw/arm/kinetis/k64/peripheral/sim.c:98:
+ switch (offset) {
+ case 0x0000: /**< System Options Register 1, offset: 0x0 */
[...]
+ case 0x0004: /**< SOPT1 Configuration Register, offset: 0x4 */
[...]
+ case 0x1004: /**< System Options Register 2, offset: 0x1004 */
[...]
+ case 0x100C: /**< System Options Register 4, offset: 0x100C */
[...]
+ case 0x1010: /**< System Options Register 5, offset: 0x1010 */
[...]
+ case 0x1018: /**< System Options Register 7, offset: 0x1018 */
[...]
+ case 0x1024: /**< System Device Id Register, offset: 0x1024 */
[...]
+ case 0x1028: /**< System Clock Gating Ctrl Register 1, offset: 0x1028 */
[...]
+ case 0x102C: /**< System Clock Gating Ctrl Register 2, offset: 0x102C */
[...]
+ case 0x1030: /**< System Clock Gating Ctrl Register 3, offset: 0x1030 */
[...]
+ case 0x1034: /**< System Clock Gating Ctrl Register 4, offset: 0x1034 */
[...]
+ case 0x1013: /**< System Clock Gating Ctrl Register 5, offset: 0x1038 */
[...]
+ case 0x103C: /**< System Clock Gating Ctrl Register 6, offset: 0x103C */
[...]
+ case 0x1040: /**< System Clock Gating Ctrl Register 7, offset: 0x1040 */
[...]
+ case 0x1044: /**< System Clock Divider Register 1, offset: 0x1044 */
[...]
+ case 0x1048: /**< System Clock Divider Register 2, offset: 0x1048 */
[...]
+ case 0x104C: /**< Flash Configuration Register 1, offset: 0x104C */
[...]
+ case 0x1050: /**< Flash Configuration Register 2, offset: 0x1050 */
[...]
+ case 0x1054: /**< Unique Id Register High, offset: 0x1054 */
[...]
+ case 0x1058: /**< Unique Id Register Mid-High, offset: 0x1058 */
[...]
+ case 0x105C: /**< Unique Id Register Mid Low, offset: 0x105C */
[...]
+ case 0x1060: /**< Unique Id Register Low, offset: 0x1060 */
[...]
+ default:
ERROR: trailing whitespace
#1175: FILE: hw/arm/kinetis/k64/peripheral/sim.c:162:
+ case 0x1060: /**< Unique Id Register Low, offset: 0x1060 */ $
ERROR: trailing whitespace
#1176: FILE: hw/arm/kinetis/k64/peripheral/sim.c:163:
+ s->UIDL = value; $
ERROR: trailing whitespace
#1189: FILE: hw/arm/kinetis/k64/peripheral/sim.c:176:
+ $
ERROR: switch and case should be at the same indent #1190: FILE: hw/arm/kinetis/k64/peripheral/sim.c:177:
+ switch (offset) {
+ case 0x0000: /**< System Options Register 1, offset: 0x0 */
[...]
+ case 0x0004: /**< SOPT1 Configuration Register, offset: 0x4 */
[...]
+ case 0x1004: /**< System Options Register 2, offset: 0x1004 */
[...]
+ case 0x100C: /**< System Options Register 4, offset: 0x100C */
[...]
+ case 0x1010: /**< System Options Register 5, offset: 0x1010 */
[...]
+ case 0x1018: /**< System Options Register 7, offset: 0x1018 */
[...]
+ case 0x1024: /**< System Device Id Register, offset: 0x1024 */
[...]
+ case 0x1028: /**< System Clock Gating Ctrl Register 1, offset: 0x1028 */
[...]
+ case 0x102C: /**< System Clock Gating Ctrl Register 2, offset: 0x102C */
[...]
+ case 0x1030: /**< System Clock Gating Ctrl Register 3, offset: 0x1030 */
[...]
+ case 0x1034: /**< System Clock Gating Ctrl Register 4, offset: 0x1034 */
[...]
+ case 0x1013: /**< System Clock Gating Ctrl Register 5, offset: 0x1038 */
[...]
+ case 0x103C: /**< System Clock Gating Ctrl Register 6, offset: 0x103C */
[...]
+ case 0x1040: /**< System Clock Gating Ctrl Register 7, offset: 0x1040 */
[...]
+ case 0x1044: /**< System Clock Divider Register 1, offset: 0x1044 */
[...]
+ case 0x1048: /**< System Clock Divider Register 2, offset: 0x1048 */
[...]
+ case 0x104C: /**< Flash Configuration Register 1, offset: 0x104C */
[...]
+ case 0x1050: /**< Flash Configuration Register 2, offset: 0x1050 */
[...]
+ case 0x1054: /**< Unique Id Register High, offset: 0x1054 */
[...]
+ case 0x1058: /**< Unique Id Register Mid-High, offset: 0x1058 */
[...]
+ case 0x105C: /**< Unique Id Register Mid Low, offset: 0x105C */
[...]
+ case 0x1060: /**< Unique Id Register Low, offset: 0x1060 */
[...]
+ default:
ERROR: trailing whitespace
#1254: FILE: hw/arm/kinetis/k64/peripheral/sim.c:241:
+ case 0x1060: /**< Unique Id Register Low, offset: 0x1060 */ $
ERROR: trailing whitespace
#1264: FILE: hw/arm/kinetis/k64/peripheral/sim.c:251:
+ return value; $
ERROR: trailing whitespace
#1277: FILE: hw/arm/kinetis/k64/peripheral/sim.c:264:
+ $
ERROR: adding a line without newline at end of file #1305: FILE: hw/arm/kinetis/k64/peripheral/sim.c:292:
+type_init(kinetis_k64_sim_register_types)
ERROR: do not set execute permissions for source files #1308: FILE: hw/arm/kinetis/k64/peripheral/uart.c
ERROR: trailing whitespace
#1323: FILE: hw/arm/kinetis/k64/peripheral/uart.c:11:
+ $
ERROR: trailing whitespace
#1376: FILE: hw/arm/kinetis/k64/peripheral/uart.c:64:
+ VMSTATE_UINT8(TL7816, kinetis_k64_uart_state), $
ERROR: trailing whitespace
#1384: FILE: hw/arm/kinetis/k64/peripheral/uart.c:72:
+ $
ERROR: trailing whitespace
#1415: FILE: hw/arm/kinetis/k64/peripheral/uart.c:103:
+ $
ERROR: trailing whitespace
#1426: FILE: hw/arm/kinetis/k64/peripheral/uart.c:114:
+ (unsigned int)offset, (unsigned int)value, (unsigned int)value);*/ $
WARNING: line over 80 characters
#1426: FILE: hw/arm/kinetis/k64/peripheral/uart.c:114:
+ (unsigned int)offset, (unsigned int)value, (unsigned int)value);*/
ERROR: trailing whitespace
#1427: FILE: hw/arm/kinetis/k64/peripheral/uart.c:115:
+ $
ERROR: switch and case should be at the same indent #1428: FILE: hw/arm/kinetis/k64/peripheral/uart.c:116:
+ switch (offset) {
+ case 0x00: /**< UART Baud Rate Registers: High, offset: 0x0 */
[...]
+ case 0x01: /**< UART Baud Rate Registers: Low, offset: 0x1 */
[...]
+ case 0x02: /**< UART Control Register 1, offset: 0x2 */
[...]
+ case 0x03: /**< UART Control Register 2, offset: 0x3 */
[...]
+ case 0x04: /**< UART Status Register 1, offset: 0x4 */
[...]
+ case 0x05: /**< UART Status Register 2, offset: 0x5 */
[...]
+ case 0x06: /**< UART Control Register 3, offset: 0x6 */
[...]
+ case 0x07: /**< UART Data Register, offset: 0x7 */
[...]
+ case 0x08: /**< UART Match Address Registers 1, offset: 0x8 */
[...]
+ case 0x09: /**< UART Match Address Registers 2, offset: 0x9 */
[...]
+ case 0x0A: /**< UART Control Register 4, offset: 0xA */
[...]
+ case 0x0B: /**< UART Control Register 5, offset: 0xB */
[...]
+ case 0x0C: /**< UART Extended Data Register, offset: 0xC */
[...]
+ case 0x0D: /**< UART Modem Register, offset: 0xD */
[...]
+ case 0x0E: /**< UART Infrared Register, offset: 0xE */
[...]
+ case 0x10: /**< UART FIFO Parameters, offset: 0x10 */
[...]
+ case 0x11: /**< UART FIFO Control Register, offset: 0x11 */
[...]
+ case 0x12: /**< UART FIFO Status Register, offset: 0x12 */
[...]
+ case 0x13: /**< UART FIFO Transmit Watermark, offset: 0x13 */
[...]
+ case 0x14: /**< UART FIFO Transmit Count, offset: 0x14 */
[...]
+ case 0x15: /**< UART FIFO Receive Watermark, offset: 0x15 */
[...]
+ case 0x16: /**< UART FIFO Receive Count, offset: 0x16 */
[...]
+ case 0x18: /**< UART 7816 Control Register, offset: 0x18 */
[...]
+ case 0x19: /**< UART 7816 Interrupt Enable Register, offset: 0x19 */
[...]
+ case 0x1A: /**< UART 7816 Interrupt Status Register, offset: 0x1A */
[...]
+ case 0x1B: /**< UART 7816 Wait Parameter Register, offset: 0x1B */
[...]
+ case 0x1C: /**< UART 7816 Wait N Register, offset: 0x1C */
[...]
+ case 0x1D: /**< UART 7816 Wait FD Register, offset: 0x1D */
[...]
+ case 0x1E: /**< UART 7816 Error Threshold Register, offset: 0x1E */
[...]
+ case 0x1F: /**< UART 7816 Transmit Length Register, offset: 0x1F */
[...]
+ default:
ERROR: switch and case should be at the same indent #1532: FILE: hw/arm/kinetis/k64/peripheral/uart.c:220:
+ switch (offset) {
+ case 0x00: /**< UART Baud Rate Registers: High, offset: 0x0 */
[...]
+ case 0x01: /**< UART Baud Rate Registers: Low, offset: 0x1 */
[...]
+ case 0x02: /**< UART Control Register 1, offset: 0x2 */
[...]
+ case 0x03: /**< UART Control Register 2, offset: 0x3 */
[...]
+ case 0x04: /**< UART Status Register 1, offset: 0x4 */
[...]
+ case 0x05: /**< UART Status Register 2, offset: 0x5 */
[...]
+ case 0x06: /**< UART Control Register 3, offset: 0x6 */
[...]
+ case 0x07: /**< UART Data Register, offset: 0x7 */
[...]
+ case 0x08: /**< UART Match Address Registers 1, offset: 0x8 */
[...]
+ case 0x09: /**< UART Match Address Registers 2, offset: 0x9 */
[...]
+ case 0x0A: /**< UART Control Register 4, offset: 0xA */
[...]
+ case 0x0B: /**< UART Control Register 5, offset: 0xB */
[...]
+ case 0x0C: /**< UART Extended Data Register, offset: 0xC */
[...]
+ case 0x0D: /**< UART Modem Register, offset: 0xD */
[...]
+ case 0x0E: /**< UART Infrared Register, offset: 0xE */
[...]
+ case 0x10: /**< UART FIFO Parameters, offset: 0x10 */
[...]
+ case 0x11: /**< UART FIFO Control Register, offset: 0x11 */
[...]
+ case 0x12: /**< UART FIFO Status Register, offset: 0x12 */
[...]
+ case 0x13: /**< UART FIFO Transmit Watermark, offset: 0x13 */
[...]
+ case 0x14: /**< UART FIFO Transmit Count, offset: 0x14 */
[...]
+ case 0x15: /**< UART FIFO Receive Watermark, offset: 0x15 */
[...]
+ case 0x16: /**< UART FIFO Receive Count, offset: 0x16 */
[...]
+ case 0x18: /**< UART 7816 Control Register, offset: 0x18 */
[...]
+ case 0x19: /**< UART 7816 Interrupt Enable Register, offset: 0x19 */
[...]
+ case 0x1A: /**< UART 7816 Interrupt Status Register, offset: 0x1A */
[...]
+ case 0x1B: /**< UART 7816 Wait Parameter Register, offset: 0x1B */
[...]
+ case 0x1C: /**< UART 7816 Wait N Register, offset: 0x1C */
[...]
+ case 0x1D: /**< UART 7816 Wait FD Register, offset: 0x1D */
[...]
+ case 0x1E: /**< UART 7816 Error Threshold Register, offset: 0x1E */
[...]
+ case 0x1F: /**< UART 7816 Transmit Length Register, offset: 0x1F */
[...]
+ default:
ERROR: trailing whitespace
#1611: FILE: hw/arm/kinetis/k64/peripheral/uart.c:299:
+ $
ERROR: space required before the open brace '{' #1612: FILE: hw/arm/kinetis/k64/peripheral/uart.c:300:
+ if (s->RCFIFO == 0){
ERROR: do not use C99 // comments
#1613: FILE: hw/arm/kinetis/k64/peripheral/uart.c:301:
+ return 1; //Can read a byte
ERROR: space required after that close brace '}' #1614: FILE: hw/arm/kinetis/k64/peripheral/uart.c:302:
+ }else{
ERROR: do not use C99 // comments
#1615: FILE: hw/arm/kinetis/k64/peripheral/uart.c:303:
+ return 0; //Cannot read a byte
ERROR: trailing whitespace
#1622: FILE: hw/arm/kinetis/k64/peripheral/uart.c:310:
+ $
ERROR: space required before the open brace '{' #1623: FILE: hw/arm/kinetis/k64/peripheral/uart.c:311:
+ if (size > 0){
ERROR: space required before the open brace '{' #1624: FILE: hw/arm/kinetis/k64/peripheral/uart.c:312:
+ if (buf != NULL){
ERROR: trailing whitespace
#1649: FILE: hw/arm/kinetis/k64/peripheral/uart.c:337:
+ $
ERROR: adding a line without newline at end of file #1681: FILE: hw/arm/kinetis/k64/peripheral/uart.c:369:
+type_init(kinetis_k64_uart_register_types)
ERROR: do not set execute permissions for source files #1684: FILE: include/hw/arm/kinetis/k64/peripheral/flextimer.h
ERROR: trailing whitespace
#1699: FILE: include/hw/arm/kinetis/k64/peripheral/flextimer.h:11:
+ $
ERROR: space required after that close brace '}'
#1725: FILE: include/hw/arm/kinetis/k64/peripheral/flextimer.h:37:
+ }CONTROLS[8];
ERROR: trailing whitespace
#1745: FILE: include/hw/arm/kinetis/k64/peripheral/flextimer.h:57:
+ uint32_t PWMLOAD; /**< FTM PWM Load, offset: 0x98 */ $
ERROR: trailing whitespace
#1746: FILE: include/hw/arm/kinetis/k64/peripheral/flextimer.h:58:
+ $
ERROR: adding a line without newline at end of file #1750: FILE: include/hw/arm/kinetis/k64/peripheral/flextimer.h:62:
+#endif
ERROR: do not set execute permissions for source files #1753: FILE: include/hw/arm/kinetis/k64/peripheral/mcg.h
ERROR: trailing whitespace
#1768: FILE: include/hw/arm/kinetis/k64/peripheral/mcg.h:11:
+ $
ERROR: trailing whitespace
#1799: FILE: include/hw/arm/kinetis/k64/peripheral/mcg.h:42:
+ uint8_t C8; /**< MCG Control 8 Register, offset: 0xD */ $
ERROR: trailing whitespace
#1800: FILE: include/hw/arm/kinetis/k64/peripheral/mcg.h:43:
+ $
ERROR: adding a line without newline at end of file #1804: FILE: include/hw/arm/kinetis/k64/peripheral/mcg.h:47:
+#endif
ERROR: do not set execute permissions for source files #1807: FILE: include/hw/arm/kinetis/k64/peripheral/pmux.h
ERROR: trailing whitespace
#1822: FILE: include/hw/arm/kinetis/k64/peripheral/pmux.h:11:
+ $
ERROR: trailing whitespace
#1841: FILE: include/hw/arm/kinetis/k64/peripheral/pmux.h:30:
+ $
ERROR: trailing whitespace
#1879: FILE: include/hw/arm/kinetis/k64/peripheral/pmux.h:68:
+ uint32_t DFWR; /**< Digital Filter Width Register, offset: 0xC8 */ $
ERROR: trailing whitespace
#1880: FILE: include/hw/arm/kinetis/k64/peripheral/pmux.h:69:
+ $
ERROR: adding a line without newline at end of file #1884: FILE: include/hw/arm/kinetis/k64/peripheral/pmux.h:73:
+#endif
ERROR: do not set execute permissions for source files #1887: FILE: include/hw/arm/kinetis/k64/peripheral/sim.h
ERROR: trailing whitespace
#1902: FILE: include/hw/arm/kinetis/k64/peripheral/sim.h:11:
+ $
ERROR: trailing whitespace
#1943: FILE: include/hw/arm/kinetis/k64/peripheral/sim.h:52:
+ uint32_t UIDL; /**< Unique Id Register Low, offset: 0x1060 */ $
ERROR: adding a line without newline at end of file #1947: FILE: include/hw/arm/kinetis/k64/peripheral/sim.h:56:
+#endif
ERROR: do not set execute permissions for source files #1950: FILE: include/hw/arm/kinetis/k64/peripheral/uart.h
ERROR: trailing whitespace
#1965: FILE: include/hw/arm/kinetis/k64/peripheral/uart.h:11:
+ $
ERROR: trailing whitespace
#2018: FILE: include/hw/arm/kinetis/k64/peripheral/uart.h:64:
+ $
ERROR: trailing whitespace
#2023: FILE: include/hw/arm/kinetis/k64/peripheral/uart.h:69:
+static inline DeviceState *kinetis_k64_uart_create(hwaddr addr, qemu_irq irq, $
ERROR: adding a line without newline at end of file #2039: FILE: include/hw/arm/kinetis/k64/peripheral/uart.h:85:
+#endif
total: 215 errors, 3 warnings, 1941 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Thanks for your fast response and tips. This is my first time sending patchs!
Yes, I will follow the QEmu struct. I saw what other developers done (stm32f2xx) and I put the files in following folders:hw/arm/mk64fn1m0.c This file define the SoChw/char/kinetis_k64_uart.c UART peripheralhw/misc/kinetis_k64_flextimer.c Timers peripheralshw/misc/kinetis_k64_mcg.c Clock Managerhw/misc/kinetis_k64_pmux.c MUX selectorhw/misc/kinetis_k64_sim.c More Clock selection
that is ok?
I will solve the code style issues and prepare a new patch series. Also, I received an error about a build fail (among others, of course), I believe that this happened because the first patch was not applied.
Regards to all,
Gabriel Costa
Quoted 72 lines · Peter Maydell
Quoted 3 lines · On 19 October 2017 at 13:50, <[email protected]> wrote:
From: Gabriel Augusto Costa <[email protected]>
I add a new arm machine with some peripherals. The machine is mk64fn1m0,
a
Quoted 5 lines
cortex-m4 microcontroller from NXP Kinetis family. The machine can run a simple arm binary file using UART0 in polling mode.
I prepared two patchs to include this machine:
PATCH v1: Include the machine and peripherals devices;
PATCH v2: Change the make file to compile this machine.Thanks for these patches.
Quoted 1 line
Also, I made a folder tree to accomodate this machine more or less like
u-boot.
Quoted 1 line
In my opinion put all files in the same folder "/hw/arm" is not a good
idea,
Quoted 5 lines
or put all code in an unique file, because machines from the same family sharing the same peripherals.
The folder tree struct is machine/family/peripheral, as an example:
kinetis/k64/peripheral.
So, in this way the code will be more maintainable.There's an inevitable conflict between:
* these peripherals are all for this board so they should go in a subdirectory for these boards
* these peripherals are all of the same type so they should go in a subdirectory for devices of that type
Whichever way you slice things it will split things that in some sense should go together.However, QEMU has made a decision that we put devices of a specific type in the same directory (roughly following what the Linux kernel does). So can you please follow the structure we have? Having a mix of the two schemes is much worse than consistently following either.
Quoted 6 lines
Signed-off-by Gabriel Augusto Costa <[email protected]>--- hw/arm/kinetis/k64/mk64fn1m0.c | 170 +++++++++ hw/arm/kinetis/k64/peripheral/flextimer.c | 139 +++++++ hw/arm/kinetis/k64/peripheral/mcg.c | 225 ++++++++++++ hw/arm/kinetis/k64/peripheral/pmux.c | 423++++++++++++++++++++++
Quoted 2 lines
hw/arm/kinetis/k64/peripheral/sim.c | 292 +++++++++++++++ hw/arm/kinetis/k64/peripheral/uart.c | 369+++++++++++++++++++
Quoted 6 lines
include/hw/arm/kinetis/k64/peripheral/flextimer.h | 62 ++++ include/hw/arm/kinetis/k64/peripheral/mcg.h | 47 +++ include/hw/arm/kinetis/k64/peripheral/pmux.h | 73 ++++ include/hw/arm/kinetis/k64/peripheral/sim.h | 56 +++ include/hw/arm/kinetis/k64/peripheral/uart.h | 85 +++++ 11 files changed, 1941 insertions(+)This patch is much too large to review. Please can you split it up into a number of smaller logical patchsets? (Usually for a new board and SoC one patch per new device is what makes most sense. If you get much over 250 lines in one patch you should consider whether there's a logical split of it possible.)
https://wiki.qemu.org/Contribute/SubmitAPatch has some other helpful suggestions for patch submissions and is generally worth reading I think.
If you could structure your next revision of this series to include a cover letter email that would also be helpful; some of our automatic patch handling tools can't deal with multi-patch series that don't have the cover letter.
thanks
-- PMM
Quoted 8 lines · Gabriel Costa
Thanks for your fast response and tips. This is my first time sending patchs!
Yes, I will follow the QEmu struct. I saw what other developers done (stm32f2xx) and I put the files in following folders:
hw/arm/mk64fn1m0.cThis file define the SoChw/char/kinetis_k64_uart.cUART peripheralhw/misc/kinetis_k64_flextimer.cTimers peripherals
I'd say hw/timer/kinetis_k64_flextimer.c here.
Fred
Quoted 88 lines
hw/misc/kinetis_k64_mcg.cClock Managerhw/misc/kinetis_k64_pmux.cMUX selectorhw/misc/kinetis_k64_sim.cMore Clock selection
that is ok?I will solve the code style issues and prepare a new patch series. Also, I received an error about a build fail (among others, of course), I believe that this happened because the first patch was not applied.
Regards to all,
Gabriel Costa
Quoted 72 lines · Peter Maydell
Quoted 3 lines · On 19 October 2017 at 13:50, <[email protected]> wrote:
From: Gabriel Augusto Costa <[email protected]>
I add a new arm machine with some peripherals. The machine is mk64fn1m0,
a
Quoted 5 lines
cortex-m4 microcontroller from NXP Kinetis family. The machine can run a simple arm binary file using UART0 in polling mode.
I prepared two patchs to include this machine:
PATCH v1: Include the machine and peripherals devices;
PATCH v2: Change the make file to compile this machine.Thanks for these patches.
Quoted 1 line
Also, I made a folder tree to accomodate this machine more or less like
u-boot.
Quoted 1 line
In my opinion put all files in the same folder "/hw/arm" is not a good
idea,
Quoted 5 lines
or put all code in an unique file, because machines from the same family sharing the same peripherals.
The folder tree struct is machine/family/peripheral, as an example:
kinetis/k64/peripheral.
So, in this way the code will be more maintainable.There's an inevitable conflict between:
* these peripherals are all for this board so they should go in a subdirectory for these boards
* these peripherals are all of the same type so they should go in a subdirectory for devices of that type
Whichever way you slice things it will split things that in some sense should go together.However, QEMU has made a decision that we put devices of a specific type in the same directory (roughly following what the Linux kernel does). So can you please follow the structure we have? Having a mix of the two schemes is much worse than consistently following either.
Quoted 6 lines
Signed-off-by Gabriel Augusto Costa <[email protected]>--- hw/arm/kinetis/k64/mk64fn1m0.c | 170 +++++++++ hw/arm/kinetis/k64/peripheral/flextimer.c | 139 +++++++ hw/arm/kinetis/k64/peripheral/mcg.c | 225 ++++++++++++ hw/arm/kinetis/k64/peripheral/pmux.c | 423++++++++++++++++++++++
Quoted 2 lines
hw/arm/kinetis/k64/peripheral/sim.c | 292 +++++++++++++++ hw/arm/kinetis/k64/peripheral/uart.c | 369+++++++++++++++++++
Quoted 6 lines
include/hw/arm/kinetis/k64/peripheral/flextimer.h | 62 ++++ include/hw/arm/kinetis/k64/peripheral/mcg.h | 47 +++ include/hw/arm/kinetis/k64/peripheral/pmux.h | 73 ++++ include/hw/arm/kinetis/k64/peripheral/sim.h | 56 +++ include/hw/arm/kinetis/k64/peripheral/uart.h | 85 +++++ 11 files changed, 1941 insertions(+)This patch is much too large to review. Please can you split it up into a number of smaller logical patchsets? (Usually for a new board and SoC one patch per new device is what makes most sense. If you get much over 250 lines in one patch you should consider whether there's a logical split of it possible.)
https://wiki.qemu.org/Contribute/SubmitAPatch has some other helpful suggestions for patch submissions and is generally worth reading I think.
If you could structure your next revision of this series to include a cover letter email that would also be helpful; some of our automatic patch handling tools can't deal with multi-patch series that don't have the cover letter.
thanks
-- PMM
Quoted 18 lines · On 10/19/2017 09:50 AM, [email protected] wrote:
From: Gabriel Augusto Costa <[email protected]>
I add a new arm machine with some peripherals. The machine is mk64fn1m0, a cortex-m4 microcontroller from NXP Kinetis family. The machine can run a simple arm binary file using UART0 in polling mode.
I prepared two patchs to include this machine:
PATCH v1: Include the machine and peripherals devices;
PATCH v2: Change the make file to compile this machine.
Also, I made a folder tree to accomodate this machine more or less like u-boot. In my opinion put all files in the same folder "/hw/arm" is not a good idea, or put all code in an unique file, because machines from the same family sharing the same peripherals.
The folder tree struct is machine/family/peripheral, as an example:
kinetis/k64/peripheral.
So, in this way the code will be more maintainable.Signed-off-by Gabriel Augusto Costa <[email protected]>---
[...]
hw/arm/kinetis/k64/peripheral/sim.c line 266
Quoted 7 lines
hw/arm/kinetis/k64/peripheral/sim.c new file +7
-0+static void kinetis_k64_sim_init (Object *obj) +{ +kinetis_k64_sim_state *s =KINETIS_K64_SIM (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); + +memory_region_init_io (&s->iomem, obj, &kinetis_k64_sim_ops, s, +TYPE_KINETIS_K64_SIM ,0x2000 );
Why not... personally I'd rather use 2 regions for the sysctl, a 8B for SOPT1 and and 128B for the rest mapped at the next 4KB block.
Quoted 2 lines
(quoted diff) +2
-0+ sysbus_init_mmio(sbd, &s->iomem); +}
Quoted 25 lines
hw/arm/kinetis/k64/mk64fn1m0.c new file +25
-0+/* dev = sysbus_create_simple(TYPE_KINETIS_SPI, 0x4002C000, +qdev_get_gpio_in(nvic, 31)); *SPI0*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_SPI, 0x4002D000, +qdev_get_gpio_in(nvic, 33)); *SPI1*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_ADC, 0x4003B000, +qdev_get_gpio_in(nvic, 31)); *ADC0*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_DAC, 0x4002F000, +qdev_get_gpio_in(nvic, 33)); *DAC0*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_I2C, 0x40066000, +qdev_get_gpio_in(nvic, 31)); *I2C0*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_I2C, 0x40067000, +qdev_get_gpio_in(nvic, 33)); *I2C1*/ + +// sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006A000, +// qdev_get_gpio_in(nvic, 31)); /*UART0*/ +kinetis_k64_uart_create (0x4006A000 ,qdev_get_gpio_in (nvic,31 ), + serial_hds[0 ]); +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006B000, +qdev_get_gpio_in(nvic, 33)); *UART1*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006C000, +qdev_get_gpio_in(nvic, 35)); *UART2*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006D000, +qdev_get_gpio_in(nvic, 37)); *UART3*/ + +/* dev = sysbus_create_simple(TYPE_KINETIS_SPI, 0x400AC000,
hw/arm/kinetis/k64/mk64fn1m0.c line 129
Quoted 10 lines
hw/arm/kinetis/k64/mk64fn1m0.c new file +10
-0+qdev_get_gpio_in(nvic, 65)); *SPI2*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_ADC, 0x400BB000, +qdev_get_gpio_in(nvic, 73)); *ADC1*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_I2C, 0x400E6000, +qdev_get_gpio_in(nvic, 74)); *I2C2*/ + +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x400EA000, +qdev_get_gpio_in(nvic, 66)); *UART4*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x400EB000, +qdev_get_gpio_in(nvic, 68)); *UART5*/
Just create those with create_unimplemented_device() instead...
Quoted 11 lines
hw/arm/kinetis/k64/mk64fn1m0.c new file +11
-0+ +create_unimplemented_device ("peripheral_bridge_0" ,0x40000000 ,0x1000 ); +create_unimplemented_device ("Crossbar_Switch" ,0x40004000 ,0x1000 ); +create_unimplemented_device ("DMA_Controller" ,0x40008000 ,0x1000 ); +create_unimplemented_device ("DMA_Controller_t" ,0x40009000 ,0x1000 ); +create_unimplemented_device ("FlexBus" ,0x4000C000 ,0x1000 ); +create_unimplemented_device ("MPU" ,0x4000D000 ,0x1000 ); +create_unimplemented_device ("Flash_mem_ctrl" ,0x4001F000 ,0x1000 ); +create_unimplemented_device ("Flash_mem" ,0x40020000 ,0x1000 ); +create_unimplemented_device ("DMA_ch_multiplexer" ,0x40021000 ,0x1000 ); +}
Hi Philippe,
Thanks for all your comments!
I will put all this corrections for the next patch, also I removed the FlexTimer, it is not necessary to do this basic emulation.
Thanks,
Gabriel
Quoted 59 lines · Philippe Mathieu-Daudé
Quoted 25 lines
hw/arm/kinetis/k64/mk64fn1m0.c new file +25
-0+/* dev = sysbus_create_simple(TYPE_KINETIS_SPI, 0x4002C000, +qdev_get_gpio_in(nvic, 31)); *SPI0*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_SPI, 0x4002D000, +qdev_get_gpio_in(nvic, 33)); *SPI1*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_ADC, 0x4003B000, +qdev_get_gpio_in(nvic, 31)); *ADC0*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_DAC, 0x4002F000, +qdev_get_gpio_in(nvic, 33)); *DAC0*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_I2C, 0x40066000, +qdev_get_gpio_in(nvic, 31)); *I2C0*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_I2C, 0x40067000, +qdev_get_gpio_in(nvic, 33)); *I2C1*/ + +// sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006A000, +// qdev_get_gpio_in(nvic, 31)); /*UART0*/ +kinetis_k64_uart_create (0x4006A000 ,qdev_get_gpio_in (nvic,31 ), + serial_hds[0 ]); +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006B000, +qdev_get_gpio_in(nvic, 33)); *UART1*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006C000, +qdev_get_gpio_in(nvic, 35)); *UART2*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x4006D000, +qdev_get_gpio_in(nvic, 37)); *UART3*/ + +/* dev = sysbus_create_simple(TYPE_KINETIS_SPI, 0x400AC000, hw/arm/kinetis/k64/mk64fn1m0.c line 129
Quoted 10 lines
hw/arm/kinetis/k64/mk64fn1m0.c new file +10
-0+qdev_get_gpio_in(nvic, 65)); *SPI2*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_ADC, 0x400BB000, +qdev_get_gpio_in(nvic, 73)); *ADC1*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_I2C, 0x400E6000, +qdev_get_gpio_in(nvic, 74)); *I2C2*/ + +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x400EA000, +qdev_get_gpio_in(nvic, 66)); *UART4*/ +/* dev = sysbus_create_simple(TYPE_KINETIS_K64_UART, 0x400EB000, +qdev_get_gpio_in(nvic, 68)); *UART5*/ Just create those with
create_unimplemented_device()instead...Review
Quoted 2 lines
(quoted diff) +2
-0+ + create_unimplemented_device("peripheral_bridge_0", 0x40000000,
0x1000);Quoted 1 line
+ create_unimplemented_device("Crossbar_Switch",
0x40004000,
0x1000);Quoted 1 line
+ create_unimplemented_device("DMA_Controller",
0x40008000,
0x1000);Quoted 1 line
+ create_unimplemented_device("DMA_Controller_t",
0x40009000,
0x1000);Quoted 1 line
+ create_unimplemented_device("FlexBus",
0x4000C000,
0x1000);Quoted 1 line
+ create_unimplemented_device("MPU",
0x4000D000,
0x1000);Quoted 1 line
+ create_unimplemented_device("Flash_mem_ctrl",
0x4001F000,
0x1000);Quoted 1 line
+ create_unimplemented_device("Flash_mem",
0x40020000,
0x1000);Quoted 1 line
+ create_unimplemented_device("DMA_ch_multiplexer",
0x40021000,
0x1000);Quoted 1 line
+}