我已经很久没能回到这个问题、 但我相信我有一种工作方法可以通过 sysfs 从 Remoteproc 导出分割信息、这样它将在 Remoteproc 目录中创建分割目录、并在 PRU 启动时导出分割地址、并在关闭时将其删除。 如果 Nick Saulnier 或 Suman 有任何批评、比如在启动和关断期间、哪些引用是安全的、以及我是否应该以不同的方式获取某些引用以尊重参考计数注意事项、我对此感兴趣。 我还想知道他们是否有任何关于处理 PRU 和应用处理器之间高带宽数据交换的新建议。
#include
#include
#include
#include
#include
#include
#include
#include
module_license ("GPL");
module_Author ("Bill Merryman");
module_description ("a Simple module to access information from the PRU rproc.");
module_version ("0.01");
//
/sys/class/remoteproc/remoteproc1
是
/sys/devices/platform/ocp/4a326004.pruss-soc-bus/4a300000.pruss/4a334000.pru/remoteproc/remoteproc1
/sys/class/remoteproc/remoteproc2的符号链接
是
/sys/devices/platform/ocp/4a326004.pruss-soc-bus/4a300000.pruss/4a338000.pru/remoteproc/remoteproc2的符号链接
*/
struct rproc * rproc_rproc_struct;
struct kpt_subtrust_device_remote_remote_subtrade_static;
*
static ssize_t carveout_show (struct kobject *kobj、struct kobj_attribute *属性、
char *buf)
{
struct resource_table *table = rproc_ptr->table_ptr;
struct fw_rsc_carveout *c;
int i;
if (!table){
return 0;
}
for (i = 0;i < table->num;i++){
int offset = table->offset[i];
struct sizrdr*
=* void *(ddr_dr)*= void *+* void *!
if (HDR->type == RSC_CARVEOUT) c = RSC;
}
返回 sprintf (buf、"%x\n"、(c)? c->pA:0);
}
静态结构 kobj_attribute carveout_attribute =_attr (carveout_address、0440、carveout_show、NULL);
int rproc_access_driver_probe (struct rproc_subdev * subdev)
{
int error = 0;carveout_dir_kobj_show、NULL);"curveout_file_remote_remote_remote_out_en_dete_remote_remote_out"(a
);"cart_remote_remote_remote_remote_remote_remote_out_en_file"(r = carved_debug_out_profile";"cart_remote_remote_remote_remote_remote_remote_out_out_en_file"(r);"cart_remote_remote_remote_remote_remote_remote_out_enote_remote_remote_out_subdirectory (
返回错误;
}
void rproc_access_driver_remove (struct rproc_subdev * subdev)
{
if (carveout_dir_kobj_ptr)
{
kobject_put (carveout_dir_kobj_ptr);
carveout_dir_kobj_ptr = NULL;
printk (kern_info "curveout_dir_kobj_ptr}"pru_subdirectory
(n_shutdown);carveout_n_info on "prue_null_down" subdirectory (pruetooth_pru_
curveout 子目录未删除\n");
}
static int __init rproc_access_driver_init (void)
{
struct device_node *PRU_device_node;
struct platform_device *PRU_platform_device_ptr;
struct device *remoteEV_DEVICE_ptr;
pru_DEVICE_NODE_ptr = of "pru_platform_device *PRU_init_n_device_ptr;"pru_device_out_out_init_n_device"/ocp/pruss_soc_bus
(not
be acu_ent_out_out_ent_ent_ent_init_ent_ent_out_out_init_ent/r);struct@@@"pru_out_out_init_device"(pru_out_out_out_out_out_out_ent_ent_ent_init_ent_ent_ent full_name:%s\n"、PRU_DEVICE_NODE_PTR->full_name);
PRU_platform_DEVICE_ptr = of _find_device_BY_node (PRU_DEVICE_NODE_ptr);
of _NODE_Put (PRU_DEVICE_NODE_ptr);
if (!PRU_platform_DEVICE_DEVICE_PTR
)(PRU_DEVICE-PRU_PRU_PRU_DEVICE-PRU_DEVICE-PRU&PRU_DEVICE-PRU_PRECT_PRECT_PRECT_PRECTr);PRU_PRODEVICE-PRU_PRU_PRU_DEVICE-PRU_DEVICE-PRU&PRU_DEVICE-PRECT_PRECT_PRECT_PRU_DEVICE-PRECTr);PRU_PROTOP= PRU_PROTOP_
rproc_ptr = platform_get_drvdata (PRU_platform_device_ptr);
pt_device (&PRU_platform_device_ptr->dev);
if (!rproc_ptr) return -EPROBE_DERAD;
printk (Kern_info "rproc 在 init 处获取。 名称:%s\n"、rproc_ptr->name);
//我可能应该在这里使用 get_device,但我现在会危险地生活...
remoteproc_device_ptr =&rproc_ptr->dev;
remoteproc_device_kobj_ptr =&remoteproc_device_ptr->kobj;
printk (kproc_info "remoteproc kobj name:%s\n"、remoteproc_device_kobj->name);
rsizproc_subproc_dev_subreturn (rspr_subspr_spr_spr_sum_spru&r);
rproc_add_subdev (rproc_ptr、rproc_subdev、rproc_access_driver_probe、rproc_access_driver_remove);
返回0;
}
static void __exit rproc_access_driver_exit (void)
{
//*
在这里,我们必须考虑到在
删除驱动程序时有可能已经删除了 rproc *。
*所以我们需要检查它的存在情况、如果它存在、请移除
*我们为车辆创建的子设备。 如果
相关 PRU 正在运行、我们还必须*考虑、在这种情况
下、我们必须*在主退出逻辑之前执行完整的拆卸。
//
struct device_node *PRU_DEVICE_NODE_PTR;
struct platform_device * PRU_platform_device_ptr;
struct rproc * rptr_ptr;
PRU_DEVICE_NODE_ptr = of _find_node_by_path ("/ocp/pruss_soc_bus@4a326004/pruss@0/PRU@34000");
如果
在 PRU_DEVICE_NODE_BY_PATH (PRU_END)获取)。 full_name:%s\n"、PRU_DEVICE_NODE_PTR->full_name);
PRU_platform_DEVICE_ptr = of _find_device_BY_node (PRU_DEVICE_NODE_ptr);
of _NODE_Put (PRU_DEVICE_NODE_ptr);
if (PRU_platform_DEVICE_ptr
)
= PRU_DEVICE_PRU_ptr (PRU_DEVICE_PROT_PRU_DEVICE_PRU_DEVICE_ptr)(PRU_PROT_PRU_DEVICE_PRU_PROT = PRU_PROT_PRU_PROT);PRU_PROT_PRU_PROTOP= PRU_PRU_PROT (PRU_PROTOP= PRU_PROT_PRU_PRU_PROTOP= PRU_PRU_PRU_PRU_PROT (PRU_PROTOP= PRU_PRU_PRU_PROTOP= PRU_PRU_PRU_PROT) PRU_PRU_PROT (PRU_PRU_PRO 名称:%s\n"、rproc_ptr->name);
rproc_remove_subdev (rproc_ptr、rproc_subdev);
}
否则
{
put 设备(&pru_platform_device_ptr->dev);
}
}printk (kern_info "释放 curveout 子设备内存\n"); rproc_access_module_out_init_driver
(rproc
);rproc_remove
)