From 6dcb4dd0279ba5f4683e1bb44214a2d3156e7192 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 2 May 2017 15:05:15 +0900 Subject: [PATCH] Add usb-emu.c. Signed-off-by: NIIBE Yutaka --- emulation/Makefile | 4 +- emulation/usb-emu.c | 103 +++++++++++++++++++++++++++++++++++++++ emulation/usbip-server.c | 16 +++--- 3 files changed, 113 insertions(+), 10 deletions(-) create mode 100644 emulation/usb-emu.c diff --git a/emulation/Makefile b/emulation/Makefile index bfa6499..23a61df 100644 --- a/emulation/Makefile +++ b/emulation/Makefile @@ -1,4 +1,4 @@ -SRCS = usbip-server.c +SRCS = usbip-server.c usb-emu.c OBJS = $(SRCS:.c=.o) TARGET=gnuk_emulation GNUKDIR=../src @@ -10,7 +10,7 @@ GNUK_SRCS = main.c call-rsa.c \ modp256k1.c jpc_p256k1.c ec_p256k1.c call-ec_p256k1.c \ mod25638.c ecc-edwards.c ecc-mont.c sha512.c \ random.c neug.c sha256.c -USB_SRCS=usb_desc.c usb_ctrl.c +USB_SRCS=usb_desc.c usb_ctrl.c GNUK_CSRC = $(addprefix $(GNUKDIR)/, $(GNUK_SRCS)) GNUK_OBJS = $(notdir $(GNUK_CSRC:.c=.o)) diff --git a/emulation/usb-emu.c b/emulation/usb-emu.c new file mode 100644 index 0000000..c6d9a39 --- /dev/null +++ b/emulation/usb-emu.c @@ -0,0 +1,103 @@ +/* + * usb-emu.c - USB driver for USBIP emulation + * + * Copyright (C) 2017 Flying Stone Technology + * Author: NIIBE Yutaka + * + * This file is a part of Chopstx, a thread library for embedded. + * + * Chopstx 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 3 of the License, or + * (at your option) any later version. + * + * Chopstx 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 +#include + +#include "../chopstx/usb_lld.h" + +int +usb_lld_ctrl_ack (struct usb_dev *dev) +{ + return 0; +} + +int +usb_lld_ctrl_recv (struct usb_dev *dev, void *p, size_t len) +{ + return 0; +} + +int +usb_lld_ctrl_send (struct usb_dev *dev, const void *buf, size_t buflen) +{ + return 0; +} + +uint8_t +usb_lld_current_configuration (struct usb_dev *dev) +{ + return 0; +} + +void +usb_lld_prepare_shutdown (void) +{ +} + +void +usb_lld_ctrl_error (struct usb_dev *dev) +{ +} + +void +usb_lld_reset (struct usb_dev *dev, uint8_t feature) +{ +} + +void +usb_lld_set_configuration (struct usb_dev *dev, uint8_t config) +{ +} + + + +void +usb_lld_shutdown (void) +{ +} + +void +usb_lld_setup_endpoint (int ep_num, int ep_type, int ep_kind, + int ep_rx_addr, int ep_tx_addr, + int ep_rx_memory_size) +{ +} + +void +usb_lld_stall (int ep_num) +{ +} + + +void +usb_lld_stall_tx (int ep_num) +{ + usb_lld_stall (ep_num); +} + +void +usb_lld_stall_rx (int ep_num) +{ + usb_lld_stall (ep_num); +} diff --git a/emulation/usbip-server.c b/emulation/usbip-server.c index 26b0af2..2e179c9 100644 --- a/emulation/usbip-server.c +++ b/emulation/usbip-server.c @@ -1,20 +1,20 @@ -/* -*- coding: utf-8 -*- +/* * usbip-server.c - USB Device Emulation by USBIP Protocol * - * Copyright (C) 2017 Free Software Initiative of Japan + * Copyright (C) 2017 Flying Stone Technology * Author: NIIBE Yutaka * - * This file is a part of Gnuk, a GnuPG USB Token implementation. + * This file is a part of Chopstx, a thread library for embedded. * - * Gnuk is free software: you can redistribute it and/or modify it + * Chopstx 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 3 of the License, or * (at your option) any later version. * - * Gnuk 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. + * Chopstx 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 .