From nobody Fri Sep 20 22:16:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) client-ip=209.85.221.54; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f54.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1615654496; cv=none; d=zohomail.com; s=zohoarc; b=SVDLMA5rUEy0N7+LPyPIE8qx8dwaFbOtyuIJEL3zcuVZUSMg7TzuCL5Z9iDNk/TOMOeTuzd/+j8xe3/wzU86TsWqzSXhcC2rmvua8jS19NFVJA8+RZPQ5U3YdUUqweCMfIzE2oSHNprix+DPBupGtsWxRo1rbw6yC9OEW/vNVUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615654496; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=X9eAy7tAwcBfGFsgC+ZegGvTgLMi6sa09ssqoGaE5UA=; b=EWwSiMaLoDEWu6pyioYzLW3E0ifXvt53gBATM3l+BXAUFYGdi0b8QfWimw5osINsIr+BVQWQY5mRfvsn0r5VZfdF46PUw5SyuPplSmAZIItRmDPLst/UBNibcXYxHR88N5XenpRcOjTv44wY8JAK93fsn7CMovCB1vPvoLz3bOY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mx.zohomail.com with SMTPS id 1615654496752129.32000970969705; Sat, 13 Mar 2021 08:54:56 -0800 (PST) Received: by mail-wr1-f54.google.com with SMTP id 7so6470982wrz.0 for ; Sat, 13 Mar 2021 08:54:55 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id h22sm8193007wmb.36.2021.03.13.08.54.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 08:54:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X9eAy7tAwcBfGFsgC+ZegGvTgLMi6sa09ssqoGaE5UA=; b=Q9P0ItsBzRhlq9Xb/cGEC7rUwjvR0jvS8AbWbicoLDELRUAS63FHsj6My0R2bAYxVx T4nuopia1GqwcJRZvEYfiPEaC20a40sZ4mktWd3ItZp1DTyyOnjFX0nsxaCSWieiJmdG Lv6kc97efig7b7CErsZ4b08uxp9MXfZH5ck0FFPvw8GR6GAI8oBKDLkhWqZgfJnVNVFY DN+MqrZUDFp5JgTpmGy2VUwug6w9YFr/Y2q6U4fCza7G4T1Waz+52y+I8O3kCsw5p2Rj FeQfm5cpKWsvnIW6sRTh56scu2cHSewOvpcBR1pcS/CObGmtj4FZSFQeENgnWlGCo5Yz lTng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=X9eAy7tAwcBfGFsgC+ZegGvTgLMi6sa09ssqoGaE5UA=; b=ZSCnfZs+C/kOUfX0XyS3ziLYWbMrwRIqly1w5v25wRoJUiAuU97w4bZEdM5s5daGZW jc9uHjlknf+WbzLigjwd0KWm/jWiD1SjF6TM8XKYZ4md7UeDuWh9UrzUaS5ofRuJzL7w 2cGTzQznPJ4MxZBquzUSQuyco0mSTqm18syqRZTTiyoXbMxi7ZsDfvx5NbPbQCJvHoHC zhUqqpMyXnMliKnEvZvxd2nl2tyldsCY8EPtyThz0bBeT83/RuhaMtu5+P6kYSB1MynZ a1bjTZSG7hAekQ/5UZ/HGTenXkZ2zNvV3GvWbuH4zDZJ2UQxgwWD8UP29pSD4FYnkWm2 bjyQ== X-Gm-Message-State: AOAM531MFVRipF5sXImnDo/zWBv0bGnujV4PhmvI0IlIuQLVIyMKmhTT h6aCuz2qtQqDngvq2Vnci3Uosp1SZmgfIA== X-Google-Smtp-Source: ABdhPJzBeWFWAeTkc71qoHNDZIPuangswSvVKxPrTAUq2jvtN/jz412tPABf0IddKlhUl4ZwcmbuZw== X-Received: by 2002:adf:c641:: with SMTP id u1mr19743170wrg.332.1615654494088; Sat, 13 Mar 2021 08:54:54 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Thomas Huth , Sarah Harris Subject: [PATCH 01/11] hw/misc/led: Add yellow LED Date: Sat, 13 Mar 2021 17:54:35 +0100 Message-Id: <20210313165445.2113938-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210313165445.2113938-1-f4bug@amsat.org> References: <20210313165445.2113938-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Add the yellow "lime" LED. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael Rolnik Reviewed-by: Richard Henderson --- include/hw/misc/led.h | 1 + hw/misc/led.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/hw/misc/led.h b/include/hw/misc/led.h index aa359b87c20..29c08795708 100644 --- a/include/hw/misc/led.h +++ b/include/hw/misc/led.h @@ -27,6 +27,7 @@ typedef enum { /* Coarse wavelength range */ LED_COLOR_BLUE, /* 475 nm */ LED_COLOR_CYAN, /* 500 nm */ LED_COLOR_GREEN, /* 535 nm */ + LED_COLOR_YELLOW, /* 567 nm */ LED_COLOR_AMBER, /* 590 nm */ LED_COLOR_ORANGE, /* 615 nm */ LED_COLOR_RED, /* 630 nm */ diff --git a/hw/misc/led.c b/hw/misc/led.c index 5266d026d0b..f552b8b6483 100644 --- a/hw/misc/led.c +++ b/hw/misc/led.c @@ -20,6 +20,7 @@ static const char * const led_color_name[] =3D { [LED_COLOR_BLUE] =3D "blue", [LED_COLOR_CYAN] =3D "cyan", [LED_COLOR_GREEN] =3D "green", + [LED_COLOR_YELLOW] =3D "yellow", [LED_COLOR_AMBER] =3D "amber", [LED_COLOR_ORANGE] =3D "orange", [LED_COLOR_RED] =3D "red", --=20 2.26.2 From nobody Fri Sep 20 22:16:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) client-ip=209.85.221.45; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f45.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615654500; cv=none; d=zohomail.com; s=zohoarc; b=cSNS4Sc3kNJ065hLkBd9cE+KgZHuRRNjG1av/gcmPjuWVfMegFuvlFfyqBTRgibeG8tXMl3deX8cTsfuV+u/HojklDyVNESGqbg6Q4Zp+4I7r54dJPOHoj6PVfNtRbjATtT/D1+MvoVjDMvB7jGE+im3WLZBgBpvADfm5l0SxNk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615654500; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=J7gMHqZIErk5rCH25dzzn6NDSzVyceUq6CbtaCA8wLk=; b=COtw6pIe6IoNIxVWyOVgNro6hq04IS88syo+LSX+PNgN8hQZLST9KVl2j4p+6MhARpDpsNcrrZI4763xx0V88jFjd0xWbV8qHDDZc7RR3Ncrztd8J4zwus4g3puP5T/yIcGL/W8d4M/4zoyrTNtMtxP5B1Bb6Wc7KL6XrDtbBPw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mx.zohomail.com with SMTPS id 1615654500657861.0527755652647; Sat, 13 Mar 2021 08:55:00 -0800 (PST) Received: by mail-wr1-f45.google.com with SMTP id j2so6447430wrx.9 for ; Sat, 13 Mar 2021 08:55:00 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id j6sm6629154wmq.16.2021.03.13.08.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 08:54:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J7gMHqZIErk5rCH25dzzn6NDSzVyceUq6CbtaCA8wLk=; b=vBAgavVjSYHvgI0+0El4932LzCDSiTAgfKpoqzHXE/r/HSQiLXIHnMw2iUMH00tFVh Zfi6iBslOuunGvLDgmrF7z8K/AiXw+9n2dcUforP+G44ld50nxeyHPXAUIDwenJYH0Qg kqNi3EVecPZJT9AV55WqioEoSGCquQ1cjJaSMy1JVyR4vfVzHIoztD3x4Q8mferFMhoJ x5Q36D8MSK/iG3GIluBCRUjZc74yAXn/MqGWNiY0Mcl6YXoTojolRLTITqnkb+s0/FXQ ei/ENB6PS1StQwX4Dy2UFRggMu1WC5mY4hmiaoB9R+GY9CVPdccuhb6FpQrl76PnNNpn ohBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=J7gMHqZIErk5rCH25dzzn6NDSzVyceUq6CbtaCA8wLk=; b=jCqkuINN84HCFtg/6EQl7ZlwwHrR0AHjmM4y+ZMyv1eDWhoijKR8LoHTXE4rh7kSXO rEQPx8ZPPwqDIytWAhuEIuqe95GG651ApazRzFVGixx6fUWpMA2Ca1CJpPbStJYKEbDg QXEw/rQwSn1QDAhxu7n0XJ9D8pmgKZh456RgJPUdIVABYleE4Ko0K9qnfNVe487mNBfV QZlLhBFLsCe79YkderBiaD+duWoclHPrCgbixWrgPL53O7zRxsG7XvcKVnJ3zxOxYAjm 7z1spnO4yDhWL51eMHIDJA8XBUJyScq8JKPSs97qxoiYaHXbmVAfVLt43vaGPvwG4TrH 0Y1w== X-Gm-Message-State: AOAM530qkqUoc/alCPGTwDfIpr5EfD2q/xCoH4e2OXaFUUseDfRhyr6G eORa4UpxeQjUq+hkk746FGo= X-Google-Smtp-Source: ABdhPJy682kfbg0w8Oa1TZLb5kAIzzOv3TB2z/+y5T5Qm0zMPFB/1p8GZytJkVyem46sZy08TcaETw== X-Received: by 2002:a5d:4f0e:: with SMTP id c14mr19141486wru.78.1615654498937; Sat, 13 Mar 2021 08:54:58 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Thomas Huth , Sarah Harris Subject: [PATCH 02/11] hw/avr/arduino: List board schematic links Date: Sat, 13 Mar 2021 17:54:36 +0100 Message-Id: <20210313165445.2113938-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210313165445.2113938-1-f4bug@amsat.org> References: <20210313165445.2113938-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael Rolnik Reviewed-by: Richard Henderson --- hw/avr/arduino.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/hw/avr/arduino.c b/hw/avr/arduino.c index 3c8388490d6..3ff31492fa6 100644 --- a/hw/avr/arduino.c +++ b/hw/avr/arduino.c @@ -75,7 +75,10 @@ static void arduino_duemilanove_class_init(ObjectClass *= oc, void *data) MachineClass *mc =3D MACHINE_CLASS(oc); ArduinoMachineClass *amc =3D ARDUINO_MACHINE_CLASS(oc); =20 - /* https://www.arduino.cc/en/Main/ArduinoBoardDuemilanove */ + /* + * https://www.arduino.cc/en/Main/ArduinoBoardDuemilanove + * https://www.arduino.cc/en/uploads/Main/arduino-duemilanove-schemati= c.pdf + */ mc->desc =3D "Arduino Duemilanove (ATmega168)", mc->alias =3D "2009"; amc->mcu_type =3D TYPE_ATMEGA168_MCU; @@ -87,7 +90,10 @@ static void arduino_uno_class_init(ObjectClass *oc, void= *data) MachineClass *mc =3D MACHINE_CLASS(oc); ArduinoMachineClass *amc =3D ARDUINO_MACHINE_CLASS(oc); =20 - /* https://store.arduino.cc/arduino-uno-rev3 */ + /* + * https://store.arduino.cc/arduino-uno-rev3 + * https://www.arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf + */ mc->desc =3D "Arduino UNO (ATmega328P)"; mc->alias =3D "uno"; amc->mcu_type =3D TYPE_ATMEGA328_MCU; @@ -99,7 +105,10 @@ static void arduino_mega_class_init(ObjectClass *oc, vo= id *data) MachineClass *mc =3D MACHINE_CLASS(oc); ArduinoMachineClass *amc =3D ARDUINO_MACHINE_CLASS(oc); =20 - /* https://www.arduino.cc/en/Main/ArduinoBoardMega */ + /* + * https://www.arduino.cc/en/Main/ArduinoBoardMega + * https://www.arduino.cc/en/uploads/Main/arduino-mega2560-schematic.p= df + */ mc->desc =3D "Arduino Mega (ATmega1280)"; mc->alias =3D "mega"; amc->mcu_type =3D TYPE_ATMEGA1280_MCU; @@ -111,7 +120,10 @@ static void arduino_mega2560_class_init(ObjectClass *o= c, void *data) MachineClass *mc =3D MACHINE_CLASS(oc); ArduinoMachineClass *amc =3D ARDUINO_MACHINE_CLASS(oc); =20 - /* https://store.arduino.cc/arduino-mega-2560-rev3 */ + /* + * https://store.arduino.cc/arduino-mega-2560-rev3 + * https://www.arduino.cc/en/uploads/Main/arduino-mega2560_R3-sch.pdf + */ mc->desc =3D "Arduino Mega 2560 (ATmega2560)"; mc->alias =3D "mega2560"; amc->mcu_type =3D TYPE_ATMEGA2560_MCU; --=20 2.26.2 From nobody Fri Sep 20 22:16:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.43 as permitted sender) client-ip=209.85.221.43; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f43.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.43 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615654506; cv=none; d=zohomail.com; s=zohoarc; b=ao1DkI0qqjZXpQ9r7rIEg5F1a6A5a+k7ajFxv75ngAyUQO27UJKoylKFM+8/LxWWpqnXpQGjoXIMPqIzBEuGPej42fkLUsGZ4NJvOa76jn99t31owLg7giphJH/lVFQeCOGYJXexviLfKN8ZvKXaNzIb2zTs4xoEwMa/tJML10g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615654506; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yombwIBSirB9Dvx7ueAT1/MVmSKZPvZJuo5qcrvkekE=; b=lEmtAcaJOUQ0EEQfAg9NHyriW+6DGSIaYenlbRV5h+1TIC1+1gX4lRENgs+r5aUHdsLyM+ejLlloh4uJESRhNM0ufv+FBIZ7IV36O6PdeEpnsn1NruL3PEHOIYm/Wmjqj50vvaECMLDd+TY3asCortgIJxmEfGcdZl7chLCj400= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.43 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.zohomail.com with SMTPS id 1615654506084580.9884362836539; Sat, 13 Mar 2021 08:55:06 -0800 (PST) Received: by mail-wr1-f43.google.com with SMTP id f12so6445868wrx.8 for ; Sat, 13 Mar 2021 08:55:05 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id m14sm6911161wmi.27.2021.03.13.08.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 08:55:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yombwIBSirB9Dvx7ueAT1/MVmSKZPvZJuo5qcrvkekE=; b=XdzG0Luafe8P6M5uLPKfwDnvRQuf8Of2U43FTedf7iBw1tZWtQIypZtlh47w0ONf8X nF2YjHc8rD9sWMIeiWrKg1RoTIXiE6rJobM2j4Zp9lc/s8UomLOR/VbGyAVhMIeWKWYB RclG9M6T+ufyAanRoHxzeXhBts00vKbhu2GKq6w6d2sasoFGzpTcx9npSicwhiHUkbds 8piT8FFVce8zuAiF5HuogNbzo3XLE4Vfvm8Bd27mkn2ICiQzD6TwDtjVm9GeatLKimyX gCmmLMRJVhzHpwDobv8ixpht7lT0WN+wnBovk3l4cSIz6thrKPjaBrl/H1DrsiuT1ykC 7k8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yombwIBSirB9Dvx7ueAT1/MVmSKZPvZJuo5qcrvkekE=; b=GiP2oeSw2a1eTo2KvnVoxVMP1Rh5Q0R7G/pGJI5XyWWnVff/KdUBa/7jMBp/CDfNeI u8LeihhaT91UhNvFnplMHPAnycgZ2C+Phc+NLY4prpcLKwvjYF96XiWg8rjx8tV1FJpX oxFYj/szTkFBJMgw+vLJjMgKtNNptn+vMr/j612SD1RR5dzbQQ/At6EPdFy3I0sh4oIl wPj4zraoLf4tkpvsH1QivcKJ+kbqu7g9haTYr+osylKhF+pknY32w/LijZ6gPS8SPgAA 7BwnfhFmPakg558VHmiB/BDDtIVgVLWvzni00q2EaY/fDDK8iogj2/Xl+XD4e+L1RCkm 8qiA== X-Gm-Message-State: AOAM530+5/G52nj9TgbE9fohhYyXva33Hl3iVG/fvQ2wi8aqZGxmpJRj Sey24JoUoOgg8WrLSYort9g= X-Google-Smtp-Source: ABdhPJwk2qi5I92iEoTxqo39pQUVhxe2iDy8OKZPCqYKeZyJdHbhTFl0fKBgiLta2XTW1DLTJJ9b/A== X-Received: by 2002:adf:dc4e:: with SMTP id m14mr20482589wrj.248.1615654504236; Sat, 13 Mar 2021 08:55:04 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Thomas Huth , Sarah Harris , Heecheol Yang Subject: [PATCH 03/11] hw/avr: Add limited support for avr gpio registers Date: Sat, 13 Mar 2021 17:54:37 +0100 Message-Id: <20210313165445.2113938-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210313165445.2113938-1-f4bug@amsat.org> References: <20210313165445.2113938-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) From: Heecheol Yang Add some of these features for AVR GPIO: - GPIO I/O : PORTx registers - Data Direction : DDRx registers - DDRx toggling : PINx registers Following things are not supported yet: - MCUR registers Signed-off-by: Heecheol Yang Reviewed-by: Michael Rolnik Message-Id: [PMD: Use AVR_GPIO_COUNT] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/avr/atmega.h | 2 + include/hw/gpio/avr_gpio.h | 53 ++++++++++++++ hw/avr/atmega.c | 7 +- hw/gpio/avr_gpio.c | 138 +++++++++++++++++++++++++++++++++++++ hw/avr/Kconfig | 1 + hw/gpio/Kconfig | 3 + hw/gpio/meson.build | 1 + 7 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 include/hw/gpio/avr_gpio.h create mode 100644 hw/gpio/avr_gpio.c diff --git a/hw/avr/atmega.h b/hw/avr/atmega.h index a99ee15c7e1..e2289d5744e 100644 --- a/hw/avr/atmega.h +++ b/hw/avr/atmega.h @@ -13,6 +13,7 @@ =20 #include "hw/char/avr_usart.h" #include "hw/timer/avr_timer16.h" +#include "hw/gpio/avr_gpio.h" #include "hw/misc/avr_power.h" #include "target/avr/cpu.h" #include "qom/object.h" @@ -44,6 +45,7 @@ struct AtmegaMcuState { DeviceState *io; AVRMaskState pwr[POWER_MAX]; AVRUsartState usart[USART_MAX]; + AVRGPIOState gpio[GPIO_MAX]; AVRTimer16State timer[TIMER_MAX]; uint64_t xtal_freq_hz; }; diff --git a/include/hw/gpio/avr_gpio.h b/include/hw/gpio/avr_gpio.h new file mode 100644 index 00000000000..498a7275f05 --- /dev/null +++ b/include/hw/gpio/avr_gpio.h @@ -0,0 +1,53 @@ +/* + * AVR processors GPIO registers definition. + * + * Copyright (C) 2020 Heecheol Yang + * + * This program 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 or + * (at your option) version 3 of the License. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#ifndef AVR_GPIO_H +#define AVR_GPIO_H + +#include "hw/sysbus.h" +#include "qom/object.h" + +/* Offsets of registers. */ +#define GPIO_PIN 0x00 +#define GPIO_DDR 0x01 +#define GPIO_PORT 0x02 + +#define TYPE_AVR_GPIO "avr-gpio" +OBJECT_DECLARE_SIMPLE_TYPE(AVRGPIOState, AVR_GPIO) +#define AVR_GPIO_COUNT 8 + +struct AVRGPIOState { + /*< private >*/ + SysBusDevice parent_obj; + + /*< public >*/ + MemoryRegion mmio; + + struct { + uint8_t pin; + uint8_t ddr; + uint8_t port; + } reg; + + /* PORTx data changed IRQs */ + qemu_irq out[8u]; + +}; + +#endif /* AVR_GPIO_H */ diff --git a/hw/avr/atmega.c b/hw/avr/atmega.c index 44c6afebbb6..19c3122189f 100644 --- a/hw/avr/atmega.c +++ b/hw/avr/atmega.c @@ -283,8 +283,11 @@ static void atmega_realize(DeviceState *dev, Error **e= rrp) continue; } devname =3D g_strdup_printf("atmega-gpio-%c", 'a' + (char)i); - create_unimplemented_device(devname, - OFFSET_DATA + mc->dev[idx].addr, 3); + object_initialize_child(OBJECT(dev), devname, &s->gpio[i], + TYPE_AVR_GPIO); + sysbus_realize(SYS_BUS_DEVICE(&s->gpio[i]), &error_abort); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, + OFFSET_DATA + mc->dev[idx].addr); g_free(devname); } =20 diff --git a/hw/gpio/avr_gpio.c b/hw/gpio/avr_gpio.c new file mode 100644 index 00000000000..cdb574ef0d8 --- /dev/null +++ b/hw/gpio/avr_gpio.c @@ -0,0 +1,138 @@ +/* + * AVR processors GPIO registers emulation. + * + * Copyright (C) 2020 Heecheol Yang + * + * This program 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 or + * (at your option) version 3 of the License. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/sysbus.h" +#include "hw/irq.h" +#include "hw/gpio/avr_gpio.h" +#include "hw/qdev-properties.h" + +static void avr_gpio_reset(DeviceState *dev) +{ + AVRGPIOState *gpio =3D AVR_GPIO(dev); + + gpio->reg.pin =3D 0u; + gpio->reg.ddr =3D 0u; + gpio->reg.port =3D 0u; +} + +static void avr_gpio_write_port(AVRGPIOState *s, uint64_t value) +{ + uint8_t pin; + uint8_t cur_port_val =3D s->reg.port; + uint8_t cur_ddr_val =3D s->reg.ddr; + + for (pin =3D 0u; pin < AVR_GPIO_COUNT ; pin++) { + uint8_t cur_port_pin_val =3D cur_port_val & 0x01u; + uint8_t cur_ddr_pin_val =3D cur_ddr_val & 0x01u; + uint8_t new_port_pin_val =3D value & 0x01u; + + if (cur_ddr_pin_val && (cur_port_pin_val !=3D new_port_pin_val)) { + qemu_set_irq(s->out[pin], new_port_pin_val); + } + cur_port_val >>=3D 1u; + cur_ddr_val >>=3D 1u; + value >>=3D 1u; + } + s->reg.port =3D value & s->reg.ddr; +} +static uint64_t avr_gpio_read(void *opaque, hwaddr offset, unsigned int si= ze) +{ + AVRGPIOState *s =3D (AVRGPIOState *)opaque; + switch (offset) { + case GPIO_PIN: + return s->reg.pin; + case GPIO_DDR: + return s->reg.ddr; + case GPIO_PORT: + return s->reg.port; + default: + g_assert_not_reached(); + break; + } + return 0; +} + +static void avr_gpio_write(void *opaque, hwaddr offset, uint64_t value, + unsigned int size) +{ + AVRGPIOState *s =3D (AVRGPIOState *)opaque; + value =3D value & 0xF; + switch (offset) { + case GPIO_PIN: + s->reg.pin =3D value; + s->reg.port ^=3D s->reg.pin; + break; + case GPIO_DDR: + s->reg.ddr =3D value; + break; + case GPIO_PORT: + avr_gpio_write_port(s, value); + break; + default: + g_assert_not_reached(); + break; + } +} + +static const MemoryRegionOps avr_gpio_ops =3D { + .read =3D avr_gpio_read, + .write =3D avr_gpio_write, + .endianness =3D DEVICE_NATIVE_ENDIAN, +}; + +static void avr_gpio_init(Object *obj) +{ + AVRGPIOState *s =3D AVR_GPIO(obj); + + qdev_init_gpio_out(DEVICE(obj), s->out, ARRAY_SIZE(s->out)); + memory_region_init_io(&s->mmio, obj, &avr_gpio_ops, s, TYPE_AVR_GPIO, = 3); + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); +} +static void avr_gpio_realize(DeviceState *dev, Error **errp) +{ + /* Do nothing currently */ +} + + +static void avr_gpio_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->reset =3D avr_gpio_reset; + dc->realize =3D avr_gpio_realize; +} + +static const TypeInfo avr_gpio_info =3D { + .name =3D TYPE_AVR_GPIO, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(AVRGPIOState), + .instance_init =3D avr_gpio_init, + .class_init =3D avr_gpio_class_init, +}; + +static void avr_gpio_register_types(void) +{ + type_register_static(&avr_gpio_info); +} + +type_init(avr_gpio_register_types) diff --git a/hw/avr/Kconfig b/hw/avr/Kconfig index d31298c3cce..16a57ced11f 100644 --- a/hw/avr/Kconfig +++ b/hw/avr/Kconfig @@ -3,6 +3,7 @@ config AVR_ATMEGA_MCU select AVR_TIMER16 select AVR_USART select AVR_POWER + select AVR_GPIO =20 config ARDUINO select AVR_ATMEGA_MCU diff --git a/hw/gpio/Kconfig b/hw/gpio/Kconfig index f0e7405f6e6..fde7019b2ba 100644 --- a/hw/gpio/Kconfig +++ b/hw/gpio/Kconfig @@ -13,3 +13,6 @@ config GPIO_PWR =20 config SIFIVE_GPIO bool + +config AVR_GPIO + bool diff --git a/hw/gpio/meson.build b/hw/gpio/meson.build index 79568f00ce3..366aca52ca2 100644 --- a/hw/gpio/meson.build +++ b/hw/gpio/meson.build @@ -13,3 +13,4 @@ softmmu_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_gpio.c')) softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_gpio.c')) softmmu_ss.add(when: 'CONFIG_SIFIVE_GPIO', if_true: files('sifive_gpio.c')) +softmmu_ss.add(when: 'CONFIG_AVR_GPIO', if_true: files('avr_gpio.c')) --=20 2.26.2 From nobody Fri Sep 20 22:16:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.49 as permitted sender) client-ip=209.85.128.49; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f49.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615654511; cv=none; d=zohomail.com; s=zohoarc; b=bhDSXSYCglputvIo1PffJkYMwbgWLBLpHYweLpdZN56jZPW4EwmgZXho+jLGObDwctotAfriNGbiVfXgzLl9JnT4llsKkjpbliYAd84/brh4dYbj6kIlNxLudhzEZZHCiphL5ntPbBup9EYWEGTmG90/loGqcOC2y9SMgaXAi/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615654511; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yMi75r77hsETGOpZp4xh6/wHBuM4NFZi2eOjnyYTg6Y=; b=oFfHZ8INjWYg7Me6UuHdmvL9Rb8ukXwnL16Ingc5kW4MZJ2q3NiF1EiQoB7o0lRsmYJ2Io1sCau6Zivfc7eQSJMlk5GAVY+CQx9oWz8NXQhMiThoklrczYorseIM+kROA3Vb34HGOxD5oyEBQu5NRB6rOgvzBnHvnS1HoWy62xo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by mx.zohomail.com with SMTPS id 161565451121018.385406843283363; Sat, 13 Mar 2021 08:55:11 -0800 (PST) Received: by mail-wm1-f49.google.com with SMTP id l19so5574049wmh.1 for ; Sat, 13 Mar 2021 08:55:10 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id p14sm6851050wmc.30.2021.03.13.08.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 08:55:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yMi75r77hsETGOpZp4xh6/wHBuM4NFZi2eOjnyYTg6Y=; b=p86tI19NmHw9Y2osJ+Q4a1DQ3nsyKA5KgY3oVpvlSICt/+ISm1HNDJrnMekcUx48Ya cF53E31UiyllplDSrPwwduDJ1tS0OTQwC6Ikw/jX0EoQ/RiaTFmIH+XrqANVDkfew8/H eJZTNLAquhafpg3cqRHhwHzIM47EgS2WT+vmNdpkBNvc/GhSivywy2/EQOKg7wptShhf rvS8irnYGHFCK21o+CwiYISPswRlHLBaIyh9kw61AFUEbPMuP1wTMzs3GLrn76fqyKWZ bBjNTnXi2euzFZRVXBZJ2mz56k20BfvZopk1WvgWiQPESkEKY53Fa6F2EXXKdsLhRhrO ftPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yMi75r77hsETGOpZp4xh6/wHBuM4NFZi2eOjnyYTg6Y=; b=WEH9oeeoL2HnO6GuvgKECXOYeDSvHD0euPQ1ayEwA4AgxmRLOwgPi3LhajqPeRrrSJ ikIDQG2zJHLc+clASHeautdDwKbJ07pzeFDkwpyqYI1KTOptqNWkCihZl9ZuPD9waO1N QiEaYSAo4JFqqaPQAkyrohNbb2AQcH9edyIWdmSg6Qh+WJEXNRUkzTwjHR7ExnsvOlUa ahTz5woeTzVzffu5cwnfrz5xxh+wkduX2gHFO/VPzSSIXgFsy9+UoWpzjvqk10FMsaEa yH0Zcj/Vy9nk4lw/+ijBC4sGrq3K5Dhrz7ozsyHgrE+L6I9x+/Xztz7qSTZVUWWqydV4 1eig== X-Gm-Message-State: AOAM530MVlGq++4SU0Z7KmG+IBhTU+k3Gnq2epa4GpiVCA+2v45jM12c GUOF7edmhvUYttOktXW1d0w= X-Google-Smtp-Source: ABdhPJzNjUk7kO5TwZJsNI84t2zGXFGg6fHgkS2fC5bc4eD5rQhAsedw6hEG6vrtc/4xTrPil/h5ag== X-Received: by 2002:a1c:4b0a:: with SMTP id y10mr18094749wma.141.1615654509406; Sat, 13 Mar 2021 08:55:09 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Thomas Huth , Sarah Harris Subject: [PATCH 04/11] hw/gpio/avr_gpio: Add migration VMstate Date: Sat, 13 Mar 2021 17:54:38 +0100 Message-Id: <20210313165445.2113938-5-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210313165445.2113938-1-f4bug@amsat.org> References: <20210313165445.2113938-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael Rolnik Reviewed-by: Richard Henderson --- hw/gpio/avr_gpio.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/gpio/avr_gpio.c b/hw/gpio/avr_gpio.c index cdb574ef0d8..da34009daea 100644 --- a/hw/gpio/avr_gpio.c +++ b/hw/gpio/avr_gpio.c @@ -25,6 +25,7 @@ #include "hw/irq.h" #include "hw/gpio/avr_gpio.h" #include "hw/qdev-properties.h" +#include "migration/vmstate.h" =20 static void avr_gpio_reset(DeviceState *dev) { @@ -100,6 +101,18 @@ static const MemoryRegionOps avr_gpio_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 +static const VMStateDescription avr_gpio_vmstate =3D { + .name =3D "avr-gpio", + .version_id =3D 0, + .minimum_version_id =3D 0, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(reg.pin, AVRGPIOState), + VMSTATE_UINT8(reg.ddr, AVRGPIOState), + VMSTATE_UINT8(reg.port, AVRGPIOState), + VMSTATE_END_OF_LIST(), + }, +}; + static void avr_gpio_init(Object *obj) { AVRGPIOState *s =3D AVR_GPIO(obj); @@ -120,6 +133,7 @@ static void avr_gpio_class_init(ObjectClass *klass, voi= d *data) =20 dc->reset =3D avr_gpio_reset; dc->realize =3D avr_gpio_realize; + dc->vmsd =3D &avr_gpio_vmstate; } =20 static const TypeInfo avr_gpio_info =3D { --=20 2.26.2 From nobody Fri Sep 20 22:16:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.48 as permitted sender) client-ip=209.85.128.48; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f48.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615654516; cv=none; d=zohomail.com; s=zohoarc; b=ND6/pnBIeZiebwi1iDv/BOt/s0p3EYFfRMAU2/NgLQT5KvPLG2D22xD+pFYml7N7T9XOYM52QilRsqGiKnF68pB3uXiI5VG8kVgLc17yedYz0ihHkxTX694OAN2ocTIs07+q5F1cWWawWDudZMSTUyucSjXzRih2Pxb4Nir9cSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615654516; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hihCC5FBsAyENbINhxZtkFSu+BW/8DygZUmLRAPJkU4=; b=XLdr02HNrsRvc2/xXo4f5fPMBjuRjWPVQHMeaWCDozpawUOJbBv/xnBZnqT6Qx7zkPGlygrKZ4LLqFIaOxagClqgOvSQeSid2DzGM//IP5KCwnXqD2/bwMwcJ8rjeerzhuhj6HWDN0so4vosO4kaYdw9CIwnAbI2DYaaCsD512s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mx.zohomail.com with SMTPS id 1615654516024119.28596257420531; Sat, 13 Mar 2021 08:55:16 -0800 (PST) Received: by mail-wm1-f48.google.com with SMTP id m20-20020a7bcb940000b029010cab7e5a9fso17606771wmi.3 for ; Sat, 13 Mar 2021 08:55:15 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id z2sm12707485wrv.47.2021.03.13.08.55.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 08:55:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hihCC5FBsAyENbINhxZtkFSu+BW/8DygZUmLRAPJkU4=; b=MwwtSuA44Gk9F22pvsonQrAWXMUSDXWXxIatWgWwj5F5fUTO8SuYm+QUU1LMDXdIDl /7umfknISv4pEtqSboCws68+Gg3kozxb3Lwacp4YQg0HSahbuoMLqJV6vG/6vu+rBqd9 IwikClYXBO1PJsT3Jx8D+hdniZsa8jCxgDaSAgPJtfHJp8jtVyDJucPCdPT1djJAu61A NZvzNGEHzS9ffSglxTbgnk6SjBwLKodDzB5oyLG49bVnC7bxWYBrChn9fnh+O67Jth6x fksx5iI2h6/SYNLbhULlQz8h2yJLAlF+6aqlpAWjBw0ICzSnd2u7fyGhSMnmRSDGuNxi DBbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=hihCC5FBsAyENbINhxZtkFSu+BW/8DygZUmLRAPJkU4=; b=AlCGgnrQJzUQjknWZh8h+8u18m0Yac8LpwOpfMVnZ/tn9TBrn3e1O520mNrGFPSGmm z8UfaBFeFaQIhgQmAuctWBfu6RpD4YyNce/znky405mpdN9TAK5K7XDNfD8u03qT7i7J uXeJ3tCHUUfJmYcDp+PDNZ+0TKTQpe+cU6pwDHDe29oGJLLMVI5pq5uxwmAVBfwhLCPu iZnn4jb6Hyma8iU5vzqCVU/0i33uZ4BAFlvHStHEPOOKIg/ERrf5OemuDmOwfpJYip9S svcaU28rhmuqiXrAJOO3IUQlw8Zh5PoZjGgPyFrGxRf173TJ8LAeRxNkvViQlLyoU4pu hGpQ== X-Gm-Message-State: AOAM533TlTzs2K0Kz0bqDKwCqdNNUH06m43BcDvNlrTvIoPSYcAdqR80 E4NPi0R5HEstwFfXwLCHOv4= X-Google-Smtp-Source: ABdhPJw8ienjOj3cpo0Loht0ydfjcMucsbTNVXLRZdIofRRGl+hZ3hSykgQyWU75T+Txp4F93jKF/g== X-Received: by 2002:a1c:a74b:: with SMTP id q72mr18244373wme.158.1615654514380; Sat, 13 Mar 2021 08:55:14 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Thomas Huth , Sarah Harris Subject: [PATCH 05/11] hw/gpio/avr_gpio: Add 'id' field in AVRGPIOState Date: Sat, 13 Mar 2021 17:54:39 +0100 Message-Id: <20210313165445.2113938-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210313165445.2113938-1-f4bug@amsat.org> References: <20210313165445.2113938-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) AVR MCU have various GPIO ports. Add an 'id' property to distinct all instances. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael Rolnik --- include/hw/gpio/avr_gpio.h | 1 + hw/avr/atmega.c | 1 + hw/gpio/avr_gpio.c | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/hw/gpio/avr_gpio.h b/include/hw/gpio/avr_gpio.h index 498a7275f05..e982f627ea3 100644 --- a/include/hw/gpio/avr_gpio.h +++ b/include/hw/gpio/avr_gpio.h @@ -48,6 +48,7 @@ struct AVRGPIOState { /* PORTx data changed IRQs */ qemu_irq out[8u]; =20 + uint8_t id; }; =20 #endif /* AVR_GPIO_H */ diff --git a/hw/avr/atmega.c b/hw/avr/atmega.c index 19c3122189f..a19e3035022 100644 --- a/hw/avr/atmega.c +++ b/hw/avr/atmega.c @@ -285,6 +285,7 @@ static void atmega_realize(DeviceState *dev, Error **er= rp) devname =3D g_strdup_printf("atmega-gpio-%c", 'a' + (char)i); object_initialize_child(OBJECT(dev), devname, &s->gpio[i], TYPE_AVR_GPIO); + qdev_prop_set_uint8(DEVICE(&s->gpio[i]), "id", i); sysbus_realize(SYS_BUS_DEVICE(&s->gpio[i]), &error_abort); sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, OFFSET_DATA + mc->dev[idx].addr); diff --git a/hw/gpio/avr_gpio.c b/hw/gpio/avr_gpio.c index da34009daea..3db55bfa77f 100644 --- a/hw/gpio/avr_gpio.c +++ b/hw/gpio/avr_gpio.c @@ -113,6 +113,11 @@ static const VMStateDescription avr_gpio_vmstate =3D { }, }; =20 +static Property avr_gpio_properties[] =3D { + DEFINE_PROP_UINT8("id", AVRGPIOState, id, UINT8_MAX), + DEFINE_PROP_END_OF_LIST(), +}; + static void avr_gpio_init(Object *obj) { AVRGPIOState *s =3D AVR_GPIO(obj); @@ -123,9 +128,13 @@ static void avr_gpio_init(Object *obj) } static void avr_gpio_realize(DeviceState *dev, Error **errp) { - /* Do nothing currently */ -} + AVRGPIOState *s =3D AVR_GPIO(dev); =20 + if (s->id =3D=3D UINT8_MAX) { + error_setg(errp, "property 'id' not set"); + return; + } +} =20 static void avr_gpio_class_init(ObjectClass *klass, void *data) { @@ -134,6 +143,7 @@ static void avr_gpio_class_init(ObjectClass *klass, voi= d *data) dc->reset =3D avr_gpio_reset; dc->realize =3D avr_gpio_realize; dc->vmsd =3D &avr_gpio_vmstate; + device_class_set_props(dc, avr_gpio_properties); } =20 static const TypeInfo avr_gpio_info =3D { --=20 2.26.2 From nobody Fri Sep 20 22:16:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) client-ip=209.85.221.51; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f51.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615654521; cv=none; d=zohomail.com; s=zohoarc; b=LBWPb01ghzowgNikSnDCsQdxF8bBiYFKF0QAiQ8J4hzRcGsKKQu+pp41xEOkGuK7AD/OvNVmNHwhCIIsYamTuAd34kmM0Cf5vtAyQsyQXS6q2hRbRTz0+kMtiDSmBZrzK215PQZ75cgw1u2l6SUGE2jpT76wD/IHQoqh4VQ5iN8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615654521; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=p8kHAMKTSMM1CGT+akUwZjEeXDL24OQm1KW3vQNoEJk=; b=LbhkR7rjKV51M41CKb9ZjWbY1Q55+2jgS5BBG50I48mLrWEYmZiAAPJ5IIGCWjBILe0e0cXPI3KVa37X3TmvR5TXoCUAhMADQyfPYFZZGFqDoCkM4BNtRa31LZ7VpTtW10nuWRUjwtnWGlWxTigIeoLHuT4czi+zNjQBGyzeKNs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mx.zohomail.com with SMTPS id 161565452107789.78671434603439; Sat, 13 Mar 2021 08:55:21 -0800 (PST) Received: by mail-wr1-f51.google.com with SMTP id y16so6477979wrw.3 for ; Sat, 13 Mar 2021 08:55:20 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id n66sm6895423wmn.25.2021.03.13.08.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 08:55:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p8kHAMKTSMM1CGT+akUwZjEeXDL24OQm1KW3vQNoEJk=; b=WQ2wVFvhCDwMFRKCNYHjor7KH/1RubNYJ4McUmMA9KwlRJQb6mCuFwsQDKV4AEmhPP XhsSlzpzP30ALgCNxD8SCO1NLK9TuIWm8oqxV2b0t0KfBhkE8Ae1+ieY1DfQMX+Q18t+ MOjHAyMtA54Ys68MxGHppQTJ2HK02uwTpWg4d13HowKOmOivR4/NTLhZZT697wHaKpNt wh2rGb7ADYzpMNZ5KUvgFM7f/F0F0EHTuZ8QPy3AOLMNf4h3UvEgwmqsr1lZrtiiIupj Ak3QGjxxreeL3+h6kUcoduLDTEa+z0nAjl7TUI6b2jgn10czkIEzjN5vqRUMGZUWswUo 6kJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=p8kHAMKTSMM1CGT+akUwZjEeXDL24OQm1KW3vQNoEJk=; b=dDCI9ZLOLFeD7SMJfgDCPTQ1+BcM1LauILo2vqH1Q9hoJiVKiCJgCB0u90I5IJiUmV eP489xUXO0MYr1yqdhkRAYELCCc8o3xX5rktPYL1h3BcRfuezMZLEiVTGK2t8uTAJck5 b/ZcNV3HfBoayL/oKpKKk+u3/zEnxDzLUOWirtplkhlDR1L9CiZpVOpkOpj8kusM1s2X /YUJapzEuBsUL6gYy8XiG1lryyxA0/J0MoeY2bsmzbHgB7nwbiN5r1umeIfcATQfMErE BBZjlD3eWkIK4bgJP7cD8inRZkpwY8DSefCea2Vc3ovjHZMfogUYenHBublOgcCR+zZW 5/Og== X-Gm-Message-State: AOAM531/UAseFfZndLM0gv3tNXgjQJdrOIEf2on3Vl2QfYjwuZfMbupx XI1sVsq9U8zqLEr8ZmxqF8LmLhvSfc4Eig== X-Google-Smtp-Source: ABdhPJxuTQ4QIY8gqCbYm73GI+f85wgxSjiWkfQ7e2YJ/wKkNovOrQK/lkXNQtmcDsnIbdUxLO4eEA== X-Received: by 2002:a5d:4ac4:: with SMTP id y4mr19391582wrs.86.1615654519250; Sat, 13 Mar 2021 08:55:19 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Thomas Huth , Sarah Harris Subject: [PATCH 06/11] hw/gpio/avr_gpio: Simplify avr_gpio_write_port using extract32() Date: Sat, 13 Mar 2021 17:54:40 +0100 Message-Id: <20210313165445.2113938-7-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210313165445.2113938-1-f4bug@amsat.org> References: <20210313165445.2113938-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael Rolnik Reviewed-by: Richard Henderson --- hw/gpio/avr_gpio.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/hw/gpio/avr_gpio.c b/hw/gpio/avr_gpio.c index 3db55bfa77f..e4c7122e62c 100644 --- a/hw/gpio/avr_gpio.c +++ b/hw/gpio/avr_gpio.c @@ -39,20 +39,15 @@ static void avr_gpio_reset(DeviceState *dev) static void avr_gpio_write_port(AVRGPIOState *s, uint64_t value) { uint8_t pin; - uint8_t cur_port_val =3D s->reg.port; - uint8_t cur_ddr_val =3D s->reg.ddr; =20 for (pin =3D 0u; pin < AVR_GPIO_COUNT ; pin++) { - uint8_t cur_port_pin_val =3D cur_port_val & 0x01u; - uint8_t cur_ddr_pin_val =3D cur_ddr_val & 0x01u; - uint8_t new_port_pin_val =3D value & 0x01u; + uint8_t cur_port_pin_val =3D extract32(s->reg.port, pin, 1); + uint8_t cur_ddr_pin_val =3D extract32(s->reg.ddr, pin, 1); + uint8_t new_port_pin_val =3D extract32(value, pin, 1); =20 if (cur_ddr_pin_val && (cur_port_pin_val !=3D new_port_pin_val)) { qemu_set_irq(s->out[pin], new_port_pin_val); } - cur_port_val >>=3D 1u; - cur_ddr_val >>=3D 1u; - value >>=3D 1u; } s->reg.port =3D value & s->reg.ddr; } --=20 2.26.2 From nobody Fri Sep 20 22:16:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.52 as permitted sender) client-ip=209.85.221.52; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f52.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.52 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1615654526; cv=none; d=zohomail.com; s=zohoarc; b=BhYlFbdGOSG7AO4QzVJGy6UgXIh+KW/rAUihZPyRL5G543r7/mjucjEyHlw6Yc55o6blu1Tnu4HuKZBbPqmYt6xd4DeUie1MHXgW3MK36asm4piFgYDCpGoLFLCctVtPJ6uu/o4oWuOql57XgRlRPaPaHeC3DH4iduZb61TQ95s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615654526; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nLdAaDmbcOJIXm/9S2O8i5XmFL6rQSFPNhj2QWqHs1U=; b=DMjcsC5DhKyZ6/1ZiasurR+y8+LRdN/NnL0TeBxaRSvaqNfUgjPQy/oRYCgxEuYKMGTs/PTwIJrrmnnNOL9sjjnTaRqDweHwkcjxdzYsimpAT/F8Esn1bnfxb7gDxvIgapDECa+zxBLC5V4Hj725B0FLsatyHoNXLTqupliuSHk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.52 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by mx.zohomail.com with SMTPS id 1615654526751105.60085412107992; Sat, 13 Mar 2021 08:55:26 -0800 (PST) Received: by mail-wr1-f52.google.com with SMTP id l12so6467623wry.2 for ; Sat, 13 Mar 2021 08:55:26 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id l15sm7135538wme.43.2021.03.13.08.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 08:55:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nLdAaDmbcOJIXm/9S2O8i5XmFL6rQSFPNhj2QWqHs1U=; b=mEeHqS+DSW8bv4ypABPR4FjHEkIa2elGDPdCWQJO6bTy5peCqSgWQfgbkFqX5FQyr5 MG2hTSqRZ8wpMIijUsWGmzzRTqXrlk1ijzJ/j73XMouXE1XfcyAVKHXFHDCZX6ZytPC7 IrwTD+NcSYOn1XPVwbRS5jT2aGNqPVkvP4HusSntvpYrcECYkN43/KJx0+yf8Dc7unl/ UjKP1jBQcZCdKgxLRc6Qxkq38HMNxgpAKdUSA91ztmLiqpPGDZqOnfzZ+g4qOJZOSCop MkNLvmUneQw/dljyuHkcsMHyxiC3YdZTemwWaZwLi5R5VuR+jO1IftiIpcZcdJ3bB2Oa 2//w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=nLdAaDmbcOJIXm/9S2O8i5XmFL6rQSFPNhj2QWqHs1U=; b=nRIbSXR99IZTUFaBhmMfICtiXcmBNDt0BlznKhcgL9ojdnzg4mcaO2gqOhNw7KRVUt jWQUVmD9plChR4p1hJw1xFnvImqfIQAPDaB4aG/eoWuXNuIEc6zKmxe/N3lzwDXl+EHH ej9R8UWssz73vjQxIRLOU7r8AvHep7TKdRbZXUevHTQgARqCiUDKhcHWd42gIBl+P8E2 9H6nKaGqmXsyMj+uFPNJSa8fviSJ1EGVKSgAjjzMVB77bjwwaqpVnO+4ALZYKOKBEgRz Gae6RIeMAHSNP1uQVudvRGQ8wxbbzVF9lWE74LKOJlNC56UVdKTb+6olC99+kxPyaCv2 KQHQ== X-Gm-Message-State: AOAM5331/drQ6N788WYeUNFWOACbLKnur/kLGsTXymnTIpUtvBNz/Etr GkjFKK6Vwy1AcSRCqTPl7fg= X-Google-Smtp-Source: ABdhPJxADrIONzA4amZTxrc41hPoAMf3HnzY5MEYtihBeRzUDfN/BFTgJRpVoa+KW2pRX94T4YM8TQ== X-Received: by 2002:adf:dd47:: with SMTP id u7mr19783967wrm.13.1615654525047; Sat, 13 Mar 2021 08:55:25 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Thomas Huth , Sarah Harris , G S Niteesh Babu Subject: [PATCH 07/11] hw/gpio/avr_gpio: Add tracing for reads and writes Date: Sat, 13 Mar 2021 17:54:41 +0100 Message-Id: <20210313165445.2113938-8-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210313165445.2113938-1-f4bug@amsat.org> References: <20210313165445.2113938-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) From: G S Niteesh Babu Added tracing for gpio read, write, and update output irq. 1) trace_avr_gpio_update_ouput_irq 2) trace_avr_gpio_read 3) trace_avr_gpio_write Signed-off-by: G S Niteesh Babu Reviewed-by: Michael Rolnik Message-Id: <20210311135539.10206-3-niteesh.gs@gmail.com> [PMD: Added port_name(), display port name in trace events] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Niteesh G S --- hw/gpio/avr_gpio.c | 26 +++++++++++++++++++++----- hw/gpio/trace-events | 5 +++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/hw/gpio/avr_gpio.c b/hw/gpio/avr_gpio.c index e4c7122e62c..29252d6ccfe 100644 --- a/hw/gpio/avr_gpio.c +++ b/hw/gpio/avr_gpio.c @@ -2,6 +2,7 @@ * AVR processors GPIO registers emulation. * * Copyright (C) 2020 Heecheol Yang + * Copyright (C) 2021 Niteesh Babu G S * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -26,6 +27,12 @@ #include "hw/gpio/avr_gpio.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" +#include "trace.h" + +static char port_name(AVRGPIOState *s) +{ + return 'A' + s->id; +} =20 static void avr_gpio_reset(DeviceState *dev) { @@ -47,32 +54,41 @@ static void avr_gpio_write_port(AVRGPIOState *s, uint64= _t value) =20 if (cur_ddr_pin_val && (cur_port_pin_val !=3D new_port_pin_val)) { qemu_set_irq(s->out[pin], new_port_pin_val); + trace_avr_gpio_update_output_irq(port_name(s), pin, new_port_p= in_val); } } s->reg.port =3D value & s->reg.ddr; } static uint64_t avr_gpio_read(void *opaque, hwaddr offset, unsigned int si= ze) { + uint8_t val =3D 0; AVRGPIOState *s =3D (AVRGPIOState *)opaque; switch (offset) { case GPIO_PIN: - return s->reg.pin; + val =3D s->reg.pin; + break; case GPIO_DDR: - return s->reg.ddr; + val =3D s->reg.ddr; + break; case GPIO_PORT: - return s->reg.port; + val =3D s->reg.port; + break; default: g_assert_not_reached(); break; } - return 0; + + trace_avr_gpio_read(port_name(s), offset, val); + return val; } =20 static void avr_gpio_write(void *opaque, hwaddr offset, uint64_t value, unsigned int size) { AVRGPIOState *s =3D (AVRGPIOState *)opaque; - value =3D value & 0xF; + value =3D value & 0xFF; + + trace_avr_gpio_write(port_name(s), offset, value); switch (offset) { case GPIO_PIN: s->reg.pin =3D value; diff --git a/hw/gpio/trace-events b/hw/gpio/trace-events index 46ab9323bd0..640834597a8 100644 --- a/hw/gpio/trace-events +++ b/hw/gpio/trace-events @@ -18,3 +18,8 @@ sifive_gpio_read(uint64_t offset, uint64_t r) "offset 0x%= " PRIx64 " value 0x%" P sifive_gpio_write(uint64_t offset, uint64_t value) "offset 0x%" PRIx64 " v= alue 0x%" PRIx64 sifive_gpio_set(int64_t line, int64_t value) "line %" PRIi64 " value %" PR= Ii64 sifive_gpio_update_output_irq(int64_t line, int64_t value) "line %" PRIi64= " value %" PRIi64 + +# avr_gpio.c +avr_gpio_read(unsigned id, uint64_t offset, uint64_t r) "port %c offset 0x= %" PRIx64 " value 0x%" PRIx64 +avr_gpio_write(unsigned id, uint64_t offset, uint64_t value) "port %c offs= et 0x%" PRIx64 " value 0x%" PRIx64 +avr_gpio_update_output_irq(unsigned id, int64_t line, int64_t value) "port= %c pin %" PRIi64 " value %" PRIi64 --=20 2.26.2 From nobody Fri Sep 20 22:16:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.51 as permitted sender) client-ip=209.85.128.51; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f51.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615654531; cv=none; d=zohomail.com; s=zohoarc; b=ANE4QUIuSityGkguNUx6FdtY4fUsSjLMitemBiFNeW5b8aIu/DiXN03S5507Lpu3FA5ab0Sc3C4dYM1NbR91hcVxZSjmxX7aSsQH+stwN0Di6COOr9NFIGVvN9QR6t/1NbEa8a6p9EcxKmNSc4SVD4pB0fQcelXdN3tWTo+SDZI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615654531; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4N2eu3gmWOHHigZSbFpUzeZRPjSztx/3jXLNY7gaaEU=; b=efbBmEDkEbr31wix0A9oLHiBua5V3BRt7qXZJm6MOcUfqMkV8vtDO5Ra8xofr4KJqM8mdOAZEXidj/Q8xsQmuGYuMlakculK5jM4Hrm+OnN+sro9sJmqs+h+ZRtoCUr/jSxz18k3stXz1qJhsOfr47+mk4JTRBE7KR653a9RVLU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mx.zohomail.com with SMTPS id 1615654531767961.3917381334593; Sat, 13 Mar 2021 08:55:31 -0800 (PST) Received: by mail-wm1-f51.google.com with SMTP id g8so5585234wmd.4 for ; Sat, 13 Mar 2021 08:55:31 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id j203sm7475542wmj.40.2021.03.13.08.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 08:55:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4N2eu3gmWOHHigZSbFpUzeZRPjSztx/3jXLNY7gaaEU=; b=V7sDSGuJobQHtX6h4RhkkHETLZQncvMCEZEyQ+b992z9zDW3ZJa2RrQB7mxY2uHB1Q R7B2KRF/dHTWQodahBYKZ1VJM14epVMe9Pm2y/dhsvvuUevH0siRw/rKa/s3YQVch0NE KngjdtLbHKNxZZ4FmgSd2SxRMTmkNinqxci767WSXJW7/QkPsy7AJ63t2awDmM7JPP2I Y6hRMx1TQGV+pfIhKBN8O6411ZVwOFDn4MSwdiyDW6ws7BCnrDXNYc7IMPLxrGEd20IU hSCKi0XI1NJ/xoeYevmxm99m7hJIHo6SLf/0rt28lLTcns9zVLqBJBzspJ2+T9p628mD q2Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=4N2eu3gmWOHHigZSbFpUzeZRPjSztx/3jXLNY7gaaEU=; b=GiXpg07RIOWzmJRcQ8ojmi/ENwt1WCTuD709wVIYvNPy9CJCq1p4YJJpXoIeiOnVOE DWsh5aoldgStSlm0WM+6J8kbYNGp9BPpYQtcOF7+Ayb3cHF7rR/MdSiPNWyaJXdEgB/V LC1KFk4MW9/KwfrvHaVU9WlnmNxyUWFy06PWQW5k1GJ3bmOZOpJ/78DUM8u441vpgi++ U349Wn3+Bmzt9olopqdo6sKeip7mNaGgy5lpzQVFRg5iooqQD6GJwvai2vM9vW+Pau7O lxQHVYgbtyWH1CbGJk/EgvvAWf6XdFCnUKaVZGt7x/O/XRPYlPe0FhpuxW3pmKk1yTf5 xJwA== X-Gm-Message-State: AOAM5328d4Q1BBJdWF0Q2g2ONmyHZis15qjrPUK9BGWuf/h1an3xFcWP SfMtfzAQtd3Li5LsIgMjnrA= X-Google-Smtp-Source: ABdhPJxr8VMN/+YgaNd5mDtGIXuj8d9jm2IUtOT76YoBsLqGu8Avat490F7L76Pz+FPXBEA6q5XhNQ== X-Received: by 2002:a1c:2587:: with SMTP id l129mr2429377wml.135.1615654530067; Sat, 13 Mar 2021 08:55:30 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Thomas Huth , Sarah Harris , G S Niteesh Babu Subject: [PATCH 08/11] hw/avr/arduino: Add D13 LED Date: Sat, 13 Mar 2021 17:54:42 +0100 Message-Id: <20210313165445.2113938-9-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210313165445.2113938-1-f4bug@amsat.org> References: <20210313165445.2113938-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) From: G S Niteesh Babu Signed-off-by: G S Niteesh Babu Reviewed-by: Michael Rolnik Message-Id: <20210311135539.10206-4-niteesh.gs@gmail.com> [PMD: Added ArduinoMachineClass::d13_led_portb_bit] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Niteesh G S --- hw/avr/arduino.c | 18 ++++++++++++++++++ hw/avr/Kconfig | 1 + 2 files changed, 19 insertions(+) diff --git a/hw/avr/arduino.c b/hw/avr/arduino.c index 3ff31492fa6..73563a35d0d 100644 --- a/hw/avr/arduino.c +++ b/hw/avr/arduino.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/boards.h" +#include "hw/misc/led.h" #include "atmega.h" #include "boot.h" #include "qom/object.h" @@ -22,6 +23,8 @@ struct ArduinoMachineState { MachineState parent_obj; /*< public >*/ AtmegaMcuState mcu; + + LEDState *onboard_led; }; typedef struct ArduinoMachineState ArduinoMachineState; =20 @@ -31,6 +34,7 @@ struct ArduinoMachineClass { /*< public >*/ const char *mcu_type; uint64_t xtal_hz; + unsigned d13_led_portb_bit; /* PORTB GPIO for D13 yellow LED */ }; typedef struct ArduinoMachineClass ArduinoMachineClass; =20 @@ -49,6 +53,16 @@ static void arduino_machine_init(MachineState *machine) amc->xtal_hz, &error_abort); sysbus_realize(SYS_BUS_DEVICE(&ams->mcu), &error_abort); =20 + /* Onboard led connected to digital header PIN 13 */ + ams->onboard_led =3D led_create_simple(OBJECT(ams), + GPIO_POLARITY_ACTIVE_HIGH, + LED_COLOR_YELLOW, + "D13 LED"); + + qdev_connect_gpio_out(DEVICE(&ams->mcu.gpio[1]), + amc->d13_led_portb_bit, + qdev_get_gpio_in(DEVICE(ams->onboard_led), 0)); + if (machine->firmware) { if (!avr_load_firmware(&ams->mcu.cpu, machine, &ams->mcu.flash, machine->firmware)) { @@ -83,6 +97,7 @@ static void arduino_duemilanove_class_init(ObjectClass *o= c, void *data) mc->alias =3D "2009"; amc->mcu_type =3D TYPE_ATMEGA168_MCU; amc->xtal_hz =3D 16 * 1000 * 1000; + amc->d13_led_portb_bit =3D 5; }; =20 static void arduino_uno_class_init(ObjectClass *oc, void *data) @@ -98,6 +113,7 @@ static void arduino_uno_class_init(ObjectClass *oc, void= *data) mc->alias =3D "uno"; amc->mcu_type =3D TYPE_ATMEGA328_MCU; amc->xtal_hz =3D 16 * 1000 * 1000; + amc->d13_led_portb_bit =3D 5; }; =20 static void arduino_mega_class_init(ObjectClass *oc, void *data) @@ -113,6 +129,7 @@ static void arduino_mega_class_init(ObjectClass *oc, vo= id *data) mc->alias =3D "mega"; amc->mcu_type =3D TYPE_ATMEGA1280_MCU; amc->xtal_hz =3D 16 * 1000 * 1000; + amc->d13_led_portb_bit =3D 7; }; =20 static void arduino_mega2560_class_init(ObjectClass *oc, void *data) @@ -128,6 +145,7 @@ static void arduino_mega2560_class_init(ObjectClass *oc= , void *data) mc->alias =3D "mega2560"; amc->mcu_type =3D TYPE_ATMEGA2560_MCU; amc->xtal_hz =3D 16 * 1000 * 1000; /* CSTCE16M0V53-R0 */ + amc->d13_led_portb_bit =3D 7; }; =20 static const TypeInfo arduino_machine_types[] =3D { diff --git a/hw/avr/Kconfig b/hw/avr/Kconfig index 16a57ced11f..e0d4fc5537a 100644 --- a/hw/avr/Kconfig +++ b/hw/avr/Kconfig @@ -8,3 +8,4 @@ config AVR_ATMEGA_MCU config ARDUINO select AVR_ATMEGA_MCU select UNIMP + select LED --=20 2.26.2 From nobody Fri Sep 20 22:16:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) client-ip=209.85.221.45; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f45.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615654536; cv=none; d=zohomail.com; s=zohoarc; b=EUoyyUNXMb1qKU+6FSttx2yeJfmWeXXnExmDqNkBM+01RppgXDu+pmZ7hocrfXyRd66h4G0yYdzPYBNfxvrHkUtdFd4OctFQj97NSd5DCQQ3/KudA4rVk37hsKOuueNpMKq4TyBf+oxwVzVcynG3xtYTYBlwgFOcHUu98513xE0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615654536; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0BqwEDz4b6b8tJdYYE+yXeBUdnYk9J8p8YYQcsDJqW0=; b=f+QnB/lT0cP1Ajx3fR/1I694i1bZZXPGTpXeKvoFQzoKnBpxvwmkZcLHmqExdrZRQpID7U2ccr1jEO2Wrk1yR8n5CRYxLOXmL2KIffOAHEDJu9pWg2v3la1F8SoP1FS1xgweLRlPh9uYuCtnu+RM9vMzew+FoiouLtMCQQOO6tU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mx.zohomail.com with SMTPS id 1615654536563969.0656378805022; Sat, 13 Mar 2021 08:55:36 -0800 (PST) Received: by mail-wr1-f45.google.com with SMTP id x16so3461078wrn.4 for ; Sat, 13 Mar 2021 08:55:36 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id a3sm12473824wrt.68.2021.03.13.08.55.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 08:55:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0BqwEDz4b6b8tJdYYE+yXeBUdnYk9J8p8YYQcsDJqW0=; b=BgpoEHfIdo2X5XIwVkhI0fkq9z6hHo0v3bK5L5JVA/ba1MXqfajAMtPGxJt7+c4owE RLtbirDA4m5pJXd6vrDhSOGC9agg2xooH4sLgRmdsLyzVDIU/8EakDjLAFtfQrrcV8dv NC0Y63QRLGooHgsHuFOiILx2XzFzFikkA2AlsJ96UITPRCoU5VUFJSYRzIaExYl8cM47 104QrVBnMwZUA1hroL/5vQPyqYqWz7Y/LDPlUg7WlUln0cve9fs/4ooVw+LphcQfFE5K 8P0n4isI23Z5RX39YHtYHZaGibRvBTmQusOm6VXEvpuqHGx5WXU1zWQIbbcntEulwFRP 1rRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=0BqwEDz4b6b8tJdYYE+yXeBUdnYk9J8p8YYQcsDJqW0=; b=Stt7wIf5HhhfYqj52Nw/BJUSBHd6HevuKcdAs/NNU/GinSdC89CsgoH3WeD/USkmcB zOjXB1nGaUqUzGHeVo9AhXFFa0lD0oqhCw2pGrEMb8gVlU0aEulz3uSMysRwBjuASS6J uIOhEXrPEffOeDyplOIY1xa8Pt3KPTm4KDJrGwmhbmYFv90a/Y5pN9Nw9uCEmsC120Ig PWecMT14mwZhCcsIhyKgps0FNDUzCdKk4mjN8d/uNPwi6QTYs8qOXDjtg4SVkaORGgID kP6JirCoP83vJg9G9fijwdboo3TbpWLab9TWgIT3D6B6jU3tREEDGQmxbuqq5bma/hf+ D9Vg== X-Gm-Message-State: AOAM5308xnR5Rf8v3GmyFtnUzc//IPu2Dq2LEuhW1el73xJfmLUT7dcH G8xRWgu8mxkSc2kbcUv81BI= X-Google-Smtp-Source: ABdhPJwqs+fLPyloqslG3J+/g7eIi7wb1FieoniswFeZtmaemx2pYvXh92IaVRbmF7Zi7VHJdzhUFA== X-Received: by 2002:a5d:67c8:: with SMTP id n8mr19612070wrw.351.1615654534838; Sat, 13 Mar 2021 08:55:34 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Thomas Huth , Sarah Harris Subject: [PATCH 09/11] hw/avr/arduino: Replace magic number by gpio_port_index() call Date: Sat, 13 Mar 2021 17:54:43 +0100 Message-Id: <20210313165445.2113938-10-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210313165445.2113938-1-f4bug@amsat.org> References: <20210313165445.2113938-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) The '1' magic value means 'Port B'. Introduce and use the gpio_port_index() helper to explicit the port name. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael Rolnik --- hw/avr/arduino.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/avr/arduino.c b/hw/avr/arduino.c index 73563a35d0d..87124d17f18 100644 --- a/hw/avr/arduino.c +++ b/hw/avr/arduino.c @@ -43,6 +43,12 @@ typedef struct ArduinoMachineClass ArduinoMachineClass; DECLARE_OBJ_CHECKERS(ArduinoMachineState, ArduinoMachineClass, ARDUINO_MACHINE, TYPE_ARDUINO_MACHINE) =20 +static unsigned gpio_port_index(char c) +{ + assert(c >=3D 'A' && c < 'A' + GPIO_MAX); + return c - 'A'; +} + static void arduino_machine_init(MachineState *machine) { ArduinoMachineClass *amc =3D ARDUINO_MACHINE_GET_CLASS(machine); @@ -59,7 +65,7 @@ static void arduino_machine_init(MachineState *machine) LED_COLOR_YELLOW, "D13 LED"); =20 - qdev_connect_gpio_out(DEVICE(&ams->mcu.gpio[1]), + qdev_connect_gpio_out(DEVICE(&ams->mcu.gpio[gpio_port_index('B')]), amc->d13_led_portb_bit, qdev_get_gpio_in(DEVICE(ams->onboard_led), 0)); =20 --=20 2.26.2 From nobody Fri Sep 20 22:16:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) client-ip=209.85.221.54; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f54.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615654541; cv=none; d=zohomail.com; s=zohoarc; b=B9n8/RfW2QdUAqqrasvwN6eWURKonxsf2Lc0jlzUGvpj8GqVHUD8Ii3BuW1tzu584WCaWf0126zDOUPnwBsI7ADGWFcTdxjb2vfVMk1wHGzRRHno2e4WjpeLAKILsFOsQo7tIq6DcU3qgIk4OHTaqXz5Xk74N7YjR7AauE3vhn8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615654541; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BeHONAE/NnH8blFIpJrTu17FjI7Z++2Qdzw1aUIAB+k=; b=KMIKYFWDXF1+Ebyk9aEu6Fly/Fk2SC6OLVnRNgSY20Fip3sMRj6WnrKzrmYwA9MhwpaMdapdxmbU5Q8w1zoXA9c+1kLX32Gl61UJ0xE38s3Yk12iZGks8u7au+mf+m9Kquuxr8YrPEpMi5TkRF2XiByyNLqVdYB7Yri0iyLw0ww= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mx.zohomail.com with SMTPS id 1615654541463787.98073911537; Sat, 13 Mar 2021 08:55:41 -0800 (PST) Received: by mail-wr1-f54.google.com with SMTP id 61so3453629wrm.12 for ; Sat, 13 Mar 2021 08:55:40 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id b17sm12894175wrt.17.2021.03.13.08.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 08:55:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BeHONAE/NnH8blFIpJrTu17FjI7Z++2Qdzw1aUIAB+k=; b=Brn3OT0vtz0XBjMTS4/fLWIYplS31GE5yCrnkOZ7918Ve7JJbP/LgQ9cJ9QTMzo2xC r1QjotdlC0vVQ1ptnSoM8gP88TU9JqPkftYIrc8ojbEpxXuusnp360u6OXldm7rmikp8 W3NjjVbCFkLi1FGPWkK6U9KylgEA5nyJii/86Q9DV8VgsGV7AoJEnCo6dI1mvveHyloI 4ayoycxcCdnWMLx39nm2z81Ot6/e465WkgfkZowfroK+iJfgCljv6vKAAIb0427Z1G5T in5hobkwBn1oTeXgwqb1buCVhV1LjGUk6UdDIg/Xp3ofJO9JVNRN8cNDpAN3C3/mYyO1 kazw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BeHONAE/NnH8blFIpJrTu17FjI7Z++2Qdzw1aUIAB+k=; b=TBGmPUmyJQ3au/fbGkCqCE1hXAjW9lipS2MDJQRa+2JEWNKvQ8i20oM4ErzZfUHcFZ 17mw+/UxxeAUzgxUK3rB+qHDDCJyVDZLUIlAR0mSzKOpqnvG7L/qq258+rKxUuxctQpg q8YNfYWM6qPZaMzix80A+u2f2xQgfj67p6dqx15GLuGNsy6CS0fvHaJw2ml3smj2+CSu 5rMHMekdHOiMLyGoZQRkPjDB6x4PSkuoUESQpzAg+DTp9tsdr9kWlvL7wTKYAF/7i63/ yWToXsU8LK/poV/udu6ZiXTS+EIs1avG/fDnxT5WJtmMgFtXqTte8c9YTkKUlIuty5Jv FwEg== X-Gm-Message-State: AOAM533InK9fJ9jrJP7BAOwTvohBOuva15ChKxGonKvj0QaqsBlko2PS fjPJCcCriXrLww+qawHtVn0= X-Google-Smtp-Source: ABdhPJxE0ft8/ItcTAw1QrvKNlRKYGbk+0FhTD6/d8zIS4xKNEf7MYcm2cop2114uBbCMkBOvgm66A== X-Received: by 2002:adf:de92:: with SMTP id w18mr19396589wrl.217.1615654539784; Sat, 13 Mar 2021 08:55:39 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Thomas Huth , Sarah Harris , Lichang Zhao , David Edmondson Subject: [PATCH 10/11] target/avr: Fix some comment spelling errors Date: Sat, 13 Mar 2021 17:54:44 +0100 Message-Id: <20210313165445.2113938-11-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210313165445.2113938-1-f4bug@amsat.org> References: <20210313165445.2113938-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) From: Lichang Zhao I found that there are many spelling errors in the comments of qemu/target/= avr. I used spellcheck to check the spelling errors and found some errors in the= folder. Signed-off-by: Lichang Zhao Reviewed-by: David Edmondson Reviewed-by: Philippe Mathieu-Daude Message-Id: <20201009064449.2336-12-zhaolichang@huawei.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael Rolnik --- target/avr/helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/avr/helper.c b/target/avr/helper.c index 65880b9928c..b4532de2523 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -98,7 +98,7 @@ int avr_cpu_memory_rw_debug(CPUState *cs, vaddr addr, uin= t8_t *buf, =20 hwaddr avr_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) { - return addr; /* I assume 1:1 address correspondance */ + return addr; /* I assume 1:1 address correspondence */ } =20 bool avr_cpu_tlb_fill(CPUState *cs, vaddr address, int size, @@ -299,7 +299,7 @@ void helper_outb(CPUAVRState *env, uint32_t port, uint3= 2_t data) } =20 /* - * this function implements LD instruction when there is a posibility to = read + * this function implements LD instruction when there is a possibility to= read * from a CPU register */ target_ulong helper_fullrd(CPUAVRState *env, uint32_t addr) @@ -323,7 +323,7 @@ target_ulong helper_fullrd(CPUAVRState *env, uint32_t a= ddr) } =20 /* - * this function implements ST instruction when there is a posibility to = write + * this function implements ST instruction when there is a possibility to= write * into a CPU register */ void helper_fullwr(CPUAVRState *env, uint32_t data, uint32_t addr) --=20 2.26.2 From nobody Fri Sep 20 22:16:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.41 as permitted sender) client-ip=209.85.221.41; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f41.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615654546; cv=none; d=zohomail.com; s=zohoarc; b=k956rKnwVXsQQKqKeTyTMc6JrI1XPFoJe6bn6TfwLWupcXGwGJjF6PNwJ1sJUuWqdvAIEqRsm/bqB4oJTS7UABvmdni3kFBHSWm2mziqMFwSJMOF8tudk3uQK3CSMXpF/RzSdaCnNB4IroVmCXXv8VehQMkBrIPyKcOsgZTvl4w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615654546; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rQ1byxN4phqb2WGKGojssryaH6KbeKgPExH0MIQ80UI=; b=nmOZqc4CYWBvUtOGn25kLa/GLpVcfZB8WsDfLqG0w7QxuOQR4s/P2tEuSwQ0LtVEWn1Vnf/JiAKFPD9nZglIv9nq69ICoJQYi+2dQwgoTBdCoQaZ4NHQxqRJTDoTzqdJul/ErXn7V6MIUc/uKhXfeM1U+yZ1CoUribK4pETLXDw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mx.zohomail.com with SMTPS id 1615654546525783.1064410135316; Sat, 13 Mar 2021 08:55:46 -0800 (PST) Received: by mail-wr1-f41.google.com with SMTP id a18so6435257wrc.13 for ; Sat, 13 Mar 2021 08:55:45 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id y205sm8413084wmc.18.2021.03.13.08.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 08:55:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rQ1byxN4phqb2WGKGojssryaH6KbeKgPExH0MIQ80UI=; b=ACNRQD21GDbVwPkqeKjs0DOiaC2nHoRrRxVGIQqa9axb3Dg4Q1omtmkbESBU6n4qb5 GfwI+lU0EApSFvAPX0KlM2vPgQag2XPKWuyM4fGBX+XSXKjUXRFI09FoZZiRBwtxb1G6 VdEwGZJsKA8waaCj1ZmMIzxFoXDkKk3vAsJ1L9lGmwp8V3+lPSVHy3UBJFNkepXPR2Vg b4ejr6S9n1eJq2avpzTyiwraBkntxS/VvEZJLhGMGI2ZOyP1MImHJOBo6INwrDmYQsS3 dmqZHzuSbk0RaiXLDydLKq4nwqu9VcgnGJtO4sfzbi5YI54okklbklUBSTxaHrcUG61g pNOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=rQ1byxN4phqb2WGKGojssryaH6KbeKgPExH0MIQ80UI=; b=DcCdOQ9h1K/fHIdy2jBEF7IFj8NXMXMpyxBRv4eEBD+24W/pWlnqu6Cm5Nx2U3fyyr 8A9/CsLbagrpzAiqWmlb7RYk4cE7o4flOhCxCpEboyj9HMjcOjPIWm0lYOs7bTs5CtPo XWuRlauH+xC04zmXpQ8dQpI8uZoQkHw3XUusYXho7Ai2iHqCDvLTyg0cVCrvKLDYYxxO jOmD3L/JLNA/Q9UExdt4J8QQ8TSXatIdmhqXz11mpY26guaZNsZtqEgH1xyQY3x77ggJ I2tUoVa7Ttjmbyffe1DV83fyyYHSPS7YInjUvwalwcxdyY1w+rgcll+aU4ygIWkVku82 mFlw== X-Gm-Message-State: AOAM533Sl32dS3haeW7rB8s0RINRNyw2/NGA3TOWuIEGFcc4i2cobVM1 b3nHMgsXD8hzTief7WOtr2/4568LRzuZMA== X-Google-Smtp-Source: ABdhPJxsbgcMVVzmUBxpVi23GMcku7SOffPXglTywGuleW4rpBmfhg3Zwnt2wXMnaUMhhtXYx3D+Eg== X-Received: by 2002:adf:dcd2:: with SMTP id x18mr20258107wrm.361.1615654544787; Sat, 13 Mar 2021 08:55:44 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Thomas Huth , Sarah Harris , Ivanov Arkasha Subject: [PATCH 11/11] target/avr: Fix interrupt execution Date: Sat, 13 Mar 2021 17:54:45 +0100 Message-Id: <20210313165445.2113938-12-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210313165445.2113938-1-f4bug@amsat.org> References: <20210313165445.2113938-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) From: Ivanov Arkasha Only one interrupt is in progress at the moment. It is only necessary to set to reset interrupt_request after all interrupts have been executed. Signed-off-by: Ivanov Arkasha Message-Id: <20210312164754.18437-1-arkaisp2021@gmail.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael Rolnik --- target/avr/helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/avr/helper.c b/target/avr/helper.c index b4532de2523..35e10195940 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -49,7 +49,9 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_r= equest) cc->tcg_ops->do_interrupt(cs); =20 env->intsrc &=3D env->intsrc - 1; /* clear the interrupt */ - cs->interrupt_request &=3D ~CPU_INTERRUPT_HARD; + if (!env->intsrc) { + cs->interrupt_request &=3D ~CPU_INTERRUPT_HARD; + } =20 ret =3D true; } --=20 2.26.2