Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ jobs:
- name: Enable test suite
run: |
# Enable test suite, disable conflicting apps
sed -i 's/^CONFIG_PINGPONG=y/# CONFIG_PINGPONG is not set/' .config
echo "CONFIG_TESTS=y" >> .config
echo "# CONFIG_PINGPONG is not set" >> .config
echo "# CONFIG_L4_TEST is not set" >> .config
make oldconfig
python3 tools/kconfig/genconfig.py --header-path include/autoconf.h Kconfig

- name: Build kernel with tests
run: make
Expand Down
1 change: 0 additions & 1 deletion board/discoveryf4/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,4 @@ CONFIG_PINGPONG=y
# Test Cases
#
# CONFIG_EXTI_INTERRUPT_TEST is not set
CONFIG_L4_TEST=y
# CONFIG_LCD_TEST is not set
1 change: 0 additions & 1 deletion board/discoveryf429/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,4 @@ CONFIG_PINGPONG=y
# Test Cases
#
CONFIG_EXTI_INTERRUPT_TEST=y
CONFIG_L4_TEST=y
CONFIG_LCD_TEST=y
1 change: 0 additions & 1 deletion board/netduinoplus2/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,4 @@ CONFIG_PINGPONG=y
# Test Cases
#
# CONFIG_EXTI_INTERRUPT_TEST is not set
CONFIG_L4_TEST=y
# CONFIG_LCD_TEST is not set
1 change: 0 additions & 1 deletion board/nucleof429/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ CONFIG_ETH_USER_IRQ=y
CONFIG_BUILD_USER_APPS=y
CONFIG_PINGPONG=y
CONFIG_EXTI_INTERRUPT_TEST=y
CONFIG_L4_TEST=y
3 changes: 2 additions & 1 deletion include/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ typedef enum {
DL_SYSCALL = 0x0010,
DL_SCHEDULE = 0x0020,
DL_MEMORY = 0x0040,
DL_IPC = 0x0080
DL_IPC = 0x0080,
DL_NOTIFICATIONS = 0x0100 /* Unified notification system */
} dbg_layer_t;

#ifndef CONFIG_DEBUG
Expand Down
9 changes: 7 additions & 2 deletions include/interrupt_ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ enum {
IRQ_IPC_TID = 1,
IRQ_IPC_HANDLER = 2,
IRQ_IPC_ACTION = 3,
IRQ_IPC_PRIORITY = 4
IRQ_IPC_PRIORITY = 4,
IRQ_IPC_FLAGS = 5
};

#define IRQ_IPC_MSG_NUM IRQ_IPC_PRIORITY
#define IRQ_IPC_MSG_NUM IRQ_IPC_FLAGS

/* irq actions */
enum { USER_IRQ_ENABLE = 0, USER_IRQ_DISABLE = 1, USER_IRQ_FREE = 2 };

/* IRQ delivery mode flags */
#define IRQ_DELIVER_IPC 0x0000 /* Full IPC delivery (default) */
#define IRQ_DELIVER_NOTIFY 0x0001 /* Fast notification delivery */

#define USER_INTERRUPT_LABEL 0x928

#endif
39 changes: 39 additions & 0 deletions include/ktimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

#include <types.h>

/* Forward declaration */
struct tcb;

void ktimer_handler(void);

/* Returns 0 if successfully handled
Expand All @@ -22,14 +25,50 @@ typedef struct ktimer_event {

uint32_t delta;
void *data;

/* Notification mode: if notify_thread is non-NULL, timer uses
* async event notification instead of calling handler directly.
* This integrates with Event-Chaining + ASYNC_SOFTIRQ subsystem.
*/
struct tcb *notify_thread; /* Target thread for notification */
uint32_t notify_bits; /* Notification bit mask to signal */

/* Deadline tracking for periodic timers (prevents drift accumulation).
* For periodic timers, deadline tracks absolute target time.
* Reschedule based on: next_ticks = max(1, deadline - now)
* This maintains phase-lock to original schedule even if softirq delayed.
*/
uint64_t deadline; /* Absolute deadline (in ticks since boot) */
} ktimer_event_t;

void ktimer_event_init(void);

int ktimer_event_schedule(uint32_t ticks, ktimer_event_t *kte);

/* Callback-based timer (traditional API) */
ktimer_event_t *ktimer_event_create(uint32_t ticks,
ktimer_event_handler_t handler,
void *data);

/* Notification-based timer (Event-Chaining + ASYNC_SOFTIRQ integration).
* When timer expires, posts async event to notify_thread with notify_bits.
* Thread receives notification via Event-Chaining callback.
*
* @param ticks Timer period in ticks
* @param notify_thread Target thread to notify (must be valid TCB)
* @param notify_bits Notification bit mask to signal
* @param periodic If 0, one-shot timer. If non-zero, reschedule with same
* period.
* @return Allocated timer event, or NULL if pool exhausted
*
* NOTE: For one-shot timers, event is freed automatically after firing.
* For periodic timers, event remains allocated until explicitly freed.
*/
ktimer_event_t *ktimer_event_create_notify(uint32_t ticks,
struct tcb *notify_thread,
uint32_t notify_bits,
int periodic);

void ktimer_event_handler(void);

#ifdef CONFIG_KTIMER_TICKLESS
Expand Down
Loading
Loading