Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PowerPC linux Kernel

Status
Not open for further replies.

priestnot

New Member
Hi there...

I am trying to make a device driver (Kernel module) for a Virtex4 PowerPC, and i have a small problem...

The powerpc is byte addressable (little endian) but i my kernel functions as to return a int (32bit's) i already have a functional module but is not optimized

Code:
ssize_t fpga_write(struct file *filp, int *buf, size_t count, loff_t *f_pos) 
{
	void *add;
	int *kbuf;
    	kbuf = kmalloc(count, GFP_KERNEL);
	int ret = copy_from_user(kbuf, buf, count);
	int i;
	for(i = *f_pos/4; i < count/4 + *f_pos/4; i++)
	{
		
		add = io_base + (i*4);
		__raw_writel(kbuf[i - *f_pos], add);
	}
	kfree(kbuf);
  	return 1;

}

What i wold like to do is get a int without making the * and / (they take lot of CPU time). I think there is a way with some masks with FFFFFFFC using a AND. Is this possible i do not understand how it works...


does anyone have any ideas??
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top