-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed ioctl to allow for variable amount of debug printing at cc2520.ko runtime. This way applications can completely turn off debug output, or enable full debug output without having to recompile the module. Defaults to INFO level printing, as before.
- Loading branch information
Showing
12 changed files
with
125 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef DEBUG_H | ||
#define DEBUG_H | ||
|
||
// Define different levels of debug printing | ||
|
||
// print nothing | ||
#define DEBUG_PRINT_OFF 0 | ||
// print only when something goes wrong | ||
#define DEBUG_PRINT_ERR 1 | ||
// print occasional messages about interesting things | ||
#define DEBUG_PRINT_INFO 2 | ||
// print a good amount of debuging output | ||
#define DEBUG_PRINT_DBG 3 | ||
|
||
// Defines the level of debug output | ||
extern uint8_t debug_print; | ||
|
||
// Define the printk macros. | ||
#define ERR(x) do {if (debug_print >= DEBUG_PRINT_ERR) { printk x; }} while (0) | ||
#define INFO(x) do {if (debug_print >= DEBUG_PRINT_INFO) { printk x; }} while (0) | ||
#define DBG(x) do {if (debug_print >= DEBUG_PRINT_DBG) { printk x; }} while (0) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#ifndef INTERFACE_H | ||
#define iNTERFACE_H | ||
#define INTERFACE_H | ||
|
||
// Interface | ||
int cc2520_interface_init(void); | ||
void cc2520_interface_free(void); | ||
|
||
extern struct cc2520_interface *interface_bottom; | ||
|
||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include <linux/module.h> | ||
#include <linux/module.h> | ||
#include <linux/kernel.h> | ||
#include <linux/interrupt.h> | ||
#include <linux/gpio.h> | ||
|
@@ -17,9 +17,13 @@ | |
#include "sack.h" | ||
#include "csma.h" | ||
#include "unique.h" | ||
#include "debug.h" | ||
|
||
#define DRIVER_AUTHOR "Andrew Robinson <[email protected]>" | ||
#define DRIVER_DESC "A driver for the CC2520 radio. Be afraid." | ||
#define DRIVER_AUTHOR "Andrew Robinson <[email protected]>" | ||
#define DRIVER_DESC "A driver for the CC2520 radio. Be afraid." | ||
#define DRIVER_VERSION "0.5" | ||
|
||
uint8_t debug_print; | ||
|
||
struct cc2520_state state; | ||
const char cc2520_name[] = "cc2520"; | ||
|
@@ -48,11 +52,13 @@ int init_module() | |
{ | ||
int err = 0; | ||
|
||
debug_print = DEBUG_PRINT_INFO; | ||
|
||
setup_bindings(); | ||
|
||
memset(&state, 0, sizeof(struct cc2520_state)); | ||
INFO((KERN_INFO "loading CC2520 Kernel Module v0.01...\n")); | ||
|
||
INFO((KERN_INFO "loading CC2520 Kernel Module v%s...\n", DRIVER_VERSION)); | ||
|
||
err = cc2520_plat_gpio_init(); | ||
if (err) { | ||
|
@@ -69,7 +75,7 @@ int init_module() | |
err = cc2520_interface_init(); | ||
if (err) { | ||
ERR((KERN_ALERT "[cc2520] - char driver error. aborting.\n")); | ||
goto error5; | ||
goto error5; | ||
} | ||
|
||
err = cc2520_radio_init(); | ||
|
@@ -135,4 +141,4 @@ void cleanup_module() | |
|
||
MODULE_LICENSE("GPL"); | ||
MODULE_AUTHOR(DRIVER_AUTHOR); | ||
MODULE_DESCRIPTION(DRIVER_DESC); | ||
MODULE_DESCRIPTION(DRIVER_DESC); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.