当前位置:网站首页>B_ QuRT_ User_ Guide(26)
B_ QuRT_ User_ Guide(26)
2022-06-28 08:08:00 【weixin_ thirty-eight million four hundred and ninety-eight thou】
B_QuRT_User_Guide(26)
16 System Clock
Thread usage QuRT System clock to create alarms and timers , Access the current system time , Or determine when the next timer event of any active timer occurs .
The system clock time indicates QuRT How long has the application system been running ( In system tick ). A system tick is defined as Hexagon The processor 19.2MHz QTIMER A cycle of a clock .
And conventional timers ( The first 15 section ) Different , System clock alerts and timers are global resources , You can notify multiple client threads of a clock event . When a client thread registers for a system clock event , It specifies a signal object and a signal mask .
The system clock alarm fails within the specified time , The system clock timer fails within the specified time . In both cases , When the event occurs , For each registered client thread , The signal specified in the registered signal mask is set in the registered signal object .
The system clock supports the following operations .
- qurt_sysclock_get_hw_ticks()
- qurt_sysclock_get_hw_ticks_32()
- qurt_sysclock_get_hw_ticks_16()
16.1 qurt_sysclock_get_hw_ticks()
16.1.1 Function document
16.1.1.1 unsigned long long qurt_sysclock_get_hw_ticks ( void )
Get hardware tick count .
Return to one 64 Current value of the bit hardware counter . When the maximum value is exceeded , The value is rounded to zero .
Be careful : This operation must be used with care , Because there is surround behavior .
Related data types
Integer - 64 Current value of the bit hardware counter .
Dependencies
None.
16.2 qurt_sysclock_get_hw_ticks_32()
16.2.1 Function document
16.2.1.1 int qurt_timer_base
obtain 32 Bit hardware tick count .
Return to one 32 Current value of the bit hardware counter . When the maximum value is exceeded , The value is rounded to zero .
Be careful : This operation is used as an inline C Functionally implemented , It should be from C/C++ Call in program . Back to 32 Is it Qtimer Counter low 32 position .
Return value
Integers - 32 Current value of the bit timer counter .
Dependencies
None.
16.3 qurt_sysclock_get_hw_ticks_16()
16.3.1 Function document
16.3.1.1 static unsigned short qurt_sysclock_get_hw_ticks_16 ( void )
obtain 16 Bit hardware tick count .
Return to one 16 Current value of the bit timer counter . When the maximum value is exceeded , The value is rounded to zero .
Be careful : This operation is used as an inline C Functionally implemented , It should be from C/C++ Call in program . Back to 16 Bit is based on Qtimer The counter is low 32 The value of a , Move right 16 position .
Return value
Integers - 16 Current value of the bit timer counter , from Qtimer Counter low 32 Bit calculated , Move right 16 position ..
Dependencies
None.
17 Interrupts
Threads use interrupts to respond to external events .
When registering an interrupt , It is enabled and associated with the specified signal object and signal mask . When an interrupt occurs , The signal specified in the signal mask is set in the signal object . In order to deal with interruptions , An interrupt service thread (IST) Usually wait on this signal .
When an interrupt occurs, it is automatically disabled . To re enable an interrupt ,IST After processing the interrupt , Before pausing yourself ( for example , By waiting for an interrupt signal ), Perform the operation of confirming the interrupt . When an interrupt is deregistered , It is disabled , No longer associated with any signal .
A signal object can be registered at most 31 Separate interrupts , This is determined by the number of independent signals that the object can store .( The signal 31 from QuRT Retain .) So a IST Can handle several different interrupts .
Be careful : A signal object can only be registered to a specific interrupt . Registering multiple semaphore objects on an interrupt raises an exception ( The first 19 section ).
As IST The thread of must not call the exit thread operation .
Interrupts do not support init and destroy operation , Because no objects were created for them ( The first 2.4 section ).
Explicitly clear a pending interrupt with the clear interrupt operation .
Be careful : This operation is used at the system level , Must be used with caution .
All interrupts are based on L2VIC Interrupt the controller . Use L2VIC The interrupt number specifies all interrupts .
L2VIC Interrupts can be dynamically configured to different types ( Edge trigger or level trigger ) Or polarity ( Active low or active high ).
Be careful :L2VIC Interrupt must be unregistered before reconfiguration . Interrupts are processor resources , It supports the following operations .
- qurt_interrupt_acknowledge() - qurt_interrupt_clear()
- qurt_interrupt_deregister()
- qurt_interrupt_disable()
- qurt_interrupt_enable()
- qurt_interrupt_get_config()
- qurt_interrupt_raise()
- qurt_interrupt_register()
- qurt_interrupt_set_config() - qurt_interrupt_status()
- qurt_interrupt_get_status().Constants
17.1 qurt_interrupt_acknowledge()
17.1.1 Function document
17.1.1.1 int qurt_interrupt_acknowledge ( int int_num )
After the interrupt is processed , Confirm the interrupt .
Re enable an interrupt , And clear its pending state . This is interrupting the service thread (IST) After handling an interrupt .
When an interrupt occurs, it is automatically disabled . To re enable an interrupt ,IST After processing the interrupt , Before pausing yourself ( For example, wait for an interrupt signal ), Perform the confirmation operation .
Be careful : To prevent subsequent interruptions from being lost or reprocessed ,IST The interrupt signal must be cleared before the interrupt is acknowledged (9.1.1.1 section ).
Parameters 
Return value
QURT_EOK - Interrupt confirmation succeeded .QURT_EDEREGISTERED - Interrupt has been unregistered .
Dependencies
None.
17.2 qurt_interrupt_clear()
17.2.1 Function document
17.2.1.1 unsigned int qurt_interrupt_clear ( int int_num )
Parameters 
Return value
QURT_EOK - success .
QURT_EINT - Invalid interrupt number .
Dependencies
None.
17.3 qurt_interrupt_deregister()
17.3.1 Function document
17.3.1.1 unsigned int qurt_interrupt_deregister ( int int_num )
Disable the specified interrupt , And compare it with any QuRT Signal object disassociates . If the specified interrupt
Never registered ( The first 17.8.1.1 section ), The unregistered operation will return the status value QURT_EINT.
Be careful : If the service thread is interrupted (IST) Cancel registration while waiting for receiving interrupt ,IST May wait indefinitely for an interrupt to occur . To avoid this problem ,QuRT The kernel is determining IST After no registration interruption , Will send a signal SIG_INT_ABORT To wake it up .
Parameters 
Return value
QURT_EOK – Success.
QURT_EINT – Invalid interrupt number (not registered).
Dependencies
None.
边栏推荐
猜你喜欢
随机推荐
Trigonometric transformation formula
sql主從複制搭建
Jacobian matrix J commonly used in slam
es数据导出csv文件
Redis uses sentinel master-slave switching. What should the program do?
Devops Basics: Jenkins deployment and use (I)
nlp序列完全可以模拟人脑智能
Leetcode摆动序列系列
B_QuRT_User_Guide(26)
券商注册开户靠谱吗?安全吗?
MySQL implements transaction persistence using redo logs
云原生:云计算技术再次升级 开启全面云开发时代
cuda和cudnn和tensorrt的理解
【学习笔记】拟阵
Airflow2.x distributed deployment DAG execution failure log cannot be obtained normally
js运算符的优先级
LeetCode之三步问题
Today's notes 22/1/7
Configuring MySQL multi instance master-slave synchronization for Linux
Disposition Flex









