CODE_TI8148_APP_PCIEINITEP

主要用途:主要用于对PCIE通信的EP端进行初始化配置。

能力分类:嵌入式

应用领域:智能穿戴,测试设备,电源电池,机器人,无人机

交易方式: 定制

参考价格:50000.00 小贴士:当前佣金是0%

好评率:100%| 综合评分:5.0| 已购买:0次
联系我 收藏店铺
分享: 

 模块描述

1.1  原理及方式

本模块主要用于对PCIE通信的EP端进行初始化,建立好内存地址映射,用户在应用程序中可以基于映射地址进行数据传输

该模块目前可以编译通过,并在TI8148平台成功使用。因为需要打开PCIE设备,所以该IP代码不可用于没有PCIE设备的硬件平台。

 

1.2  主要功能

主要用于对PCIE通信的EP端进行初始化配置。

标准模块

 模块设计

主要结构体定义

 

/**

* ti81xx_inb_window - inbound window configuration information

* @BAR_num: bar no for which inbound window has to be mapped

* @internel_addr: address to be set in translation register

* (internal physical address)

* @ib_start_hi: PCIe address higher if 64bit is used (will be zero for 32 bit)

* @ib_start_lo: PCIe address (represents lower if 64bit is used)

*/

struct ti81xx_inb_window {

u32 BAR_num;

u32 internal_addr;

u32 ib_start_hi;

u32 ib_start_lo;

};

 

/*

* ti81xx_pciess_regs - pciess register access information

* @offset: offset of register from 0x51000000

* @value: value to set in SET mode, and will be fill by driver in GET mode

* @mode: get value or set value of register (SET_PCIE_REG/GET_PCIE_REG)

* this structure contain information about pciess register, we can use provided

* ioctl for debugging purpose as well as to see the register DUMP

*/

struct ti81xx_pciess_regs {

u32 offset;

u32 value;

u32 mode;

};

 

/*

* ti81xx_pcie_mem_info: Contains information about the PCIe reserved memory

* @base: Physical address of base of memory reserved

* @psize: Size in bytes of the reserved memory

*/

struct ti81xx_pcie_mem_info {

u32 base;

u32 size;

};

 

/*

* ti81xx_bar_info: this structure is used to query bar info

* @bar_addr: address allocated to bar

* @bar_size: size of bar

* @bar_num: bar no for which query is sent

*/

struct ti81xx_bar_info {

u32 bar_addr;

u32 bar_size;

u32 bar_num;

};

 

主要函数说明:

 

1)应用层初始化PCIE EP端设备

 

函数原型

int ti8148_app_pcie_init(void)

功能描述

(1)打开PCIE设备:/dev/ti81xx_pcie_ep

(2)获取内核对设备预留的内存地址,

并进行虚拟地址映射

(3)对EP端in_bound地址进行设置

(4)使能传输功能

(5)设置MASTER模式

输入参数

输出参数

全局变量值的变化

返回值

正常:0

错误:-1

 

 

类定义

 应用举例

 

举例如下代码,该例子的最终实现依赖于TI8148硬件和PCIE RC端通信,代码对PCIE传输区域数据进行打印,需要RC端配合修改该区域中的数据内容。

 

int main(void)

{


while (1)

{

int i;


for (i = 0; i < 10; i++) {

printf("%02x ", mapped_buffer[i]);

}

printf("\n");

sleep(1);

}

 

return 0;

}

 

 其他


总体评价

好评率:100%

好评数量:0

总体评分

工作速度:5分

工作质量:5分

工作态度:5分

暂无评价

企业其他能力

More>