61 lines
1.8 KiB
C
61 lines
1.8 KiB
C
/********************************** (C) COPYRIGHT *******************************
|
|
* File Name : main.c
|
|
* Author : WCH
|
|
* Version : V1.0.0
|
|
* Date : 2022/09/01
|
|
* Description : Main program body.
|
|
*********************************************************************************
|
|
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
|
* Attention: This software (modified or not) and binary are used for
|
|
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
|
*******************************************************************************/
|
|
|
|
/*
|
|
* @Note
|
|
* This example demonstrates the enumeration process of a USB host to a device that
|
|
* supports MTP and PTP protocols, and reads its files.
|
|
*/
|
|
|
|
/*
|
|
* @Note
|
|
* In addition, when the system frequency is selected as the USBFS clock source, only 144MHz/96MHz/48MHz
|
|
* are supported.
|
|
*/
|
|
|
|
/*******************************************************************************/
|
|
/* Header Files */
|
|
#include "usb_host_config.h"
|
|
|
|
/*********************************************************************
|
|
* @fn main
|
|
*
|
|
* @brief Main program.
|
|
*
|
|
* @return none
|
|
*/
|
|
int main( void )
|
|
{
|
|
/* Initialize system configuration */
|
|
Delay_Init( );
|
|
USART_Printf_Init( 115200 );
|
|
DUG_PRINTF( "SystemClk:%d\r\n", SystemCoreClock );
|
|
DUG_PRINTF( "USBFS HOST MTP Test\r\n" );
|
|
|
|
/* Initialize USBFS host */
|
|
#if DEF_USBFS_PORT_EN
|
|
DUG_PRINTF( "USBFS Host Init\r\n" );
|
|
USBFS_RCC_Init( );
|
|
USBFS_Host_Init( ENABLE );
|
|
memset( &RootHubDev.bStatus, 0, sizeof( ROOT_HUB_DEVICE ) );
|
|
memset( &HostCtl[ DEF_USBFS_PORT_INDEX * DEF_ONE_USB_SUP_DEV_TOTAL ].InterfaceNum, 0, DEF_ONE_USB_SUP_DEV_TOTAL * sizeof( HOST_CTL ) );
|
|
#endif
|
|
|
|
while( 1 )
|
|
{
|
|
USBH_MainDeal( );
|
|
}
|
|
}
|
|
|
|
|
|
|