op_intrpt_priority_get()
摘要
获取与指定类型和代码相匹配的中断的优先级设置。
语法
op_intrpt_priority_get (type, code)
| 参数 | 类型 | 说明 |
|---|---|---|
type |
int |
中断类型 [这是一个整数数字代码,表示可能的中断类型之一(参见表 59 “Interrupt Type Symbolic Constants“ 第 15 页)。] |
code |
int |
与中断相关联的用户定义数字代码 [对于自中断、远程中断和组播中断,该参数是代码值;对于数据包流中断,它是输入流索引;对于统计量中断,它是输入统计量索引。] |
返回类型
int
与指定类型和代码相匹配的中断的优先级赋值。
如果发生可恢复错误,将返回常量 OPC_INTRPT_PRIORITY_INVALID。
示例
/* Obtain the priority of self interrupts with code 0 */
prio_value = op_intrpt_priority_get (OPC_INTRPT_SELF, 0);
/* If the value was successfully obtained, set self interrupts */
/* with code 1 to the same. */
if (prio_value != OPC_INTRPT_PRIORITY_INVALID)
op_intrpt_priority_set (OPC_INTRPT_SELF, 1, prio_value);
详情
该内核过程返回调用模块的中断类型和代码的优先级值。每个模块都可以使用内核过程 op_intrpt_priority_set() 按其处理需要对接入中断设置优先级。所有中断的默认优先级值为 0。
注意: 并行内核不支持该内核过程。有关详情,参见“Unsafe and Unsupported KPs“ 第 426 页。
用途
该内核过程可用于检索指定中断类型和代码的优先级设置。模块可能需要验证优先级是否已正确设置。
错误
- 程序中止:内核过程需要进程上下文。
- 可恢复错误:中断类型 (
<type>) 无法识别。
参考
- 使用内核过程 op_intrpt_priority_set() 设置中断的优先级
- 使用内核过程 op_intrpt_priority_set_next() 仅设置中断下一次出现时的优先级