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

📄 uboot_common.h

📁 uclinux下 intel mx flash驱动源码!
💻 H
字号:
#ifndef __UBOOT_COMMON_H__
#define __UBOOT_COMMON_H__

#include "uboot_flash.h"

#define CFG_FLASH_BASE		0x20000000

#define CFG_MAX_FLASH_BANKS	1	/* max number of memory banks */
#define CFG_MAX_FLASH_SECT	71 	/* max number of sectors on one chip  8 boot sector (0x2000)
                                  + 63 main secotor (0x10000) */
                                 
#define CFG_ENV_ADDR	    CFG_FLASH_BASE


/* General definitions */
#define	CFG_ENV_IS_IN_FLASH	 1
#define FLASH_TOT_SECT		CFG_MAX_FLASH_SECT


#define FLASH_SIZE			0x400000
#define CFG_FLASH_SIZE		0x400000

#define CFG_MAIN_SECT_SIZE  0x10000
#define CFG_BOOT_SECT_SIZE  0x2000

#define ADDR0	0x0555
#define ADDR1	0x02AA
#define FLASH_WORD_SIZE unsigned short

#define uchar unsigned char
#define ulong unsigned long
#define ushort unsigned short

#define env_t unsigned char

#define NULL ((void *)0)

typedef volatile unsigned long	vu_long;
typedef volatile unsigned short vu_short;
typedef volatile unsigned char	vu_char;

typedef struct {
	ulong	size;			/* total bank size in bytes		*/
	ushort	sector_count;		/* number of erase units		*/
	ulong	flash_id;		/* combined device & manufacturer code	*/
	ulong	start[CFG_MAX_FLASH_SECT];   /* physical sector start addresses */
	uchar	protect[CFG_MAX_FLASH_SECT]; /* sector protection status	*/
} uboot_flash_info_t;


extern env_t *uboot_env_ptr;
extern env_t *uboot_flash_addr;
extern uboot_flash_info_t uboot_flash_info[CFG_MAX_FLASH_BANKS];

void enable_SPORT0_DMA(void);
void disable_SPORT0_DMA(void);
extern unsigned long uboot_flash_init (void);
extern int uboot_flash_erase	(uboot_flash_info_t *, int, int);
extern int uboot_flash_sect_erase (ulong addr_first, ulong addr_last);
extern int uboot_flash_sect_protect (int flag, ulong addr_first, ulong addr_last);
extern void uboot_flash_protect (int flag, ulong from, ulong to, uboot_flash_info_t *info);
extern int uboot_flash_write (uchar *, ulong, ulong);
extern uboot_flash_info_t *uboot_addr2info (ulong);
extern int uboot_write_buff (uboot_flash_info_t *info, uchar *src, ulong addr, ulong cnt);
extern int uboot_saveenv(int flash_offset);

#endif

⌨️ 快捷键说明

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