linux-digilent-3.3.0-digilent-12.07-zed-beta\arch\arm\mach-zynq\platform_devices.c     
板端文件
#define DMAC0_BASE (0xF8003000) //芯片里DMAC这组寄存器的基地址
#define IRQ_DMAC0_ABORT 45
#define IRQ_DMAC0 46
#define IRQ_DMAC3 72
	#define DMAC0_BASE (0xF8003000) //芯片里DMAC这组寄存器的基地址
#define IRQ_DMAC0_ABORT 45
#define IRQ_DMAC0 46
#define IRQ_DMAC3 72
		static struct resource dmac0[] = 
{
{
.start = DMAC0_BASE,
.end = DMAC0_BASE + 0xFFF,
.flags = IORESOURCE_MEM, //表示是内存资源,使用的时候需要ioremap的
}, {
.start = IRQ_DMAC0_ABORT, //???
.end = IRQ_DMAC0_ABORT,
.flags = IORESOURCE_IRQ, //#define IORESOURCE_IRQ 0x00000400 include/linux/ioport.h
}, {
.start = IRQ_DMAC0,
.end = IRQ_DMAC0 + 3,
.flags = IORESOURCE_IRQ,//表示是中断资源,不用映射
}, {
.start = IRQ_DMAC3,
.end = IRQ_DMAC3 + 3,
.flags = IORESOURCE_IRQ,
},
};
	{
.start = DMAC0_BASE,
.end = DMAC0_BASE + 0xFFF,
.flags = IORESOURCE_MEM, //表示是内存资源,使用的时候需要ioremap的
}, {
.start = IRQ_DMAC0_ABORT, //???
.end = IRQ_DMAC0_ABORT,
.flags = IORESOURCE_IRQ, //#define IORESOURCE_IRQ 0x00000400 include/linux/ioport.h
}, {
.start = IRQ_DMAC0,
.end = IRQ_DMAC0 + 3,
.flags = IORESOURCE_IRQ,//表示是中断资源,不用映射
}, {
.start = IRQ_DMAC3,
.end = IRQ_DMAC3 + 3,
.flags = IORESOURCE_IRQ,
},
};
		struct pl330_platform_config dmac_config0 = {
.channels = 8,
.starting_channel = 0,
};
	.channels = 8,
.starting_channel = 0,
};
		static u64 dma_mask = 
0xFFFFFFFFUL;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
struct platform_device dmac_device0 = {
.name = "pl330",
.id = 0,
.dev = {
.platform_data = &dmac_config0,
.dma_mask = &dma_mask,
.coherent_dma_mask = 0xFFFFFFFF,
},
.resource = dmac0,
.num_resources = ARRAY_SIZE(dmac0),
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static struct platform_device xilinx_pmu_device = {
.name = "arm-pmu",
.id = ARM_PMU_DEVICE_CPU,
.num_resources = 1,
.resource = &xilinx_pmu_resource,
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static struct resource xilinx_pmu_resource = {
.start = 37,
.end = 38,
.flags = IORESOURCE_IRQ,
};
/* add all platform devices to the following table so they
* will be registered
*/
struct platform_device *xilinx_pdevices[] __initdata = {
&dmac_device0,
/* &dmac_device1, */
&xilinx_pmu_device,
};
 
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
struct platform_device dmac_device0 = {
.name = "pl330",
.id = 0,
.dev = {
.platform_data = &dmac_config0,
.dma_mask = &dma_mask,
.coherent_dma_mask = 0xFFFFFFFF,
},
.resource = dmac0,
.num_resources = ARRAY_SIZE(dmac0),
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static struct platform_device xilinx_pmu_device = {
.name = "arm-pmu",
.id = ARM_PMU_DEVICE_CPU,
.num_resources = 1,
.resource = &xilinx_pmu_resource,
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static struct resource xilinx_pmu_resource = {
.start = 37,
.end = 38,
.flags = IORESOURCE_IRQ,
};
/* add all platform devices to the following table so they
* will be registered
*/
struct platform_device *xilinx_pdevices[] __initdata = {
&dmac_device0,
/* &dmac_device1, */
&xilinx_pmu_device,
};
/**
* platform_device_init - Initialize all the platform devices.
*
**/
void __init platform_device_init(void)
{
int ret, i;
struct platform_device **devptr;
int size;
		 devptr = &xilinx_pdevices[0];  
//见struct platform_device *xilinx_pdevices[] __initdata 
size = ARRAY_SIZE(xilinx_pdevices);
	size = ARRAY_SIZE(xilinx_pdevices);
		 ret = 0;
	
	
		 /* Initialize all the platform devices */
	
	
		 for (i = 0; i < size; i++, devptr++) {
pr_info("registering platform device '%s' id %d\n",
(*devptr)->name,
(*devptr)->id);
ret = platform_device_register(*devptr);//设备注册函数
if (ret)
pr_info("Unable to register platform device '%s': %d\n",
(*devptr)->name, ret);
}
pr_info("registering platform device '%s' id %d\n",
(*devptr)->name,
(*devptr)->id);
ret = platform_device_register(*devptr);//设备注册函数
if (ret)
pr_info("Unable to register platform device '%s': %d\n",
(*devptr)->name, ret);
}
		} 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
?
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
?
