linux常用函数出处:
http://www.linuxidc.com/Linux/2011-05/36686.htm
一、主要代码先记下,慢慢消化
二、用到的结构体定义和函数出处
因为通过platform_get_resource返回一个resource结构指针:
resource 结构体:vim include/linux/ioport.h
变量类型:vim include/linux/types.h
struct device: vim include/linux/device.h:782
这个结构体比较大:
一直想找到platform_get_resource这个函数,网上有介绍,但没找到所处路径,
用grep -rn "xxx" * 在linux源码文件夹下搜索,搜索时间较长
在下载的xilinx的裁剪后的源码中搜索到了:
所在路径为:
struct platform_device:vim include/linux/platform_device.h :23
include/linux/device.h:920:static inline void dev_set_drvdata(struct device *dev,void *data)
在include/linux/ioport.h中
在kernel/resource.c中有如下函数:
ioremap:出处 include/asm-arm/io.h
三、附
/usr/src/linux-source-4.8.0/arch/arm/plat-samsung/devs.c
好多#include <>
ac97软声卡代名词
#ifdef CONFIG_CPU_S3C2440
static struct resource s3c_ac97_resource[] = {
[0] = DEFINE_RES_MEM(XXX,XXX),
[1] = DEFINE_RES_IRQ(XXX),
};
static struct s3c_audio_pdata s3c_ac97_pdata = {
#ifdef CONFIG_S3C24XX_DMAC
.dma_filter = s3c24xx_dma_filter,
#endif
.dma_plaback = (void *)DMACH_PCM_OUT,
.dma_capture = (void *)DMACH_PCM_IN,
.dma_capture_mic = (void *)DMACH_MIC_IN,
};
struct platform_device s3c_device_ac97 = {
.name = "samsung-ac97",
.id = -1,
.num_resources = ARRAY_SIZE(s3c_ac97_resource),
.resource = s3c_ac97_resource,
.dev = {
.dma_mask = &samsung_device_dam_mask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &s3c_ac97_pdata,
}
};
#endif