cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sanghyun_kim
Observer
Observer
261 Views
Registered: ‎02-17-2020

how to access platform device driver data structure

Jump to solution

i created kernel module by petalinux tool.

petalinux-create -t modules -n sharedmem --template c

and this is platform device driver.

 

some initialization function executed when module probing.

static int sharedmem_probe(struct platform_device *pdev)
{
	struct resource *r_irq; /* Interrupt resources */
	struct resource *r_mem; /* IO mem resources */
	struct resource res;
	struct device *dev = &pdev->dev;
	struct sharedmem_local *lp = NULL;
	struct device_node *np;

	int rc = 0;
	dev_info(dev, "Device Tree Probing\n");
        /* ....... */
	lp->paddr = res.start;
	dev_info(dev,"%ld res.start \n",res.start);

 

so my question is how to access these data structure inside of platform device driver like sharedmem_local and use it (write or read to/from specific address which get from initialization process) on user level application?
(i.e. user level app can control character device by file i/o like open/read/write)

or doesn't need to write device driver and just access it on user level application by physical address ?

 

0 Kudos
1 Solution

Accepted Solutions
yzhang
Moderator
Moderator
225 Views
Registered: ‎05-11-2010
2 Replies
yzhang
Moderator
Moderator
226 Views
Registered: ‎05-11-2010
sanghyun_kim
Observer
Observer
171 Views
Registered: ‎02-17-2020

this is exactly what i want.

in petalinux tools, created kernel module by "petalinux-create -t modules -n sharedmem --template c" is platform device driver.

so, my consideration is it is possible (or no problem) to implement platform device driver and character device driver on same module.

wiki articles tells it is possible. 

0 Kudos