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

📄 main.c~

📁 有关于USB的一些主机端驱动
💻 C~
字号:
#include <stdio.h>
#include "Omap30.h"
#include "Omap30_armwdg.h"
#include "..\header\armperipherals.h"
#include "..\header\FPGA_peripherals.h"
#include "swi.h"

//int SetupGPIOHandler(unsigned int BitNum, unsigned int RouteToARM, unsigned int IsInput, enum GPIO_interrupt_type interrupt_type) { 
int SetupGPIO(unsigned int BitNum, unsigned int RouteToARM, unsigned int IsInput, enum GPIO_interrupt_type interrupt_type) { 
	struct GPIO_struct *pGPIO = (struct GPIO_struct*)GPIO_BASE_ADDRESS;
	struct MPU_CLK_reset_power_CTL_struct * pMPU_CRPC \
				= (struct MPU_CLK_reset_power_CTL_struct*)0xfffece00;

	unsigned short temp;

	if(BitNum > 15)
		return -1;

	pMPU_CRPC->arm_idlect2 |= (1<<EN_GPIOCK);
	temp = pGPIO->pin_control_reg;
	temp &= ~(1<<BitNum);
	if(RouteToARM)
		temp |= (GPIO_PIN4ARM<<BitNum);
	else
		temp |= (GPIO_PIN4DSP<<BitNum);
	pGPIO->pin_control_reg = temp;

	temp = pGPIO->direction_control_reg;
	temp &= ~(1<<BitNum);
	if(IsInput)
		temp |= (GPIO_DIRECTION_INPUT<<BitNum);
	else
		temp |= (GPIO_DIRECTION_OUTPUT<<BitNum);
	pGPIO->direction_control_reg = temp;
	
	temp = pGPIO->interrupt_mask_reg;
	temp &= ~(1<<BitNum);
	if(interrupt_type == NON_INTERRUPT) {
		temp |= (GPIO_INTERRUPT_DISABLE<<BitNum);
		pGPIO->interrupt_mask_reg = temp;
	}
	else {
		temp |= (GPIO_INTERRUPT_ENABLE<<BitNum);
		pGPIO->interrupt_mask_reg = temp;
		temp = pGPIO->interrupt_control_reg;
		temp &= ~(1<<BitNum);
		if(interrupt_type == LOW2HIGH_INTERRUPT)
			temp |= (GPIO_INTERRUPT_LOW2HIGH<<BitNum);
		else
			temp |= (GPIO_INTERRUPT_HIGH2LOW<<BitNum);
		pGPIO->interrupt_control_reg = temp;
	}
	return 0;
}

void clearallinterrupt(void)
{
  int i = 0;
  unsigned long *Omap1510configReg_ptr = ((unsigned long *)0xfffe1000);
    *((unsigned long *)0xfffecb00) = 0;
    *((unsigned long *)0xfffecb04) = 0xffffffff;
    *((unsigned long *)0xfffe0000) = 0;
    *((unsigned long *)0xfffe0004) = 0xffffffff;

   //for(;i<40;i++)
   //   *Omap1510configReg_ptr++ = 0x00;

    return;
}

int main()
{
 //To set tms470 in 1509 mode;
 *(volatile unsigned long *)0xFFFE100C = 0x0000;
 clearallinterrupt();
 printf("\nKeyboard and mouse test...\n");
/* Interrupt from i2c mapped on irq of the interrupt handler 2 */
 INTH2_InitLevel(GPIO_INT,INTH_IRQ,INTH_HIGHEST_PRIORITY,INTH_LOW_LEVEL_SENSITIVE); 
 INTH2_EnableOneIT(GPIO_INT,INTH_IRQ);
	/* Set up GPIO 13 */                                          
 if (SetupGPIO(13, 1, 1, LOW2HIGH_INTERRUPT))
	return -1;
	
 KBmouseTest();
  
 /*IDE test DPLL1 = 0xfffecf00 = 0x013 */
 idetest();
 
 BOOT_SystemInit();

 printf("\nTouchscreen test...  Pls touch 10 times on the screen \n");
 touchscreentest();

 SetIRQ(1);          
 
 printf("\nLcd test...\n");
 lcdtest();

 printf("\n\nUart test...\n");
 UARTtest(); 

 printf("\nMMC  test...\n");
 MMCtest();

 printf("\n\nUSB  test...\n");
 usbtest();

 printf("\nCamera & Codec test...\n");
 // Here, we shall work in omap1509 mode; //I2C to set camera.
 camera_codectest();

 asm("mainend: b mainend");
 SetIRQ(0);
 clearallinterrupt();
 return 0;
}

⌨️ 快捷键说明

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