Skip to content

Commit

Permalink
Upload program of USB-MIDI.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joey-Li authored and Joey committed Nov 15, 2018
0 parents commit 070e440
Show file tree
Hide file tree
Showing 445 changed files with 234,779 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# USB-MIDI

Modified sample code of STM32_USB-Host-Device_Lib_V2.1.0. Refer to STM32 website for details.
Created USB-MIDI example from USB HID Sample.

Verified functions on STM32F2XXX platform.

STM32_USB-Host-Device_Lib_V2.1.0/Project/USB_Device_Examples/MIDI/src/stm32fxxx_it.c
STM32_USB-Host-Device_Lib_V2.1.0/Project/USB_Device_Examples/MIDI/src/usbd_desc.c
STM32_USB-Host-Device_Lib_V2.1.0/Project/USB_Device_Examples/MIDI/src/usbd_usr.c
STM32_USB-Host-Device_Lib_V2.1.0/Project/USB_Device_Examples/MIDI/inc/usbd_conf.h
STM32_USB-Host-Device_Lib_V2.1.0/Project/USB_Device_Examples/MIDI/inc/usb_conf.h

Note: Modified Core Libraries in order to get pass from Diagnostic Test Suite of USB30CV
STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_req.c
Binary file not shown.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/**
******************************************************************************
* @file system_stm32f10x.h
* @author MCD Application Team
* @version V3.6.1
* @date 05-March-2012
* @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/

/** @addtogroup CMSIS
* @{
*/

/** @addtogroup stm32f10x_system
* @{
*/

/**
* @brief Define to prevent recursive inclusion
*/
#ifndef __SYSTEM_STM32F10X_H
#define __SYSTEM_STM32F10X_H

#ifdef __cplusplus
extern "C" {
#endif

/** @addtogroup STM32F10x_System_Includes
* @{
*/

/**
* @}
*/


/** @addtogroup STM32F10x_System_Exported_types
* @{
*/

extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */

/**
* @}
*/

/** @addtogroup STM32F10x_System_Exported_Constants
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F10x_System_Exported_Macros
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F10x_System_Exported_Functions
* @{
*/

extern void SystemInit(void);
extern void SystemCoreClockUpdate(void);
/**
* @}
*/

#ifdef __cplusplus
}
#endif

#endif /*__SYSTEM_STM32F10X_H */

/**
* @}
*/

/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@


;; NOTE: To allow the use of this file for both ARMv6M and ARMv7M,
;; we will only use 16-bit Thumb intructions.

.extern _lc_ub_stack ; usr/sys mode stack pointer
.extern _lc_ue_stack ; symbol required by debugger
.extern _lc_ub_table ; ROM to RAM copy table
.extern main
.extern _Exit
.extern exit
.weak exit
.global __get_argcv
.weak __get_argcv
.extern __argcvbuf
.weak __argcvbuf
;;.extern __init_hardware
.extern SystemInit
.if @defined('__PROF_ENABLE__')
.extern __prof_init
.endif
.if @defined('__POSIX__')
.extern posix_main
.extern _posix_boot_stack_top
.endif

.global _START

.section .text.cstart

.thumb
_START:
;; anticipate possible ROM/RAM remapping
;; by loading the 'real' program address
ldr r1,=_Next
bx r1
_Next:
;; initialize the stack pointer
ldr r1,=_lc_ub_stack ; TODO: make this part of the vector table
mov sp,r1

;; call a user function which initializes function.
bl SystemInit

;; copy initialized sections from ROM to RAM
;; and clear uninitialized data sections in RAM

ldr r3,=_lc_ub_table
movs r0,#0
cploop:
ldr r4,[r3,#0] ; load type
ldr r5,[r3,#4] ; dst address
ldr r6,[r3,#8] ; src address
ldr r7,[r3,#12] ; size

cmp r4,#1
beq copy
cmp r4,#2
beq clear
b done

copy:
subs r7,r7,#1
ldrb r1,[r6,r7]
strb r1,[r5,r7]
bne copy

adds r3,r3,#16
b cploop

clear:
subs r7,r7,#1
strb r0,[r5,r7]
bne clear
adds r3,r3,#16
b cploop
done:

.if @defined('__POSIX__')
;; posix stack buffer for system upbringing
ldr r0,=_posix_boot_stack_top
ldr r0, [r0]
mov sp,r0
.else
;; load r10 with end of USR/SYS stack, which is
;; needed in case stack overflow checking is on
;; NOTE: use 16-bit instructions only, for ARMv6M
ldr r0,=_lc_ue_stack
mov r10,r0
.endif

.if @defined('__PROF_ENABLE__')
bl __prof_init
.endif

.if @defined('__POSIX__')
;; call posix_main with no arguments
bl posix_main
.else
;; retrieve argc and argv (default argv[0]==NULL & argc==0)
bl __get_argcv
ldr r1,=__argcvbuf
;; call main
bl main
.endif

;; call exit using the return value from main()
;; Note. Calling exit will also run all functions
;; that were supplied through atexit().
bl exit
__get_argcv: ; weak definition
movs r0,#0
bx lr

.ltorg
.endsec

.calls '_START', ' '
.calls '_START','__init_vector_table'
.if @defined('__PROF_ENABLE__')
.calls '_START','__prof_init'
.endif
.if @defined('__POSIX__')
.calls '_START','posix_main'
.else
.calls '_START','__get_argcv'
.calls '_START','main'
.endif
.calls '_START','exit'
.calls '_START','',0

.end
Loading

0 comments on commit 070e440

Please sign in to comment.