Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Private interrupt binding for SylixOS Zynq platform

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. Overview

This article mainly introduces the binding methods related to CPU private interrupts when writing interrupt-related drivers on Zynq platform.

two。 Introduction to private interrupts

Private interrupts are unique interrupts on multicore CPU. Private interrupts can only be obtained and responded to by its owner core and will not be discovered by other cores. Common private interrupts are global timers, private watchdog timers, private timers, etc. There is also FIQ\ IRQ from PL on the Zynq platform.

3. Binding method of private interrupts 3.1 General shared interrupt binding

The Zynq platform uses the GIC general interrupt framework. There is no difference between the conventional shared interrupt binding and the ordinary interrupt binding. The two functions API_InterVectorConnect and API_InterVectorEnable can be bound directly on the SylixOS. After binding, the interrupt can be responded by any CPU core.

3.2 Private interrupt binding

Private interrupts can only be obtained and responded to by the owner core, so the corresponding interrupts and interrupt services are bound to the relevant CPU core. Binding private interrupts under SylixOS requires the binding process of regular shared interrupts to be completed on the corresponding CPU core to bind successfully. That is, when driving the binding private interrupt, a binding thread bound to the corresponding CPU core is created, and then the binding thread completes the private interrupt binding. The binding process is shown in figure 3.1.

Figure 3.1 Private interrupt binding process

The private timer interrupt binding framework for Zynq platform 31 is shown in listing 3.1.

Listing 3.1 Private timer interrupt binding framework for Zynq platform 31

# define ZYNQ_VECTOR_NIRQ 31 / * 31 Private interrupt * / static LW_HANDLE _ G_bindthread = LW_OBJECT_HANDLE_INVALID;static LW_HANDLE _ G_syncSignal = LW_OBJECT_HANDLE_INVALID / * function name: _ _ nIrqIsr** function description: interrupt service program * * input: pvArg** output : NONE** returned: LW_NULL****/static irqreturn_t _ _ nIrqIsr (PVOID pvArg) {return LW_IRQ_HANDLED } / * function name: _ _ bindThread** description: private interrupt binding thread * * input: pvArg** input Output: NONE** return: LW_NULL****/static PVOID _ _ bindThread (PVOID pvArg) {API_SemaphoreBPend (_ G_syncSignal) LW_OPTION_WAIT_INFINITE) / * wait for synchronization semaphore * / API_InterVectorConnect (ZYNQ_VECTOR_NIRQ, / * connection interrupt service program * / (PINT_SVR_ROUTINE) _ nIrqIsr, (PVOID) NULL, "nIrq"); API_InterVectorEnable (ZYNQ_VECTOR_NIRQ) / * enable interrupt * / * function name: _ _ nIrqInit** function description: Interrupt service initialization * * input: NONE** output: NONE** return: ERROR_NONE returned successfully Failed to return PX_ERROR****/INT _ _ nIrqInit (VOID) {LW_CLASS_CPUSET cpuset _ G_syncSignal = API_SemaphoreBCreate ("SYNCSEM", / * create synchronous wait signal * / 0, LW_OPTION_OBJECT_GLOBAL, LW_NULL) If (_ G_syncSignal = = LW_OBJECT_HANDLE_INVALID) {/ * determine whether semaphore creation is successful * / printk ("BIND signal init failed!\ r\ n"); return PX_ERROR;} / * * set thread CPU binding property * / LW_CPU_ZERO (& cpuset); LW_CPU_SET (0, & cpuset) _ G_bindthread = API_ThreadCreate ("bindThread", / * create binding thread * / _ _ bindThread, LW_NULL, LW_NULL) If (_ G_bindthread = = LW_OBJECT_HANDLE_INVALID) {/ * determine whether the binding thread is created successfully * / printk ("BIND thread init failed!\ r\ n"); return PX_ERROR;} API_ThreadSetAffinity (_ G_bindthread, / * set the binding thread to CPU0 * / sizeof (cpuset), & cpuset); API_SemaphoreBPost (_ G_syncSignal) / * signal to start the binding thread * /}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report