在linux系统中,iomem_resource的信息被输出到/proc/iomem中。


我们以高通IPQ4019芯片为例进行一下示例说明

step1 在/proc/iomem中看一下iomem_resource的情况

[root@Abloomy:~]# cat /proc/iomem

060f8800-060f88ff : qscratch_base

078af000-078af1ff : msm_serial_hsl //step1 78af000 是SOC上串口的物理地址。见下面的device信息

078b5000-078b55ff : spi_qsd

....

88000000-8fffffff : System RAM //这是内存的物理地址。

step2 从/sys信息中看一下设备注册的情况

[root@Abloomy:devices]# pwd

/sys/bus/platform/devices

[root@Abloomy:devices]# ls

....

60f8800.usb2 pmu.4

78af000.serialqca,scm_restart_reason.5 // step 2 这个78af000 是从设备树而来的。

78b5000.spi qcom,sps.2

step 3 了解到串口在设备树源文件中的信息

见:qca/src/linux/arch/arm/boot/dts/qcom-ipq40xx.dtsi 734

serial@78af000 {

compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";

reg = <0x78af000 0x200>; //reg表示此设备的地址空间。可以用这地址来访问设备的寄存器等。

interrupts = <0 107 0>;

status = "disabled";

clocks = <&gcc GCC_BLSP1_UART1_APPS_CLK>,

<&gcc GCC_BLSP1_AHB_CLK>;

clock-names = "core", "iface";

};

step4 串口驱动是如何向iomem_reserouce 进入注册的

msm_serial_hs_lite.c

msm_hsl_request_port函数

request_mem_region() //向iomem_reserouce中注册资源。并检查此资源是否被别人使用。

resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); //从plateform设备中得到IO资源

uport->membase = ioremap(uport->mapbase, //使用ioremap再进行映射。

resource_size(resource));

转载于:https://www.cnblogs.com/yaxinsn/p/8384110.html

typedef enum _HD_RESULT { HD_OK = 0, ///< general error HD_ERR_NOT_SUPPORT = -1, ///< not support ///< execute error HD_ERR_NG = -10, ///< general failure HD_ERR_SYS = -11, ///< operating system call failure HD_ERR_DRV = -12, ///< driver call failure HD_ERR_NOT_ALLOW = -13, ///< not allow in this case HD_ERR_ABORT = -14, ///< ignored or skipped HD_ERR_TIMEDOUT = -15, ///< timeout occured HD_ERR_FAIL = -19, ///< already executed and failed ///< module state error HD_ERR_INIT = -20, ///< module is already initialised HD_ERR_UNINIT = -21, ///< module is not initialised yet HD_ERR_STATE = -22, ///< invalid state to invoke function HD_ERR_TERM = -23, ///< module has terminated HD_ERR_NOT_OPEN = -24, ///< path is not open yet HD_ERR_ALREADY_OPEN = -25, ///< path is already open HD_ERR_NOT_START = -26, ///< path is not start yet HD_ERR_ALREADY_START = -27, ///< path is already start HD_ERR_NOT_BIND = -28, ///< io is not bind yet HD_ERR_ALREADY_BIND = -29, ///< io is already bind ///< parameter error HD_ERR_UNIQUE = -30, ///< unique id needed HD_ERR_DEV = -31, ///< invalid device id HD_ERR_IO = -32, ///< invalid io id HD_ERR_PATH = -33, ///< invalid path id HD_ERR_PARAM = -34, ///< invalid param id HD_ERR_INV = -35, ///< invalid argument passed HD_ERR_LIMIT = -36, ///< parameter value limit was reached HD_ERR_NULL_PTR = -37, ///< null pointer HD_ERR_NO_CONFIG = -38, ///< module device config or path config is not set HD_ERR_NO_DRV_CONFIG = -39, ///< module driver config is not set ///< object or resource error HD_ERR_RESOURCE = -40, ///< insufficient resources for request HD_ERR_NOT_AVAIL = -41, ///< resources not available HD_ERR_NOT_FOUND = -42, ///< not found HD_ERR_EOL = -43, ///< a list traversal has ended HD_ERR_IN_USE = -44, ///< object is in use. HD_ERR_NOT_USE = -45, ///< object is not in use. HD_ERR_LOCKED = -46, ///< object locked HD_ERR_DELETED = -47, ///< object has been deleted ///< data or buffer error HD_ERR_HEAP = -50, ///< heap full (application) HD_ERR_NOMEM = -51, ///< no memory (not enough system mem for create pool) HD_ERR_NOBUF = -52, ///< no buffer (not enough pool size for new blk) HD_ERR_SIGN = -53, ///< invalid sign in data HD_ERR_BAD_DATA = -54, ///< bad content in data HD_ERR_OVERRUN = -55, ///< buffer overrun occured, or data queue full HD_ERR_UNDERRUN = -56, ///< buffer underrun occured, or data queue empty ///< other error HD_ERR_INLINE_SUCCESS = -90, HD_ERR_INTERMEDIATE = -91, ///< intermediate return - successful but not complete HD_ERR_DEFERRED_SUCCESS = -92, HD_ERR_DEFERRED = -93, ///< action has been deferred HD_ERR_INV_PTR = -94, ///< invalid pointer HD_ERR_USER = -99, ///< start of subsystem specific errors } HD_RESULT; ///< HDAL error code
09-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值