Skip to content

Commit

Permalink
Fixed regression in building scripts to allow project to be developed…
Browse files Browse the repository at this point in the history
… and built using Momentics.

- Removed IRQ_SCHED_PRIORITY_BOOST definition from CMakeLists.txt and instead introduced the shared config CONFIG_IRQ_SCHED_PRIORITY_BOOST to handle the schedule priority of transmission and interrupt processing value.
  • Loading branch information
Deniz-Eren committed May 16, 2024
1 parent d988f3e commit 1baaa7c
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ file( STRINGS "${PROJECT_SOURCE_DIR}/config/CONFIG_QNX_RESMGR_SINGLE_THREAD"
file( STRINGS "${PROJECT_SOURCE_DIR}/config/CONFIG_QNX_RESMGR_THREAD_POOL"
CONFIG_QNX_RESMGR_THREAD_POOL )

file( STRINGS "${PROJECT_SOURCE_DIR}/config/CONFIG_IRQ_SCHED_PRIORITY_BOOST"
CONFIG_IRQ_SCHED_PRIORITY_BOOST )

add_compile_options( -Wall )

add_compile_definitions( PROGRAM_VERSION="${PROGRAM_VERSION}" )
Expand All @@ -75,6 +78,9 @@ add_compile_definitions(
add_compile_definitions(
CONFIG_QNX_RESMGR_THREAD_POOL=${CONFIG_QNX_RESMGR_THREAD_POOL} )

add_compile_definitions(
CONFIG_IRQ_SCHED_PRIORITY_BOOST=${CONFIG_IRQ_SCHED_PRIORITY_BOOST} )

add_compile_definitions( DEVCANLINUX_SYSLOG=1 )
add_compile_definitions( DEVCANLINUX_STDERR=1 )

Expand All @@ -86,11 +92,6 @@ project( dev-can-linux
VERSION ${PROGRAM_VERSION}
LANGUAGES C CXX )

set( IRQ_SCHED_PRIORITY_BOOST "20" CACHE STRING
"Schedule priority of transmission and interrupt processing" )

add_compile_definitions( IRQ_SCHED_PRIORITY_BOOST=${IRQ_SCHED_PRIORITY_BOOST} )

set( SSH_PORT "6022" CACHE STRING "SSH port number" )

include( CodeCoverageProfiler )
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ CCFLAGS += -DCONFIG_QNX_INTERRUPT_MASK_ISR=`cat "config/CONFIG_QNX_INTERRUPT_MAS
CCFLAGS += -DCONFIG_QNX_INTERRUPT_MASK_PULSE=`cat "config/CONFIG_QNX_INTERRUPT_MASK_PULSE"`
CCFLAGS += -DCONFIG_QNX_RESMGR_SINGLE_THREAD=`cat "config/CONFIG_QNX_RESMGR_SINGLE_THREAD"`
CCFLAGS += -DCONFIG_QNX_RESMGR_THREAD_POOL=`cat "config/CONFIG_QNX_RESMGR_THREAD_POOL"`
CCFLAGS += -DCONFIG_IRQ_SCHED_PRIORITY_BOOST=`cat "config/CONFIG_IRQ_SCHED_PRIORITY_BOOST"`

#
# Linux Kernel configuration macros
Expand Down
1 change: 1 addition & 0 deletions config/CONFIG_IRQ_SCHED_PRIORITY_BOOST
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
4 changes: 2 additions & 2 deletions src/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
terminate_event.sigev_coid = coid;
terminate_event.sigev_code = 0; // not needed for termination
terminate_event.sigev_priority =
param.sched_priority + IRQ_SCHED_PRIORITY_BOOST;
param.sched_priority + CONFIG_IRQ_SCHED_PRIORITY_BOOST;
}

irq_group_t* group = irq_to_group_map[irq];
Expand Down Expand Up @@ -181,7 +181,7 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
irq_attach[k].event.sigev_coid = coid;
irq_attach[k].event.sigev_code = k;
irq_attach[k].event.sigev_priority =
param.sched_priority + IRQ_SCHED_PRIORITY_BOOST;
param.sched_priority + CONFIG_IRQ_SCHED_PRIORITY_BOOST;

irq_attach[k].irq = group->irq[i];
irq_attach[k].irq_entry = i;
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ int main (int argc, char* argv[]) {

pthread_attr_setinheritsched(&irq_thread_attr, PTHREAD_EXPLICIT_SCHED);

param.sched_priority += IRQ_SCHED_PRIORITY_BOOST;
param.sched_priority += CONFIG_IRQ_SCHED_PRIORITY_BOOST;
pthread_attr_setschedparam(&irq_thread_attr, &param);

pthread_create(&irq_thread, &irq_thread_attr, &irq_loop, NULL);
Expand Down
2 changes: 2 additions & 0 deletions src/prints.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ void print_configs (void) {
CONFIG_QNX_RESMGR_SINGLE_THREAD);
printf("CONFIG_QNX_RESMGR_THREAD_POOL=%d\n",
CONFIG_QNX_RESMGR_THREAD_POOL);
printf("CONFIG_IRQ_SCHED_PRIORITY_BOOST=%d\n",
CONFIG_IRQ_SCHED_PRIORITY_BOOST);

return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ create_device_session (struct net_device* dev, const queue_attr_t* tx_attr) {
pthread_attr_setinheritsched( &new_device->tx_thread_attr,
PTHREAD_EXPLICIT_SCHED );

param.sched_priority += IRQ_SCHED_PRIORITY_BOOST;
param.sched_priority += CONFIG_IRQ_SCHED_PRIORITY_BOOST;
pthread_attr_setschedparam(&new_device->tx_thread_attr, &param);

pthread_create( &new_device->tx_thread, &new_device->tx_thread_attr,
Expand Down

0 comments on commit 1baaa7c

Please sign in to comment.