Skip to content

Instantly share code, notes, and snippets.

View gauthamkantharaju's full-sized avatar

Gautham Kantharaju gauthamkantharaju

View GitHub Profile
@gauthamkantharaju
gauthamkantharaju / timer.c
Created September 20, 2013 03:50
Timers in device drivers
#include "timer.h"
#define MAX_SIZE 48
static int timer_val = 100;
module_param(timer_val, int, 0);
MODULE_PARM_DESC(timer_val, "Configurable, default timer is set to 100msec's");
static int arr[10];
static int p;
@gauthamkantharaju
gauthamkantharaju / list.c
Created September 20, 2013 03:48
Linked list usage in device drivers
#include "list.h"
/**
* Global variable declaration section
*/
struct todo_struct
{
S32 priority; /* driver specific */
S8 *name;
struct list_head list;
@gauthamkantharaju
gauthamkantharaju / thread.c
Created September 20, 2013 03:47
Kernel thread usage in device driver
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/kthread.h>
#include <linux/sched.h>
#include <linux/delay.h>
MODULE_LICENSE("GPL");
@gauthamkantharaju
gauthamkantharaju / debugfs.c
Created September 20, 2013 03:44
Simple character device driver with debugfs entry
#include "hello.h"
struct dentry *parent = NULL;
u32 test_db = 0;
CNTXT *db_struct = NULL;
char wrbuf[sizeof(CNTXT) * 5];
static
ssize_t db_read(struct file *filp, char __user *buf, size_t count,loff_t *fpos)