chore(skeleton): refactor all serie exercices intoi subfolders
This commit is contained in:
12293
doc/lab-01_02.pdf
Normal file
12293
doc/lab-01_02.pdf
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,13 +2,11 @@
|
|||||||
#include <linux/init.h> // needed for macros
|
#include <linux/init.h> // needed for macros
|
||||||
#include <linux/kernel.h> // needed for debugging
|
#include <linux/kernel.h> // needed for debugging
|
||||||
|
|
||||||
|
|
||||||
#include <linux/kthread.h>
|
#include <linux/kthread.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/wait.h>
|
#include <linux/wait.h>
|
||||||
#include <linux/atomic.h>
|
#include <linux/atomic.h>
|
||||||
|
|
||||||
|
|
||||||
#define TIMEOUT_S 5
|
#define TIMEOUT_S 5
|
||||||
|
|
||||||
DECLARE_WAIT_QUEUE_HEAD(queue_1);
|
DECLARE_WAIT_QUEUE_HEAD(queue_1);
|
||||||
@@ -18,7 +16,6 @@ static struct task_struct* thread_1;
|
|||||||
static struct task_struct* thread_2;
|
static struct task_struct* thread_2;
|
||||||
static atomic_t trigger = ATOMIC_INIT(0);
|
static atomic_t trigger = ATOMIC_INIT(0);
|
||||||
|
|
||||||
|
|
||||||
int thread_skeleton_1(void* data) {
|
int thread_skeleton_1(void* data) {
|
||||||
// must wait 5 seconds and start thread 2
|
// must wait 5 seconds and start thread 2
|
||||||
|
|
||||||
@@ -36,7 +33,6 @@ int thread_skeleton_1(void* data) {
|
|||||||
|
|
||||||
// Wait until thread 2 has reset the trigger
|
// Wait until thread 2 has reset the trigger
|
||||||
wait_event_interruptible(queue_1, atomic_read(&trigger) == 0 || kthread_should_stop());
|
wait_event_interruptible(queue_1, atomic_read(&trigger) == 0 || kthread_should_stop());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -4,22 +4,22 @@
|
|||||||
#include <linux/kernel.h> // needed for debugging
|
#include <linux/kernel.h> // needed for debugging
|
||||||
|
|
||||||
#include "linux/printk.h"
|
#include "linux/printk.h"
|
||||||
#include "s02e02-parameters.c"
|
#include "s02-kernel-module/s02e02-parameters.c"
|
||||||
// #define PARAMETERS
|
// #define PARAMETERS
|
||||||
|
|
||||||
#include "s02e04-dynamic_allocation.c"
|
#include "s02-kernel-module/s02e04-dynamic_allocation.c"
|
||||||
// #define DYNAMIC_ALLOCATION
|
// #define DYNAMIC_ALLOCATION
|
||||||
|
|
||||||
#include "s02e05-io_memory_mapped.c"
|
#include "s02-kernel-module/s02e05-io_memory_mapped.c"
|
||||||
// #define IO_MEMORY_MAPPED
|
// #define IO_MEMORY_MAPPED
|
||||||
|
|
||||||
#include "s02e06-thread.c"
|
#include "s02-kernel-module/s02e06-thread.c"
|
||||||
// #define THREAD
|
// #define THREAD
|
||||||
|
|
||||||
#include "s02e07-sleeping.c"
|
#include "s02-kernel-module/s02e07-sleeping.c"
|
||||||
// #define SLEEPING
|
// #define SLEEPING
|
||||||
|
|
||||||
#include "s02e08-interrupt.c"
|
#include "s02-kernel-module/s02e08-interrupt.c"
|
||||||
#define INTERRUPT
|
#define INTERRUPT
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user