Move common USB stuff out of platform header files.
This commit is contained in:
parent
5eff0ab5d6
commit
476f83b69a
|
@ -37,17 +37,12 @@
|
|||
#include "gpio.h"
|
||||
#include "morse.h"
|
||||
|
||||
#define CDCACM_PACKET_SIZE 64
|
||||
#define PLATFORM_HAS_TRACESWO
|
||||
#define BOARD_IDENT "Black Magic Probe (F4Discovery), (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT_DFU "Black Magic (Upgrade) for F4Discovery, (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define DFU_IDENT "Black Magic Firmware Upgrade (F4Discovery"
|
||||
#define DFU_IFACE_STRING "@Internal Flash /0x08000000/1*016Ka,3*016Kg,1*064Kg,7*128Kg"
|
||||
|
||||
extern usbd_device *usbdev;
|
||||
#define CDCACM_GDB_ENDPOINT 1
|
||||
#define CDCACM_UART_ENDPOINT 3
|
||||
|
||||
/* Important pin mappings for STM32 implementation:
|
||||
*
|
||||
* LED0 = PD12 (Green LED : Running)
|
||||
|
@ -186,15 +181,6 @@ static inline int platform_hwversion(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* <cdcacm.c> */
|
||||
void cdcacm_init(void);
|
||||
/* Returns current usb configuration, or 0 if not configured. */
|
||||
int cdcacm_get_config(void);
|
||||
int cdcacm_get_dtr(void);
|
||||
|
||||
/* <platform.h> */
|
||||
void uart_usb_buf_drain(uint8_t ep);
|
||||
|
||||
/* Use newlib provided integer only stdio functions */
|
||||
#define sscanf siscanf
|
||||
#define sprintf siprintf
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <libopencm3/stm32/f1/adc.h>
|
||||
|
||||
#include "jtag_scan.h"
|
||||
#include "cdcacm.h"
|
||||
#include "usbuart.h"
|
||||
#include "morse.h"
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "gpio.h"
|
||||
#include "morse.h"
|
||||
|
||||
#define CDCACM_PACKET_SIZE 64
|
||||
#define PLATFORM_HAS_TRACESWO
|
||||
#define PLATFORM_HAS_POWER_SWITCH
|
||||
#define BOARD_IDENT "Black Magic Probe"
|
||||
|
@ -48,10 +47,6 @@
|
|||
#define DFU_IFACE_STRING "@Internal Flash /0x08000000/8*001Ka,120*001Kg"
|
||||
#define UPD_IFACE_STRING "@Internal Flash /0x08000000/8*001Kg"
|
||||
|
||||
extern usbd_device *usbdev;
|
||||
#define CDCACM_GDB_ENDPOINT 1
|
||||
#define CDCACM_UART_ENDPOINT 3
|
||||
|
||||
/* Important pin mappings for STM32 implementation:
|
||||
*
|
||||
* LED0 = PB2 (Yellow LED : Running)
|
||||
|
@ -185,15 +180,6 @@ void platform_set_timeout(uint32_t ms);
|
|||
bool platform_timeout_expired(void);
|
||||
void platform_delay(uint32_t delay);
|
||||
|
||||
/* <cdcacm.c> */
|
||||
void cdcacm_init(void);
|
||||
/* Returns current usb configuration, or 0 if not configured. */
|
||||
int cdcacm_get_config(void);
|
||||
int cdcacm_get_dtr(void);
|
||||
|
||||
/* <platform.h> */
|
||||
void uart_usb_buf_drain(uint8_t ep);
|
||||
|
||||
/* Use newlib provided integer only stdio functions */
|
||||
#define sscanf siscanf
|
||||
#define sprintf siprintf
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "gdb_packet.h"
|
||||
#include "gpio.h"
|
||||
|
||||
#define CDCACM_PACKET_SIZE 64
|
||||
#define BOARD_IDENT "Black Magic Probe (STLINK), (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT_DFU "Black Magic (Upgrade) for STLink/Discovery, (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT_UPD "Black Magic (DFU Upgrade) for STLink/Discovery, (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
|
@ -45,10 +44,6 @@
|
|||
#define DFU_IFACE_STRING "@Internal Flash /0x08000000/8*001Ka,56*001Kg"
|
||||
#define UPD_IFACE_STRING "@Internal Flash /0x08000000/8*001Kg"
|
||||
|
||||
extern usbd_device *usbdev;
|
||||
#define CDCACM_GDB_ENDPOINT 1
|
||||
#define CDCACM_UART_ENDPOINT 3
|
||||
|
||||
/* Important pin mappings for STM32 implementation:
|
||||
*
|
||||
* LED0 = PB2 (Yellow LED : Running)
|
||||
|
@ -161,15 +156,6 @@ const char *platform_target_voltage(void);
|
|||
void platform_delay(uint32_t delay);
|
||||
void platform_srst_set_val(bool assert);
|
||||
|
||||
/* <cdcacm.c> */
|
||||
void cdcacm_init(void);
|
||||
/* Returns current usb configuration, or 0 if not configured. */
|
||||
int cdcacm_get_config(void);
|
||||
int cdcacm_get_dtr(void);
|
||||
|
||||
/* <platform.h> */
|
||||
void uart_usb_buf_drain(uint8_t ep);
|
||||
|
||||
/* Use newlib provided integer only stdio functions */
|
||||
#define sscanf siscanf
|
||||
#define sprintf siprintf
|
||||
|
|
|
@ -35,10 +35,11 @@
|
|||
|
||||
#include "platform.h"
|
||||
#include "gdb_if.h"
|
||||
#include "cdcacm.h"
|
||||
#if defined(PLATFORM_HAS_TRACESWO)
|
||||
#include <traceswo.h>
|
||||
#include "traceswo.h"
|
||||
#endif
|
||||
#include <usbuart.h>
|
||||
#include "usbuart.h"
|
||||
|
||||
#define DFU_IF_NO 4
|
||||
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* This file is part of the Black Magic Debug project.
|
||||
*
|
||||
* Copyright (C) 2015 Black Sphere Technologies Ltd.
|
||||
* Written by Gareth McMullin <gareth@blacksphere.co.nz>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* This file implements a the USB Communications Device Class - Abstract
|
||||
* Control Model (CDC-ACM) as defined in CDC PSTN subclass 1.2.
|
||||
* A Device Firmware Upgrade (DFU 1.1) class interface is provided for
|
||||
* field firmware upgrade.
|
||||
*
|
||||
* The device's unique id is used as the USB serial number string.
|
||||
*/
|
||||
#ifndef __CDCACM_H
|
||||
#define __CDCACM_H
|
||||
|
||||
#include <libopencm3/usb/usbd.h>
|
||||
|
||||
#define CDCACM_PACKET_SIZE 64
|
||||
|
||||
#define CDCACM_GDB_ENDPOINT 1
|
||||
#define CDCACM_UART_ENDPOINT 3
|
||||
|
||||
extern usbd_device *usbdev;
|
||||
|
||||
void cdcacm_init(void);
|
||||
/* Returns current usb configuration, or 0 if not configured. */
|
||||
int cdcacm_get_config(void);
|
||||
int cdcacm_get_dtr(void);
|
||||
|
||||
#endif
|
|
@ -23,8 +23,7 @@
|
|||
* uses the USB CDC-ACM device bulk endpoints to implement the channel.
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include <libopencm3/usb/usbd.h>
|
||||
|
||||
#include "cdcacm.h"
|
||||
#include "gdb_if.h"
|
||||
|
||||
static uint32_t count_out;
|
||||
|
|
|
@ -37,10 +37,9 @@
|
|||
#include <libopencm3/stm32/timer.h>
|
||||
#include <libopencm3/stm32/f1/rcc.h>
|
||||
|
||||
#include <libopencm3/usb/usbd.h>
|
||||
|
||||
#include <string.h>
|
||||
#include "platform.h"
|
||||
#include "cdcacm.h"
|
||||
|
||||
void traceswo_init(void)
|
||||
{
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
#include <libopencm3/usb/usbd.h>
|
||||
#include <libopencm3/usb/cdc.h>
|
||||
|
||||
#include <platform.h>
|
||||
#include "platform.h"
|
||||
#include "cdcacm.h"
|
||||
|
||||
#define USBUART_TIMER_FREQ_HZ 1000000U /* 1us per tick */
|
||||
#define USBUART_RUN_FREQ_HZ 5000U /* 200us (or 100 characters at 2Mbps) */
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "gdb_packet.h"
|
||||
#include "gpio.h"
|
||||
|
||||
#define CDCACM_PACKET_SIZE 64
|
||||
#define BOARD_IDENT "Black Magic Probe (SWLINK), (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT_DFU "Black Magic (Upgrade), STM8S Discovery, (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
#define BOARD_IDENT_UPD "Black Magic (DFU Upgrade), STM8S Discovery, (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")"
|
||||
|
@ -45,10 +44,6 @@
|
|||
#define DFU_IFACE_STRING "@Internal Flash /0x08000000/8*001Ka,56*001Kg"
|
||||
#define UPD_IFACE_STRING "@Internal Flash /0x08000000/8*001Kg"
|
||||
|
||||
extern usbd_device *usbdev;
|
||||
#define CDCACM_GDB_ENDPOINT 1
|
||||
#define CDCACM_UART_ENDPOINT 3
|
||||
|
||||
/* Pin mappings:
|
||||
*
|
||||
* nTRST = PB1
|
||||
|
@ -158,15 +153,6 @@ int platform_init(void);
|
|||
const char *platform_target_voltage(void);
|
||||
void platform_delay(uint32_t delay);
|
||||
|
||||
/* <cdcacm.c> */
|
||||
void cdcacm_init(void);
|
||||
/* Returns current usb configuration, or 0 if not configured. */
|
||||
int cdcacm_get_config(void);
|
||||
int cdcacm_get_dtr(void);
|
||||
|
||||
/* <platform.h> */
|
||||
void uart_usb_buf_drain(uint8_t ep);
|
||||
|
||||
/* Use newlib provided integer only stdio functions */
|
||||
#define sscanf siscanf
|
||||
#define sprintf siprintf
|
||||
|
|
Loading…
Reference in New Issue