From: Fabio Urquiza <flus@cesar.org.br>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v1 1/2] i2c: Add flag to NACK I2C transfers when busy
Date: Tue, 29 Nov 2016 16:30:51 -0300 [thread overview]
Message-ID: <20161129193052.11736-2-flus@cesar.org.br> (raw)
In-Reply-To: <20161129193052.11736-1-flus@cesar.org.br>
Add a busy flag on the I2CSlave struct which the device could set to NACK
I2C transfer requests during the execution of the event handling function.
If the busy flag is set, i2c_start_transfer() shall return 1.
Signed-off-by: Fabio Urquiza <flus@cesar.org.br>
---
hw/i2c/core.c | 3 +++
include/hw/i2c/i2c.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/hw/i2c/core.c b/hw/i2c/core.c
index abd4c4c..f36020f 100644
--- a/hw/i2c/core.c
+++ b/hw/i2c/core.c
@@ -142,6 +142,9 @@ int i2c_start_transfer(I2CBus *bus, uint8_t address, int recv)
start condition. */
if (sc->event) {
sc->event(node->elt, recv ? I2C_START_RECV : I2C_START_SEND);
+ if (node->elt->busy) {
+ return 1;
+ }
}
}
return 0;
diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
index c4085aa..9c6b1ce 100644
--- a/include/hw/i2c/i2c.h
+++ b/include/hw/i2c/i2c.h
@@ -48,6 +48,7 @@ struct I2CSlave
/* Remaining fields for internal use by the I2C code. */
uint8_t address;
+ uint8_t busy;
};
I2CBus *i2c_init_bus(DeviceState *parent, const char *name);
--
2.8.3
next prev parent reply other threads:[~2016-11-29 19:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-23 19:46 [Qemu-devel] [PATCH 0/2] Add Atmel I2C TPM AT97SC3204T emulated device Fabio Urquiza
2016-11-23 19:46 ` [Qemu-devel] [PATCH 1/2] i2c: Add flag to NACK I2C transfers when busy Fabio Urquiza
2016-11-23 19:46 ` [Qemu-devel] [PATCH 2/2] tpm: Add TPM I2C Atmel frontend Fabio Urquiza
2016-11-29 13:30 ` [Qemu-devel] [PATCH 0/2] Add Atmel I2C TPM AT97SC3204T emulated device no-reply
2016-11-29 19:30 ` [Qemu-devel] [PATCH v1 " Fabio Urquiza
2016-11-29 19:30 ` Fabio Urquiza [this message]
2016-11-29 19:30 ` [Qemu-devel] [PATCH v1 2/2] tpm: Add TPM I2C Atmel frontend Fabio Urquiza
2016-12-16 17:35 ` [Qemu-devel] [PATCH v1 0/2] Add Atmel I2C TPM AT97SC3204T emulated device Peter Maydell
2016-12-19 1:47 ` Alastair D'Silva
2016-12-19 13:55 ` Corey Minyard
2016-12-19 15:31 ` Peter Maydell
2016-12-19 16:20 ` Corey Minyard
2016-12-20 21:26 ` [Qemu-devel] [PATCH] i2c: Allow I2C devices to NAK start events minyard
2017-01-05 15:42 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161129193052.11736-2-flus@cesar.org.br \
--to=flus@cesar.org.br \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).