Received: from eggs.gnu.org ([2001:4830:134:3::10]:39641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBzi9-0005Fq-En for qemu-devel@nongnu.org; Mon, 06 Jul 2015 02:17:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZBzi8-0004yO-HM for qemu-devel@nongnu.org; Mon, 06 Jul 2015 02:17:01 -0400 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]:34876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBzi8-0004yB-AP for qemu-devel@nongnu.org; Mon, 06 Jul 2015 02:17:00 -0400 Received: by pactm7 with SMTP id tm7so90015536pac.2 for ; Sun, 05 Jul 2015 23:16:59 -0700 (PDT) From: Serge Vakulenko Date: Sun, 5 Jul 2015 23:15:00 -0700 Message-Id: <1436163304-6167-13-git-send-email-serge.vakulenko@gmail.com> In-Reply-To: <1436163304-6167-1-git-send-email-serge.vakulenko@gmail.com> References: <1436163304-6167-1-git-send-email-serge.vakulenko@gmail.com> Subject: [Qemu-devel] [PATCH pic32 v3 12/16] pic32: add file pic32_gpio.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Serge Vakulenko , Leon Alrae , Aurelien Jarno Implement pic32 generic input/output ports. Signed-off-by: Serge Vakulenko --- hw/mips/pic32_gpio.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 hw/mips/pic32_gpio.c diff --git a/hw/mips/pic32_gpio.c b/hw/mips/pic32_gpio.c new file mode 100644 index 0000000..670d2b6 --- /dev/null +++ b/hw/mips/pic32_gpio.c @@ -0,0 +1,39 @@ +/* + * GPIO ports. + * + * Copyright (C) 2015 Serge Vakulenko + * + * Permission to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that the copyright notice and this + * permission notice and warranty disclaimer appear in supporting + * documentation, and that the name of the author not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * The author disclaim all warranties with regard to this + * software, including all implied warranties of merchantability + * and fitness. In no event shall the author be liable for any + * special, indirect or consequential damages or any damages + * whatsoever resulting from loss of use, data or profits, whether + * in an action of contract, negligence or other tortious action, + * arising out of or in connection with the use or performance of + * this software. + */ +#include "hw/hw.h" +#include "pic32_peripherals.h" + +#include "pic32mz.h" + +void pic32_gpio_write(pic32_t *s, int gpio_port, unsigned lat_value) +{ + /* Control SD card 0 */ + if (gpio_port == s->sdcard[0].gpio_port && s->sdcard[0].gpio_cs) { + pic32_sdcard_select(s, 0, !(lat_value & s->sdcard[0].gpio_cs)); + } + /* Control SD card 1 */ + if (gpio_port == s->sdcard[1].gpio_port && s->sdcard[0].gpio_cs) { + pic32_sdcard_select(s, 1, !(lat_value & s->sdcard[1].gpio_cs)); + } +} -- 2.2.2