[fpc-devel] Problems with fpioctl on ARM debian linux and FPC2.6

Ludo Brands ludo.brands at free.fr
Tue Jun 19 19:37:50 CEST 2012


> 
> I've changed to following:
> added packrecord c
> flipped speed_hz and delay_usec fields
> 
> same problem.
> I don't know whats really wrong.
> Is there any debug possibility?
> 

Are you sure about the conversion (*SPI_IOC_MESSAGE(1)*) 1075866368? That is
40206B00 hex. 6B is the letter 'k' SPI_IOC_MAGIC but the 20 seems to
indicate a size of 32 bytes while the record has only a size of 24 bytes on
ARM (32 bit pointers). Also the 40 seems to be wrong as it corresponds to
IOC_IN.

#define SPI_MSGSIZE(N) \
       ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \
             ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0)
#define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)])
#define	_IOW(g,n,t)	_IOC(IOC_IN,	(g), (n), sizeof(t))
#define	_IOC(inout,group,num,len) \
	((unsigned long)(inout | ((len & IOCPARM_MASK) << 16) | ((group) <<
8) | (num)))
#define	_IOR(g,n,t)	_IOC(IOC_OUT,	(g), (n), sizeof(t))
#define	IOC_OUT		0x40000000	/* copy out parameters */
#define	IOC_IN		0x80000000

Ludo




More information about the fpc-devel mailing list