ts-7000
[Top] [All Lists]

[ts-7000] DIO2 for basic I/O

To:
Subject: [ts-7000] DIO2 for basic I/O
From: "lazo93600" <>
Date: Mon, 30 Mar 2009 19:26:29 -0000
Dear,
 
My configuration :
----------------------------------------------
TS7260 with kernel 2.4.26,
no sdcard,
no use fo TTL com configuration
-------------------------------------------------
 
I manage easily to make DIO1 and LCD port worked, but the DIO2 might be some 
different configuration.
I didn't manage to use DIO2 as basic DIO cause the configuration register isn't 
applied.
This is the code that i used, i don't think so that's a coding problem, but I 
think that's a configuration problem.
 
Hope you could help me.
 
Thanks

 

/*Test For DIO2 TS7260                           *****************/
/*SOYSAL Sabahattin Guigui olivier decroixTelecom 2 08/09        */
/*****************************************************************/

/*****************************************************************/
/*                      INCLUDE                                  */
/*****************************************************************/
#include<unistd.h>
#include<sys/types.h>
#include<sys/mman.h>
#include<stdio.h>
#include<fcntl.h>
#include<string.h>
#include<time.h>

/*****************************************************************/
/*              Declaration of unsigned char                     */
/*****************************************************************/
volatile unsigned char *BASE0;
volatile unsigned char *BASE1;
int fd;


int main(void)
{
     unsigned char *start;
     int i;
  fd = open("/dev/mem", O_RDWR|O_SYNC);
        
  /*-----------------------------------------------------------------*/
/*   adress of digital capability implement : 0x12C00000           */
/*-----------------------------------------------------------------*/
  start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 
0x12C00000);
                                                                        
        if (start == MAP_FAILED)
        {
        printf("mmap");
        exit(1);
        }

  /*------------------------------------------------------------------*/
/*                   0x0 : Dataregister                             */
/*------------------------------------------------------------------*/          
  BASE0 = (unsigned char *)(start + 0x00);  //port BASE+0;
  /*------------------------------------------------------------------*/
/*                    0x1 : Data direction register                 */
/*------------------------------------------------------------------*/          
  BASE1 = (unsigned char *)(start + 0x01);     // port BASE+1;
     
  //treatemant
  // ---------------------

  *BASE1= 0xff;  //Configure the DIO2 on output (p33 of datasheet)
   
  /*------------------------------------------------------------------*/
/*                Square signal                                     */
/*------------------------------------------------------------------*/  
  for(;;)
  {
    *BASE0=0x00; //set all the pin at logic low
        //printf("%x\n",*BASE0);
    sleep(1000);
    *BASE0=0xff; //set all the pin at logic high
        //printf("%x\n",*BASE1);
   }
 
  return 0;
 
}
 



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU