This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

crashing while trying to write to fis area from linux kernel


Hi,

I am trying to update the fis area after the linux kernel boots up ..
but cannot write to it, kernel's crashing ..

I am able to read successfully fis contents using a pseudo driver I
have written,
but when I try to write to it its crashing.

My code is something like this:

1) First read a page size of data ..

	struct fis_image_desc *buf;
	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);

	/* Read the start of the last erase block */
	ret = master->read(master, master->size - master->erasesize,
			   PAGE_SIZE, &retlen, (void *)buf);

2) Modify buf[i] as needed.

3) 	if(!(master->flags & MTD_WRITEABLE))
		printk(" NOT writtable !! \n");
	else
		printk(" writtable \n");

	/* Write the start of the last erase block */
	ret = master->write(master, master->size - master->erasesize,
			   PAGE_SIZE, &retlen, (void *)buf);

Its crashing while I am trying to write in the above function.

I dont have much idea of the mtd driver and  so I am defintely doing
something very simple and stupid ..
but could someone please point the same to me .. 

Can someone give me a sample snnipet of code to do something like above ?

Cheers,
Alfred.

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]