Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with making a device driver for Virtex 4 PowerPC

Status
Not open for further replies.

priestnot

Member level 5
Joined
May 1, 2006
Messages
89
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
2,098
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top