From patchwork Fri Oct 20 15:39:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Costa X-Patchwork-Id: 828782 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lUsMDhAM"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yJbqj063dz9t4X for ; Sat, 21 Oct 2017 06:45:20 +1100 (AEDT) Received: from localhost ([::1]:55445 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5dEN-0006r3-3F for incoming@patchwork.ozlabs.org; Fri, 20 Oct 2017 15:45:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5dDD-000617-CH for qemu-devel@nongnu.org; Fri, 20 Oct 2017 15:44:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5dDC-0005Xg-Bb for qemu-devel@nongnu.org; Fri, 20 Oct 2017 15:44:07 -0400 Received: from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]:47563) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5dDC-0005XV-6z for qemu-devel@nongnu.org; Fri, 20 Oct 2017 15:44:06 -0400 Received: by mail-qk0-x241.google.com with SMTP id m189so15626970qke.4 for ; Fri, 20 Oct 2017 12:44:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Xt6LP8yKEm2XMwRXT8dz40J+kj1XYUMrcisuymsKj7U=; b=lUsMDhAMIAeVxa2kUgEGxNTFANy1t3lI6PCKq0M6GuiAgmq9GRU1PxdbpNMBbOwgpP 41sGs3ZEV2YryJ/z54sdHP/lvB7iKAL6NsKdSU4MzdQqsjzBD6RQWS26HoliezgN6u+0 W2Lpp684H8O2PNnuODueju9P2tMiP0bZwl3smtqASF9lgy/RUoFokL9uqs4VNOCjYLUX 47SjyY5f7hBhca3PGZBcARvC74F8OcrKyv32OEgZ/MYZDIXmGzlqFlLx3rvZ68/q7m+L KjbGaNvdeoq6t69/cz55ls4Qf4njmnOmwnqocBSxBnsefbBMCOUeZsQucn5r3m7PU3Ii OC1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Xt6LP8yKEm2XMwRXT8dz40J+kj1XYUMrcisuymsKj7U=; b=XOJQO5fviKiE4NigkU3SbJ/GhWbwx/cRbChH4UamrQq1b+oJ81qC5/TEIM6ptCpVPD +omCMVmXllRRKqm+pm0b3dEO/MW0xSaHcvSPqEUd95p8VqV3FZk8PGFnUyxKwO2kIqq9 7GSpd1wsqYyfPVaCQRSMBe+8Yx9N+oq1xDj2+od+QoMKtcVub9hOS0CgO6IXUq7FobER 5Rmm0NhyUAJIB9FAHTFu4AO4wH2gnNX3Fh1f+W0hUV7zr51oCABxPODFcKFTqrYH9RYv +MN0y/csFLY6UqGIn7W8g9pHLJavRUDMeAjnXmZ2EyGAq3poAGyLY2WdXuVZ9AI4ZrvH fDYA== X-Gm-Message-State: AMCzsaV2wJRzKlyL+7SEhik9Kc6E8casgU2cZ7ofEmytD5ff1KFZZv1R pIAHM2EN5lBd/UW31+pdAJIn56ny X-Google-Smtp-Source: ABhQp+Q1P2HiTfwOtOozFz3OFQqThzwh/JbwkrDRGnkIkN8gwj1FSgEEL2tX6yvTszbwMThaffO5+A== X-Received: by 10.55.72.201 with SMTP id v192mr8786050qka.333.1508528645434; Fri, 20 Oct 2017 12:44:05 -0700 (PDT) Received: from localhost.localdomain ([208.94.106.99]) by smtp.gmail.com with ESMTPSA id m4sm1108113qtf.51.2017.10.20.12.44.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Oct 2017 12:44:04 -0700 (PDT) From: Gabriel Augusto Costa To: qemu-devel@nongnu.org Date: Fri, 20 Oct 2017 11:39:49 -0400 Message-Id: <1508513990-15730-1-git-send-email-gabriel291075@gmail.com> X-Mailer: git-send-email 2.1.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::241 Subject: [Qemu-devel] [PATCH v3 05/11] kinetis_k64_flextimer.h has been added X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" I made 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 have prepared a series of patchs to include this machine: PATCH v3 n/11: It adds the machine and peripherals devices; PATCH v4 n/2: It changes the Make files to compile this machine. Signed-off-by: Gabriel Augusto Costa --- include/hw/timer/kinetis_k64_flextimer.h | 62 ++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 include/hw/timer/kinetis_k64_flextimer.h diff --git a/include/hw/timer/kinetis_k64_flextimer.h b/include/hw/timer/kinetis_k64_flextimer.h new file mode 100644 index 0000000..b0554f6 --- /dev/null +++ b/include/hw/timer/kinetis_k64_flextimer.h @@ -0,0 +1,62 @@ +/* + * Kinetis K64 peripheral microcontroller emulation. + * + * Copyright (c) 2017 Advantech Wireless + * Written by Gabriel Costa + * + * 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. + */ + +/* Kinetis K64 series FLEXTIMER controller. */ + +#ifndef KINETIS_FLEXTIMER_H +#define KINETIS_FLEXTIMER_H + +#include "hw/sysbus.h" +#include "chardev/char-fe.h" +#include "chardev/char-mux.h" +#include "hw/hw.h" + +#define TYPE_KINETIS_K64_FLEXTIMER "kinetis_K64_flextimer" +#define KINETIS_K64_FLEXTIMER(obj) \ + OBJECT_CHECK(kinetis_k64_flextimer_state, (obj), TYPE_KINETIS_K64_FLEXTIMER) + +typedef struct { + SysBusDevice parent_obj; + + MemoryRegion iomem; + + uint32_t SC; /**< Status And Control, offset: 0x0 */ + uint32_t CNT; /**< Counter, offset: 0x4 */ + uint32_t MOD; /**< Modulo, offset: 0x8 */ + struct { /* offset: 0xC, array step: 0x8 */ + uint32_t CnSC; /**< Ch(n) Status And Control, offset: 0xC, step: 0x8 */ + uint32_t CnV; /**< Ch(n) Value, array offset: 0x10, array step: 0x8 */ + } CONTROLS[8]; + uint32_t CNTIN; /**< Counter Initial Value, offset: 0x4C */ + uint32_t STATUS; /**< Capture And Compare Status, offset: 0x50 */ + uint32_t MODE; /**< Features Mode Selection, offset: 0x54 */ + uint32_t SYNC; /**< Synchronization, offset: 0x58 */ + uint32_t OUTINIT; /**< Initial State For Channels Output, offset: 0x5C */ + uint32_t OUTMASK; /**< Output Mask, offset: 0x60 */ + uint32_t COMBINE; /**< Function For Linked Channels, offset: 0x64 */ + uint32_t DEADTIME; /**< Deadtime Insertion Control, offset: 0x68 */ + uint32_t EXTTRIG; /**< FTM External Trigger, offset: 0x6C */ + uint32_t POL; /**< Channels Polarity, offset: 0x70 */ + uint32_t FMS; /**< Fault Mode Status, offset: 0x74 */ + uint32_t FILTER; /**< Input Capture Filter Control, offset: 0x78 */ + uint32_t FLTCTRL; /**< Fault Control, offset: 0x7C */ + uint32_t QDCTRL; /**< Quadrature Decoder Control And Status, offset: 0x80 */ + uint32_t CONF; /**< Configuration, offset: 0x84 */ + uint32_t FLTPOL; /**< FTM Fault Input Polarity, offset: 0x88 */ + uint32_t SYNCONF; /**< Synchronization Configuration, offset: 0x8C */ + uint32_t INVCTRL; /**< FTM Inverting Control, offset: 0x90 */ + uint32_t SWOCTRL; /**< FTM Software Output Control, offset: 0x94 */ + uint32_t PWMLOAD; /**< FTM PWM Load, offset: 0x98 */ + + qemu_irq irq; +} kinetis_k64_flextimer_state; + +#endif