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

📄 uh0.c

📁 TDI的USB HOST芯片UHC124的编程手册和固件驱动源代码
💻 C
字号:
/*
	UH0.C: UHC124 Interface Library Level 0

(C) Copyright TransDimension, Inc.  All rights reserved.             
                                                                   
Modification history
====================
16Sep2000 Original Release
03Feb2001 Modified, JW

	Important:

	Please note that routines of Level 0 must be written
	by the OEMs according to the MCU interface and the
	RTOS.

	The code provided here serves only as examples that 
        were written to run on a Am186ER MCU.
*/

#include "types.h"
#include "uhc124.h"

#define UHC124			0xa0000000

/*	/reset pin  - use /PCS0 of Amd186 or Magic Reset */

void UH_Reset(void)
{

/*	if a software controled signal is not available for 
	the /RESET pin, the following "backdoor" can be used.

	UH_Write(M_MRST, 0x00);
	UH_USBReset();
*/

}
         
/*	write a byte into UHC124 memory */

void UH_Write(U16 addr, U8 data)
{
	*((U16 far *) UHC124 + addr) = data; 
}

/*	read a byte from UHC124 memory */

U8 UH_Read(U16 addr)
{
	return(*((U16 far *) UHC124 + addr));
}

/*	read a block of data from UHC124 memory */

void UH_BlkRead(U16 addr, U8 *data, U16 len)
{ 
	
	U16 far *a = (U16 far *) UHC124 + addr;

	/* retrieve data */
	while (len--) *data++ = (U8)(*a++);
}

/*	write a block of data into UHC124 memory */

void UH_BlkWrite(U16 addr, U8 *data, U16 len)
{	
	U16 far *a = (U16 far *) UHC124 + addr;

	/* copy data */
	while (len--) *a++ = *data++;
}

#define WAIT_1MS	500

/*	
	wait for some ms - in general, it should be written
	much better than just non-blocking software delays.
*/

void UH_Wait(U8 n)
{
	U32 i = 25000;

	while (n--) { 
		i = WAIT_1MS;
		while(i--);
	}	
}

⌨️ 快捷键说明

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