[uClinux-dev] function write in char driver (ARM - AT91)

Greg Ungerer gerg at snapgear.com
Sun Jun 24 08:22:14 EDT 2007


Hi Ramon,

rflores wrote:
>[snip]
> The code in the application side is:
> 
>  
> 
> /int fd;/
> 
> /char buf[80];/
> 
> /fd = open (“/dev/swspi”,”rw”);/
                            ^^^^
Not an appropriate argument type for this field. The flags field
of open() is an int. Read the "open" manual page for details.

Regards
Greg



> 
> /if (fd == -1){/
> 
> /  printf(“\nUnable to open device\n”);/
> 
> /  return (-1);/
> 
> /}/
> 
> /printf(“\nSpi device descriptor = %d\n”,fd);/
> 
> /strcpy(buf,”\nSWPI write function\n”);/
> 
> /printf(“write return = %d”,write(fd,buf,sizeof(buf)));/
> 
> / /
> 
>  
> 
> And the execution is:
> 
>  
> 
> Sash command shell (version 1.1.1)
> 
> />
> 
> />
> 
> /> llaccess test
> 
> SWSPI: Open
> 
>  
> 
> Spi  device descriptor = 3
> 
>  
> 
> write return = -1
> 
> SWSPI: Close
> 
> />
> 
>  
> 
> Where is the problem? Why doesn’t the kernel call to spi_write when the 
> application invokes the write function?
> 
>  
> 
> Thanks in advance
> 
>  
> 
> Ramón Flores
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev


-- 
------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Dude       EMAIL:     gerg at snapgear.com
SnapGear -- a Secure Computing Company      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com


More information about the uClinux-dev mailing list