ISR and a normal function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vhanwaribrahim@gmail.com

    ISR and a normal function

    Hi all,

    Can any one tell the actual differences between a software ISR in C
    and a normal C function?
    What are the things to be taken care when writing an ISR in C?
    I have an embedded hardware with l2/l3 switching logic. I want to
    register for an interrupt with the hardware and i want an ISR in C to
    get executed for that interrupt.

    With Regards
    Anwar


  • Jim Langston

    #2
    Re: ISR and a normal function

    vhanwaribrahim@ gmail.com wrote:
    Hi all,
    >
    Can any one tell the actual differences between a software ISR in C
    and a normal C function?
    What are the things to be taken care when writing an ISR in C?
    I have an embedded hardware with l2/l3 switching logic. I want to
    register for an interrupt with the hardware and i want an ISR in C to
    get executed for that interrupt.
    ISR? Do you mean a TSR? I haven't heard of an ISR.

    --
    Jim Langston
    tazmaster@rocke tmail.com


    Comment

    • Spiros Bousbouras

      #3
      Re: ISR and a normal function

      On 21 May, 13:43, "Jim Langston" <tazmas...@rock etmail.comwrote :
      vhanwaribra...@ gmail.com wrote:
      Hi all,
      >
      Can any one tell the actual differences between a software ISR in C
      and a normal C function?
      What are the things to be taken care when writing an ISR in C?
      I have an embedded hardware with l2/l3 switching logic. I want to
      register for an interrupt with the hardware and i want an ISR in C to
      get executed for that interrupt.
      >
      ISR? Do you mean a TSR? I haven't heard of an ISR.
      I presume ISR = Interrupt Service Routine.

      Comment

      • James Beck

        #4
        Re: ISR and a normal function

        In article <0f373d8e-9264-48fa-a4b6-79ac944cf5d8
        @d1g2000hsg.goo glegroups.com>, spibou@gmail.co m says...
        On 21 May, 13:43, "Jim Langston" <tazmas...@rock etmail.comwrote :
        vhanwaribra...@ gmail.com wrote:
        Hi all,
        Can any one tell the actual differences between a software ISR in C
        and a normal C function?
        What are the things to be taken care when writing an ISR in C?
        I have an embedded hardware with l2/l3 switching logic. I want to
        register for an interrupt with the hardware and i want an ISR in C to
        get executed for that interrupt.
        ISR? Do you mean a TSR? I haven't heard of an ISR.
        >
        I presume ISR = Interrupt Service Routine.
        >
        >
        Yep, and I'm pretty sure any support for hardware and software
        interrupts are a compiler specific extension and not standard C.

        Jim

        Comment

        • vippstar@gmail.com

          #5
          Re: ISR and a normal function

          On May 21, 3:58 pm, James Beck <j...@reallykil lersystems.comw rote:
          In article <0f373d8e-9264-48fa-a4b6-79ac944cf5d8
          @d1g2000hsg.goo glegroups.com>, spi...@gmail.co m says...
          >
          On 21 May, 13:43, "Jim Langston" <tazmas...@rock etmail.comwrote :
          vhanwaribra...@ gmail.com wrote:
          Hi all,
          >
          Can any one tell the actual differences between a software ISR in C
          and a normal C function?
          What are the things to be taken care when writing an ISR in C?
          I have an embedded hardware with l2/l3 switching logic. I want to
          register for an interrupt with the hardware and i want an ISR in C to
          get executed for that interrupt.
          >
          ISR? Do you mean a TSR? I haven't heard of an ISR.
          >
          I presume ISR = Interrupt Service Routine.
          >
          Yep, and I'm pretty sure any support for hardware and software
          interrupts are a compiler specific extension and not standard C.
          Well, signals are interrupts aren't they? Standard C has <signal.h>.

          Comment

          • James Beck

            #6
            Re: ISR and a normal function

            In article <bb1689f3-74ee-477f-9e43-8d23457bba24
            @t54g2000hsg.go oglegroups.com> , vippstar@gmail. com says...
            On May 21, 3:58 pm, James Beck <j...@reallykil lersystems.comw rote:
            In article <0f373d8e-9264-48fa-a4b6-79ac944cf5d8
            @d1g2000hsg.goo glegroups.com>, spi...@gmail.co m says...
            On 21 May, 13:43, "Jim Langston" <tazmas...@rock etmail.comwrote :
            vhanwaribra...@ gmail.com wrote:
            Hi all,
            Can any one tell the actual differences between a software ISR in C
            and a normal C function?
            What are the things to be taken care when writing an ISR in C?
            I have an embedded hardware with l2/l3 switching logic. I want to
            register for an interrupt with the hardware and i want an ISR in C to
            get executed for that interrupt.
            ISR? Do you mean a TSR? I haven't heard of an ISR.
            I presume ISR = Interrupt Service Routine.
            Yep, and I'm pretty sure any support for hardware and software
            interrupts are a compiler specific extension and not standard C.
            Well, signals are interrupts aren't they? Standard C has <signal.h>.
            >
            Can you use that to handle a UART interrupt?
            From what I see SIGXXXX is pretty OS specific, ANSI or not.
            SIGINT in MS-DOS is int0x23, program termination. Not very useful for
            anything other than executing some custom shutdown/exit routine.

            Jim

            Comment

            • Richard Tobin

              #7
              Re: ISR and a normal function

              In article <bb1689f3-74ee-477f-9e43-8d23457bba24@t5 4g2000hsg.googl egroups.com>,
              <vippstar@gmail .comwrote:
              >Yep, and I'm pretty sure any support for hardware and software
              >interrupts are a compiler specific extension and not standard C.
              >Well, signals are interrupts aren't they?
              True in a sense, but probably not relevant to the OP's situation.

              C's and Unix's signals are an abstraction of hardware interrupts.
              When, say, a segmentation violation happens the processor gets an
              interrupt, which is handled by the kernel. That handling may involve
              calling a signal handler in the affected C program. But there is no
              necessary relation between the calling convention used by the hardware
              interrupt and that used by the resulting C signal. The call to the
              signal handler is just like any other function call - or at least,
              sufficiently like it that the signal handler can be used a a normal C
              function, while the call to the interrupt handler probably uses a
              quite different convention, probably a very minimal one that requires
              the called function to save registers and so on.

              -- Richard
              --
              :wq

              Comment

              • vhanwaribrahim@gmail.com

                #8
                Re: ISR and a normal function

                On May 21, 7:44 pm, rich...@cogsci. ed.ac.uk (Richard Tobin) wrote:
                In article <bb1689f3-74ee-477f-9e43-8d23457bb...@t5 4g2000hsg.googl egroups.com>,
                >
                 <vipps...@gmail .comwrote:
                Yep, and I'm pretty sure any support for hardware and software
                interrupts are a compiler specific extension and not standard C.
                Well, signals are interrupts aren't they?
                >
                True in a sense, but probably not relevant to the OP's situation.
                >
                C's and Unix's signals are an abstraction of hardware interrupts.
                When, say, a segmentation violation happens the processor gets an
                interrupt, which is handled by the kernel.  That handling may involve
                calling a signal handler in the affected C program.  But there is no
                necessary relation between the calling convention used by the hardware
                interrupt and that used by the resulting C signal.  The call to the
                signal handler is just like any other function call - or at least,
                sufficiently like it that the signal handler can be used a a normal C
                function, while the call to the interrupt handler probably uses a
                quite different convention, probably a very minimal one that requires
                the called function to save registers and so on.
                >
                -- Richard
                --
                :wq
                Hi Richard,
                I have heard that when you are writing an interrrupt service routine
                (ISR), it should not
                use semaphores or mutexes and not to use printfs inside ISR.
                Whats the exact reason behind this?

                With Regards
                Anwar

                Comment

                • Richard Tobin

                  #9
                  Re: ISR and a normal function

                  In article <0c1952ed-27bf-42b2-a91f-de14ebe9c1bc@l2 8g2000prd.googl egroups.com>,
                  <vhanwaribrahim @gmail.comwrote :
                  >I have heard that when you are writing an interrrupt service routine
                  >(ISR), it should not
                  >use semaphores or mutexes and not to use printfs inside ISR.
                  >Whats the exact reason behind this?
                  Obviously you don't want an interrupt handler to block the operating
                  system from doing other things for more than a few nanoseconds, but
                  exactly what that implies depends on your system.

                  -- Richard
                  --
                  :wq

                  Comment

                  Working...