This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
查看函数"F2837xD_SWPrioritizeIsrLeels.h" ;我对 以下代码有几个问题:
#if (INT1PL =0)
#define MINT1_1PL ~(1 << 0); // MZ:A<"shift="" left".="" the="" bitwise="" representation="" of="" a="" is="" shifted="" left="" b="" bits.="" this="" same="" as="" multiplying="" by="" (2="" to="" power="" b), ="" ="" MINT1_1PL=1*2^0=1。
其他
#define MINT1_1PL 0xFFFF
#endif
#if (INT2PL >= INT1PL)||(INT2PL =0) //MZ:如果全局 interrupt2优先级大于或等于全局 interrupt1优先级或等于零。
#define MINT1_2PL ~(1 << 1) //MZ:全局中断#1的屏蔽、其组编号2的中断优先级等于2^1;MIT1_2PL = 2
其他
#define MINT1_2PL 0xFFFF
#endif
#if (INT3PL >= INT1PL)||(INT3PL =0)
#define MINT1_3PL ~(1 << 2) //MZ:全局中断#1的屏蔽、其组号3的中断优先级等于2^2;MIT1_3PL = 4
其他
#define MINT1_3PL 0xFFFF
问题:
1) 1)上述代码的用途是什么?
2) 2)我们在上述代码中所做的是为中断分配优先级吗? 在这种情况下、我们不应该列出 MINTx PL、而应该列出 INTxPL。
3) 3)如果目标是创建一个屏蔽值、CPU 可以在 ISR 中使用该值、以允许 CPU 中断当前 ISR 并为新的更高优先级的 ISR 提供服务、那么为什么所有这些值都相同; 0xFFFF
谢谢
您好!
1.宏 MINT1_1PL 到 MINT1_16PL 用于创建宏 Mint1、其中与所有被禁用或优先级低于 INT1的中断相对应的位被设置为0。 它在 ISR 中用于禁用此类中断 并允许嵌套更高优先级的中断
您可以参考 C2000ware driverlib 中提供的中断优先级示例、并检查这些宏的实际值以更好地理解。
2.指定优先级是 作为 sw_prioritized_isr_levels.h 文件的一部分完成的,其中宏 INTxPL 和 GX_yPL 配置了所需的优先级。 此处列出的宏是 sw_interrupt_prioritization_logic.h 的一部分、用户不应更新它。 如第1部分所述、这用于根据用户配置的优先级创建可在 ISR 代码中使用的宏
这些宏将 MINT1_1PL 更改为 MINT1_16PL 设置各个 位(例如:对于位0、它将是 FFFF 或 FFFE 等)、稍后使用& 运算符进行组合
您的帖子中有一个更正:
[引用 userid="421967" URL"~μ C/support/microcontrollers/C2000-microcontrollers-group/C2000/f/C2000-microcontrollers-forum/1111336/How-isr-interrupt-mask-value-works ~定义 MINT1_1PL (1 << 0); // MZ:A<"shift="" left".="" the="" bitwise="" representation="" of="" a="" is="" shifted="" left="" b="" bits.="" this="" same="" as="" multiplying="" by="" (2="" to="" power="" b), ="" ="" MINT1_1PL=1*2^0=1。MINT1_1PL 为~(1)= 0xFFFE
此致、
Veena