Loading ...
Sorry, an error occurred while loading the content.

Acess ARM9 hardware timers ( C and Linux )

Expand Messages
  • jim.norton@rocketmail.com
    Hello everybody, I m new to embedded linux development. I want to write some routines that need 1uS timer resolution. I understand that the ARM9 processors
    Message 1 of 5 , Apr 10, 2009
    • 0 Attachment
      Hello everybody,

      I'm new to embedded linux development. I want to write some routines that need 1uS timer resolution. I understand that the ARM9 processors have 16 bit hardware timers. The processor I'm using is a samsung S3C2410A.

      How do one use these timers in linux from 'C'. Anybody have any example code?

      Or does anybody have any good reference material that explains how to write Linux device driver code so that I might write a driver for linux to access the chips timers......?

      If I was writing is Assembly, as I do with PICS, it would probably be easy.. but this is the first time working with ARM9 and Linux....

      Any help or pointers are greatly appreciated...

      -Jim
    • Simon Glass
      Hi Jim, Suggest a period of learning! A great book is Linux Device Drivers . If you are just wanting to read the timer in order to timestamp something in user
      Message 2 of 5 , Apr 10, 2009
      • 0 Attachment
        Hi Jim,

        Suggest a period of learning! A great book is 'Linux Device Drivers'.

        If you are just wanting to read the timer in order to timestamp something in user space, then perhaps you should create a driver which allows it to be read. A cheap way is just to mmap() the timer and access it directly like on the PIC. But if you need a driver to read something and time stamp it, then check out that book.

        Regards,
        Simon

        jim.norton@... wrote:

        Hello everybody,

        I'm new to embedded linux development. I want to write some routines that need 1uS timer resolution. I understand that the ARM9 processors have 16 bit hardware timers. The processor I'm using is a samsung S3C2410A.

        How do one use these timers in linux from 'C'. Anybody have any example code?

        Or does anybody have any good reference material that explains how to write Linux device driver code so that I might write a driver for linux to access the chips timers...... ?

        If I was writing is Assembly, as I do with PICS, it would probably be easy.. but this is the first time working with ARM9 and Linux....

        Any help or pointers are greatly appreciated. ..

        -Jim


        -- 
        
        --------------------------------------------------------------------------
        Freecall Australia  1800 148 751     USA 1800 261 2934
        
        Bluewater Systems Ltd - ARM Technology Solution Centre
        
               Simon Glass                              Bluewater Systems Ltd
        Phone: +64 3 3779127                            Unit 5, 404 Barbadoes St
        Fax:   +64 3 3779135                            PO Box 13889
        Email: sglass@...                  Christchurch
        Web:   http://www.bluewatersys.com              New Zealand
        
        
        
      • jim.norton@rocketmail.com
        Thank you Simon. mmap() would be a quick and dirty way to access the timer registers. I was hoping that somebody had already written a device driver to use the
        Message 3 of 5 , Apr 11, 2009
        • 0 Attachment
          Thank you Simon. mmap() would be a quick and dirty way to access the timer registers.

          I was hoping that somebody had already written a device driver to use the timers on a Samsung ARM9 SC32410A processor.

          Anyways, I ordered 3 different books on writing software for embedded linux systems - one of which is a book about writing linux device drivers.

          I bought a Tin Can Tools "Hammer Kit" with which to learn about embedded linux... So the learning is in full swing... :-)

          I'm in shock right now having a background in PIC18 assembly. Seems everything is more complicated with an OS "in the way".. :-)


          --- In arm-user@yahoogroups.com, Simon Glass <sglass@...> wrote:
          >
          > Hi Jim,
          >
          > Suggest a period of learning! A great book is 'Linux Device Drivers'.
          >
          > If you are just wanting to read the timer in order to timestamp
          > something in user space, then perhaps you should create a driver which
          > allows it to be read. A cheap way is just to mmap() the timer and access
          > it directly like on the PIC. But if you need a driver to read something
          > and time stamp it, then check out that book.
          >
          > Regards,
          > Simon
          >
          > jim.norton@... wrote:
          > >
          > >
          > > Hello everybody,
          > >
          > > I'm new to embedded linux development. I want to write some routines
          > > that need 1uS timer resolution. I understand that the ARM9 processors
          > > have 16 bit hardware timers. The processor I'm using is a samsung
          > > S3C2410A.
          > >
          > > How do one use these timers in linux from 'C'. Anybody have any
          > > example code?
          > >
          > > Or does anybody have any good reference material that explains how to
          > > write Linux device driver code so that I might write a driver for
          > > linux to access the chips timers......?
          > >
          > > If I was writing is Assembly, as I do with PICS, it would probably be
          > > easy.. but this is the first time working with ARM9 and Linux....
          > >
          > > Any help or pointers are greatly appreciated...
          > >
          > > -Jim
          > >
          > >
          >
          > --
          >
          > --------------------------------------------------------------------------
          > Freecall Australia 1800 148 751 USA 1800 261 2934
          >
          > Bluewater Systems Ltd - ARM Technology Solution Centre
          >
          > Simon Glass Bluewater Systems Ltd
          > Phone: +64 3 3779127 Unit 5, 404 Barbadoes St
          > Fax: +64 3 3779135 PO Box 13889
          > Email: sglass@... Christchurch
          > Web: http://www.bluewatersys.com New Zealand
          >
        • Simon Glass
          Hi Jim, I haven t looked but I suspect that the hi-res timer is already used and available in the kernel. You might be lucky and find a device driver, but
          Message 4 of 5 , Apr 11, 2009
          • 0 Attachment
            Hi Jim,

            I haven't looked but I suspect that the 'hi-res' timer is already used and available in the kernel. You might be lucky and find a device driver, but since it takes more than 1us to get in and out of the driver from user space you might find that they haven't.

            Anyway, welcome to the modern world! :-)

            Regards,
            Simon

            jim.norton@... wrote:

            Thank you Simon. mmap() would be a quick and dirty way to access the timer registers.

            I was hoping that somebody had already written a device driver to use the timers on a Samsung ARM9 SC32410A processor.

            Anyways, I ordered 3 different books on writing software for embedded linux systems - one of which is a book about writing linux device drivers.

            I bought a Tin Can Tools "Hammer Kit" with which to learn about embedded linux... So the learning is in full swing... :-)

            I'm in shock right now having a background in PIC18 assembly. Seems everything is more complicated with an OS "in the way".. :-)

            --- In arm-user@yahoogroup s.com, Simon Glass <sglass@...> wrote:
            >
            > Hi Jim,
            >
            > Suggest a period of learning! A great book is 'Linux Device Drivers'.
            >
            > If you are just wanting to read the timer in order to timestamp
            > something in user space, then perhaps you should create a driver which
            > allows it to be read. A cheap way is just to mmap() the timer and access
            > it directly like on the PIC. But if you need a driver to read something
            > and time stamp it, then check out that book.
            >
            > Regards,
            > Simon
            >
            > jim.norton@. .. wrote:
            > >
            > >
            > > Hello everybody,
            > >
            > > I'm new to embedded linux development. I want to write some routines
            > > that need 1uS timer resolution. I understand that the ARM9 processors
            > > have 16 bit hardware timers. The processor I'm using is a samsung
            > > S3C2410A.
            > >
            > > How do one use these timers in linux from 'C'. Anybody have any
            > > example code?
            > >
            > > Or does anybody have any good reference material that explains how to
            > > write Linux device driver code so that I might write a driver for
            > > linux to access the chips timers...... ?
            > >
            > > If I was writing is Assembly, as I do with PICS, it would probably be
            > > easy.. but this is the first time working with ARM9 and Linux....
            > >
            > > Any help or pointers are greatly appreciated. ..
            > >
            > > -Jim
            > >
            > >
            >
            > --
            >
            > ------------ --------- --------- --------- --------- --------- -
            > Freecall Australia 1800 148 751 USA 1800 261 2934
            >
            > Bluewater Systems Ltd - ARM Technology Solution Centre
            >
            > Simon Glass Bluewater Systems Ltd
            > Phone: +64 3 3779127 Unit 5, 404 Barbadoes St
            > Fax: +64 3 3779135 PO Box 13889
            > Email: sglass@... Christchurch
            > Web: http://www.bluewate rsys.com New Zealand
            >


            -- 
            
            --------------------------------------------------------------------------
            Freecall Australia  1800 148 751     USA 1800 261 2934
            
            Bluewater Systems Ltd - ARM Technology Solution Centre
            
                   Simon Glass                              Bluewater Systems Ltd
            Phone: +64 3 3779127                            Unit 5, 404 Barbadoes St
            Fax:   +64 3 3779135                            PO Box 13889
            Email: sglass@...                  Christchurch
            Web:   http://www.bluewatersys.com              New Zealand
            
            
            
          • Gordon J Milne
            ... It is certainly more complicated but you get a lot of infrastructure for almost no cost. Infrastructure you might never have got around to writing because
            Message 5 of 5 , Apr 11, 2009
            • 0 Attachment
              jim.norton@... wrote:
              > I'm in shock right now having a background in PIC18 assembly. Seems
              > everything is more complicated with an OS "in the way".. :-)

              It is certainly more complicated but you get a lot of infrastructure for
              almost no cost. Infrastructure you might never have got around to
              writing because it always seemed that little bit too much, no matter how
              useful it might be one day.

              On the PIC you'd be so stuck for resource that you would never think
              about creating a universal development platform. You just don't have the
              space. With an OS, on a roomier CPU, you have access to a vast [as yet]
              undiscovered country that will assist you over and over again in the
              years to come.

              Regards,

              Gordon
            Your message has been successfully submitted and would be delivered to recipients shortly.