VxWorks service interruption program

Source: Internet
Author: User
Tags syslog
Service Interruption Program It is an important part of the device driver. In order to respond to external interruptions in a timely manner and prevent interruption loss, the interrupted service program should be as small as possible, and only the most necessary tasks should be placed
Run the command in the interrupted service program. Generally, after the system is started and the hardware device is initialized, the ISR and the interrupt vector are mounted: the interrupt vector can be mounted at any time after the system is started. The last one is often used in debugging.
Method. There are two different functions in VxWorks that provide suspension interruption: intconnect and pciintconnect. The difference between the two is that intconnect uses
The interrupt vector is exclusive, while pcilntconnect can share the interrupt vector among different ISRs. In fact, pcilntconnect is called internally.
The intconnect function uses a linked list internally to manage multiple ISRs. Pcilntconnect requires that the hardware register be checked every time you enter ISR to confirm the interrupted
It is indeed generated by the hardware of the ISR service. If the hardware register indicates that the hardware has not been interrupted, ISR immediately exits to enable other ISR mounted on the same interrupt vector to check whether there is any interrupt production.
Raw. In pcilntlib. C Code This problem is clearly explained:
Void pciint (int irq ){
Pcllnt RTN * prtn;
For (PRM = (pci_int_rtn *) dll_first (& pcilntlist [IRQ]);
Prtn! = NULL;
Prtn = (pci_int_rtn *) dll_next (& prtn-> node ))
(* Prtn-> routine) (prtn-> parameter );
}

When an interruption occurs on the PCI bus, the system calls void pcilnt (int
IRQ) function, and then the pciint uses the internal linked list to call the ISR hanging on the interrupt in sequence. If an ISR fails to exit normally, the operations of other ISR will be affected. During debugging
Check whether the interrupt vector is connected to ISR reliably. You can directly call pciint on the command line or program to check whether ISR is triggered. Be careful when the hardware is determined.
Different hardware uses different interruptions, so that intconnect can be directly used for devices on PCI.

It should be noted that the process of mounting the interrupt vector to ISR is not simply to set the interrupt vector value in the vector table. In addition to setting the interrupt vector value, VxWorks also adds an ISR that is connected to the interrupt vector
Thin Layer packaging, including storing register values before ISR execution. Setting the stack and restoring the register and stack after ISR execution. In the case of frequent interruptions, the interrupted Stack may be exhausted and overflow occurs. To avoid
Without the above situation, you must modify the size of the system's interrupt stack, that is, add the following code in config. h:
# Define include_kernel
# Define isr_stack_size 0xl000 // the size of the interrupt stack in the system is 4 K
By
For the special nature of the interrupt handler, the interrupt handler cannot use functions that may cause blocking, such as printf and semtake. The list of unavailable functions can be found in <
Vxwoks programmer
Guide>. Sometimes, to facilitate debugging and print some information in ISR, the system provides a function syslog equivalent to prinf, which is acceptable.
Seven parameters. It is non-blocking. In comparison, the prinf function returns the result only after the print task is completed. The syslog function returns the result only when the print task is put in the system's print queue. Although not in ISR
To use semtake, but you can use semgive (except for mutex type ). Generally, semtake and semgive are used for communication between ISR and Common Programs: When an interrupted production
Raw, ISR
After completing the necessary tasks, call semgive to notify another task that uses semtake to wait for the ISR signal. After receiving the signal released by semgive, the task continues to complete
The task to be processed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.