Forum Discussion
Altera_Forum
Honored Contributor
16 years ago<div class='quotetop'>QUOTE (mschnell @ Jul 10 2009, 04:08 AM) <{post_snapback}> (index.php?act=findpost&pid=23060)</div>
--- Quote Start --- IMHO it's not really good idea to work around the ways of the OS. While this will of course work with the current NIOSnommu system, I suppose it will not work with the upcoming MMU-enabled NIOS Linux. Moreover it's not portable at all regarding yet unknown Linux updates and other processors. The "correct" way of doing this is either create a decent device driver and to access I/O use the portable functions provided by the Kernel build system or - if you want to stay in userland - use UIO. In userland Interrupts are not possible. Of course the "official" way to use interrupts is doing a decent device driver. But I was told that UIO provides means to do a kind of "user-land-interrups" (I did not look into this yet). -Michael[/b] --- Quote End --- Does it mean that I can't use at all the HAL functions included in the "OpenCores I2C Package" ??? Because with this HAL, I can send I2C frames on the SDA/SCL lines very easily (I scoped yesterday and is was almost perfect), the only problem concerns the data received from the slave by the master like ACK bit or read registers... Is it possible in the same time to switch to NIOS Standard version (-s) in SOPC Builder (compatible with µClinux ??), to keep the OpenCores Ethernet MAC and the OpenCores I2C working and finally to use HAL functions like this one : ------------------------------------------------------------------------------------ alt_u32 I2C_read(alt_u32 base,alt_u32 last) {# ifdef I2C_DEBUG printf(" Read I2C at 0x%x, \n\twith last0x%x\n",base,last);# endif if( last) { /* start a read and no ack and stop bit*/ IOWR_OPENCORES_I2C_CR(base, OPENCORES_I2C_CR_RD_MSK | OPENCORES_I2C_CR_NACK_MSK | OPENCORES_I2C_CR_STO_MSK); } else { /* start read*/ IOWR_OPENCORES_I2C_CR(base, OPENCORES_I2C_CR_RD_MSK ); } /* wait for the trnasaction to be over.*/ while( IORD_OPENCORES_I2C_SR(base) & OPENCORES_I2C_SR_TIP_MSK); /* now read the data */ return (IORD_OPENCORES_I2C_RXR(base)); } ------------------------------------------------------------------------------------ Thanks for your help !