EmbLogic's Blog

kernel level

Is there any function to reallocate memory at the kernel level in spite of  kmalloc……????

Posted in Character Driver | 2 Comments

related to char. driver

i have complete read write operation for multiple item and llseek also done

Posted in Uncategorized | Leave a comment

How this program is excutable without existing any header file????

int main()         //without header file

{int *i;
char k;
float s;

char j[5];
struct hi
{
};
return 0;
}
//where these all keywords and main function is declared and defined…?????

Posted in Data Structures with C | 3 Comments

why not Address operator & used with the string variables in scanf function and used for other types??..

Posted in Data Structures with C, Uncategorized | 3 Comments

why we should avoid single character as string???…

example : char a[]=”a”; this is possible but not efficient because we have other method to assign character const as shown below:

char c=’a’;

Posted in Data Structures with C | 3 Comments

Wish you

?BELATED HAPPY DIWALI?

Posted in Uncategorized | Leave a comment

Char dri…………..

If container of function returns scull_dev pointer, then where  the major and minor numbers are located into the different structures??????

Posted in Character Driver | Leave a comment

STATUS: Char DD

Completed: open, close, read (single quantum, multiple quantum),write(single quantum, multiple quantum),semaphore(syn tech),LSEEK.
Working: Completion, IOCTL.
earlier
ioctl (struct inode * inode, struct file * filp, unsigned int cmd, unsigned long arg)

In 2.6.x the ioctl is divided in to 2
compact_ioctl (struct file * filp, unsigned int cmd, unsigned long arg )
it is used when a 32 bit application is called in 64 bit, so it will provide the required mapping born due to the different architecture of 32 and 64 bit.

unlocked_ioctl (struct file * filp, unsigned int cmd, unsigned long arg )

In earlier version the (struct inode * ) parameter was used to fetch the device info from filp->private_data. but now it has been removed.
It is provided as filp->f_dentry->d_inode

plus in
struct file_operations
{
ioctl:my_ioctl,

use
compact_ioctl: my_ioctl,
unlocked_ioctl: my_ioctl,
}

Posted in Uncategorized | Leave a comment

linklidt and scull

problem is while traversing it gives the segmentation fault.

#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>

struct linklist{
char **data;
struct linklist *next;
}*start,*temp,*last;
int main()
{
int i,j,m,l;
int quantams;
char y;
start=(struct linklist*)malloc(sizeof(struct linklist));
temp=(struct linklist*)malloc(sizeof(struct linklist));
//last->data=malloc(sizeof(char*)*);
//printf(“enter the dat in the first node\n”);
start->next=NULL;
//scanf(” %d”,&start->data);
temp=start;
j=0;
printf(“do u wana linklist press y\n”);
scanf(” %c”,&y);
while(y==’y’||y==’Y’)

{
printf(“this is %d node\n”,j+1);
last=(struct linklist*)malloc(sizeof(struct linklist));
last->data=(char **)malloc(sizeof(char *));
for(m=0;m<=1;m++)
{
last->data[m]=(char*)malloc(sizeof(char));

for(l=0;l<=1;l++)
{
printf(“row no %d: column no %d”,m,l);
printf(” enter the information\n”);
scanf(“%d”,&quantams);
//last->data[m][l]=quantams;
*(*(last->data+m)+l)=quantams;
}
}
last->next=NULL;
printf(“last->next=NULL\n”);
temp->next=last;
printf(“temp->next=last\n”);
temp=last;
printf(“temp=last\n”);
j++;
printf(“do you wana continue press y or Y\n”);
scanf(” %c”,&y);
}
j=0;
temp=start;
while(temp->next!=NULL)
{
printf(“this is %d node\n”,j);
for(m=0;m<=1;m++)
{

for(l=0;l<=1;l++)
{
printf(“row no %d :: column no %d”,m,l);
printf(” %d\n”,*(*(temp->data+m)+l));
}
}
temp=temp->next;
j++;
}
return 0;
}

Posted in Uncategorized | Tagged | 1 Comment

Status : Char Device Driver

Completed: open, close, read (single quantum, multiple quantum),write(single quantum, multiple quantum),semaphore(syn tech).
Working: Completion, IOCTL,LSEEK

Posted in Character Driver | Leave a comment

status of character device driver

i have done sucessfully READ and WRITE operation in multiple quantum.
i have also done synchonization technique Semaphore,Completion.
now i m working on llsekk operation.

Posted in Uncategorized | Leave a comment

Toolchain help!!!

Hi,

I am working on cross development toolchain. I used packages binutils-2.10.1, gcc-2.95.3, glibc-2.2.4, glibc-linux-threads-2.2.4, kernel-2.4.17. (most common packages for building toolchain)

I followed book “Building Embedded Linux Systems (OReilly 2003) – chapter 4″ and finally i am able to compile all the above packages without any errors and did everything till section 4.2.7.

I was not able to understand section 4.2.8 (something related to makefile), is it important ? and how can i check whether I have successfully build a working toolchain.

One more thing, I wrote a hello world program, and compiled it with
#arm-linux-gcc 1.c
it created a a.out file without any errors. Does this signifies that i have successfully build a working toolchain ? because I can’t run a.out file on my host, I need a target system to run a.out on it.

Regards
Bishan Preet Singh

Posted in Embedded Linux, Uncategorized | 4 Comments

status of character driver

I have completed the read and write operation in driver for multiple quantum.now i m working on semphore operation.

Posted in Uncategorized | Leave a comment

c basics

what is the difference between NULL and NUL  ………………..??????

Posted in Data Structures with C | 2 Comments

Printk error

I have used printk statement in char device driver code.
“make” have no warning or error

on doing insmod no error is given .
but on dmesg the printk statement are not showing.
i have checked in /var/log/message but printk statement are not present.

Ihave changed the priority in printk.h file bur no avail .

If any one has any info do let it pass to me.

Posted in Character Driver | Leave a comment