common: Begun splitting the USB code into more sensibly named implementation files

This commit is contained in:
dragonmux 2022-08-10 05:30:28 +01:00 committed by Piotr Esden-Tempski
parent f157eefaf0
commit 105f6a3dce
6 changed files with 87 additions and 12 deletions

View File

@ -64,7 +64,6 @@ SRC = \
target.c \
target_probe.c
include $(PLATFORM_DIR)/Makefile.inc
ifneq ($(PC_HOSTED),1)
@ -91,10 +90,8 @@ endif
ifdef PC_HOSTED
CFLAGS += -DPC_HOSTED=1
else
SRC += swdptap.c jtagtap.c
CFLAGS += -DPC_HOSTED=0
VPATH += platforms/common
CFLAGS += -Iplatforms/common
include platforms/common/Makefile.inc
endif
ifeq ($(ENABLE_RTT), 1)
@ -150,6 +147,9 @@ all_platforms:
$(MAKE) clean ;\
for i in platforms/*/Makefile.inc ; do \
export DIRNAME=`dirname $$i` ;\
if [ "$$DIRNAME" = "platforms/common" ]; then \
continue; \
fi; \
export PROBE_HOST=`basename $$DIRNAME` ;\
export CFLAGS=-Werror ;\
echo "Building for hardware platform: $$PROBE_HOST" ;\

View File

@ -0,0 +1,27 @@
#
# This file is part of the Black Magic Debug project.
#
# Copyright (C) 2022 1BitSquared <info@1bitsquared.com>
# Written by Rachel Mant <git@dragonmux.network>
#
# 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 3 of the License, or
# (at your option) any later version.
#
# 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 <http://www.gnu.org/licenses/>.
#
VPATH += platforms/common
CFLAGS += -Iplatforms/common
SRC += \
jtagtap.c \
swdptap.c \
usb.c \

View File

@ -589,8 +589,3 @@ void cdcacm_init(void)
nvic_set_priority(USB_IRQ, IRQ_PRI_USB);
nvic_enable_irq(USB_IRQ);
}
void USB_ISR(void)
{
usbd_poll(usbdev);
}

View File

@ -28,7 +28,7 @@
#ifndef __CDCACM_H
#define __CDCACM_H
#include <libopencm3/usb/usbd.h>
#include "usb.h"
#define CDCACM_PACKET_SIZE 64
@ -36,8 +36,6 @@
#define CDCACM_UART_ENDPOINT 3
#define TRACE_ENDPOINT 5
extern usbd_device *usbdev;
void cdcacm_init(void);
/* Returns current usb configuration, or 0 if not configured. */
int cdcacm_get_config(void);

View File

@ -0,0 +1,27 @@
/*
* This file is part of the Black Magic Debug project.
*
* Copyright (C) 2022 1BitSquared <info@1bitsquared.com>
* Written by Rachel Mant <git@dragonmux.network>
*
* 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 3 of the License, or
* (at your option) any later version.
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "general.h"
#include "usb.h"
void USB_ISR(void)
{
usbd_poll(usbdev);
}

View File

@ -0,0 +1,28 @@
/*
* This file is part of the Black Magic Debug project.
*
* Copyright (C) 2022 1BitSquared <info@1bitsquared.com>
* Written by Rachel Mant <git@dragonmux.network>
*
* 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 3 of the License, or
* (at your option) any later version.
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef USB_H
#define USB_H
#include <libopencm3/usb/usbd.h>
extern usbd_device *usbdev;
#endif /*USB_H*/