⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 project.c

📁 Usb Host/Periphel Control TD1120 codes
💻 C
字号:
/*------------------------------------------------------------------------------
$File: //tdi_sw/tdi/projects/usb/custom/pcd_1120/acm/project.c $
$DateTime: 2004/12/20 22:44:13 $
$Revision: #8 $
Purpose: This file contains the project specific settings for USBLink.

CONFIDENTIAL AND PROPRIETARY INFORMATION OF TRANSDIMENSION, INC. 
AND/OR ITS WHOLLY OWNED SUBSIDIARY SOFTCONNEX TECHNOLOGIES, INC.

THIS NOTICE IS NOT TO BE DELETED, MODIFIED, MOVED OR CHANGED IN ANY WAY.

(TransDimension, Inc. and SoftConnex Technologies, Inc. are referred to 
collectively below as TransDimension, Inc.)
Copyright (c) 1999 - 2004 by TransDimension, Inc. 

This software is protected by copyright laws and international copyright 
treaties, as well as other intellectual property laws and treaties.  This
software is a CONFIDENTIAL, unpublished work of authorship, and with portions 
constituting TRADE SECRETS of TransDimension, Inc..  Any unauthorized use, 
disclosure, and/or reproduction of this software, or any part of this software;
or distribution of this software in any form or by any means; or storage 
of this software in any database or retrieval system, without the express 
written consent of, and license from, TransDimension, Inc. is strictly prohibited.
This software is protected under the copyright and/or trade secret laws in other 
countries in addition to USA.  All Rights Reserved.  Failure to abide by the use, 
disclosure and/or reproduction restrictions may result in civil and /or criminal 
penalties, and will be prosecuted to the maximum extent of	the law.
------------------------------------------------------------------------------*/
#include "project.h"

extern void PCDACM_App(void);

TdiPeriphController* globalPeriphHandle;

/* This file will contain the table of classes and controllers */
PcdDriverEntry PcdDriverTable[2] = 
   {
      {
      SYS_GetBaseAddrAndIrq,
      TD1120P_VerifyId,
      TD1120P_Create,
      TD1120P_Destroy
      },
      {
      0,
      0,
      0,
      0
      },
   };
   
/*------------------------------------------------------------------------------
Name      : PROJECT_Initialize
Purpose   : This function is used to run a test application to exercise different
            PCD API functions
Arguments : None
Returns   : None
Notes     : This function is an example for PCD API usage
-----------------------------------------------------------------------------*/
void PROJECT_Initialize(void)
   {
   U32 status;
   U32 baseAddress;
   U8 irq;
   TdiPeriphController* pc;
   
   if (NULL != PcdDriverTable[0].getControllerBaseAddrAndIrq)
      {
      PcdDriverTable[0].getControllerBaseAddrAndIrq(&baseAddress, &irq);
      /* match driver with controller instance */
      if (SCC_TRUE == (PcdDriverTable[0].verifyControllerId(baseAddress)))
         {
         PRINTF1(("\nFound the TD1120P controller"));
         }
      else
         {
         PRINTF1(("\nDid not find the TD1120P controller at the specified base address"));
         }

      SYS_DisableInterrupts(irq);
      status = (PcdDriverTable[0].createController(baseAddress, &pc));
      if (status != SCS_SUCCESS) 
         {
         PRINTF1(("\nError creating controller instance"));
         }
         
      globalPeriphHandle = pc;
         
      /* hook interrupt */
      status = SYS_HookISR(irq, TD1120P_InterruptHandler);
   
      /* if a status is returned, bomb out w/ unspecified error if it fails */
      if (SCS_SUCCESS != status)
         {
         PRINTF1(("\nERROR: failed to hook interrupt."));
         }
         
      /* register call back function for VBus Change */
      PCD_RegisterEventCallback(pc, USB_SERVICE_VBUS_CHANGE_EVENT, 
                             PCDAPP_EVE_ProcessVbusChange);
      if (status != SCS_SUCCESS)
         {
         PRINTF1(("\nERROR: Event callback registration failed."));
         }
      
      /* register call back function for Bus Reset detection */
      PCD_RegisterEventCallback(pc, USB_SERVICE_BUS_RESET_EVENT, 
                             PCDAPP_EVE_ProcessBusReset);
      if (status != SCS_SUCCESS) 
         {
         PRINTF1(("\nERROR: Event callback registration failed."));
         }
      
      /* register call back function for Speed detection */
      PCD_RegisterEventCallback(pc, USB_SERVICE_SPEED_DETECTION_EVENT, 
                                PCDAPP_EVE_ProcessSpeedDetection);
      if (status != SCS_SUCCESS) 
         {
         PRINTF1(("\nERROR: Event callback registration failed."));
         }
   
      /* register call back function for SETUP packet */
      PCD_RegisterEventCallback(pc, USB_SERVICE_SETUP_PACKET, PCDAPP_EVE_ProcessSetup);
      if (status != SCS_SUCCESS) 
         {
         PRINTF1(("\nERROR: Event callback registration failed."));
         }
      
      SYS_EnableInterrupts(irq);
      
      PCDACM_App();
      
      /* All done, destroy the handle */
      PcdDriverTable[0].destroyController(pc);
      }
   }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -