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

2012-06-19 Thread Stefan Fischer
Hello, I have a project, where I have to write a driver for /dev/spidev0.0, but I have problems with fpioctl. I believe that I have problems with the parameter passing or type casting of fpioctl. In some forums, I've found mysterios Pointer(PtrInt(xx) syntax like that: fpioctl(fd,funcnum,

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

2012-06-19 Thread Jonas Maebe
Stefan Fischer wrote on Tue, 19 Jun 2012: My code snipet is below: spi_ioc_transfer_t = record tx_buf_ptr : pointer; rx_buf_ptr : pointer; len: longword; delay_usec : word; speed_hz : longword; bits_per_word : byte; cs_change : byte; pad:

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

2012-06-19 Thread Henry Vermaak
On 19 June 2012 14:17, Jonas Maebe jonas.ma...@elis.ugent.be wrote: Stefan Fischer wrote on Tue, 19 Jun 2012: My code snipet is below: spi_ioc_transfer_t = record    tx_buf_ptr   : pointer;    rx_buf_ptr   : pointer;    len    : longword;    delay_usec  : word;    speed_hz     :

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

2012-06-19 Thread Jonas Maebe
Henry Vermaak wrote on Tue, 19 Jun 2012: Also, the buffers need to be u64. Is the pointer type in pascal always 64 bit? u64 is defined as unsigned long. unsigned long is the same size as a pointer on Linux. Jonas ___ fpc-devel maillist -

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

2012-06-19 Thread Stefan Fischer
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? Am 19.06.2012 um 15:24 schrieb Jonas Maebe: Henry Vermaak wrote on Tue, 19 Jun 2012: Also, the buffers need to be u64. Is

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

2012-06-19 Thread Henry Vermaak
On 19 June 2012 18:04, Stefan Fischer sfisc...@basis.biz wrote: 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? Have you tried looking at errno? Do any of the other ioctls

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

2012-06-19 Thread Henry Vermaak
On 19 June 2012 18:20, Henry Vermaak henry.verm...@gmail.com wrote: Have you tried looking at errno?  Do any of the other ioctls succeed Sorry, errno - GetLastOSError() Henry ___ fpc-devel maillist - fpc-devel@lists.freepascal.org

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

2012-06-19 Thread Ludo Brands
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'

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

2012-06-19 Thread Henry Vermaak
On 19 June 2012 18:37, Ludo Brands ludo.bra...@free.fr wrote: Are you sure about the conversion (*SPI_IOC_MESSAGE(1)*) 1075866368? That is I can confirm that a c program spits out this number for SPI_IOC_MESSAGE(1). Henry ___ fpc-devel maillist -

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

2012-06-19 Thread Stefan Fischer
after some experiments, tx.. and rx_buf_ptr has to be 64 bits. On fps on arm, the pointer type is translated to 32 Bits. Ludo's suggestions to use qword (64Bit) is correct. Is there a possibility to use pointer type with 64 Bits? How ? spi_ioc_transfer_t = record tx_buf_ptr,dummytx:

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

2012-06-19 Thread Henry Vermaak
On 19 June 2012 14:21, Henry Vermaak henry.verm...@gmail.com wrote: Also, the buffers need to be u64.  Is the pointer type in pascal always 64 bit? The answer to this is no, so you can't use pascal pointer types for the buffers. Henry ___ fpc-devel