?? tasklet.c
字號:
#include <rtl.h>#include <time.h>#include <linux/interrupt.h> /* for the tasklet macros/functions */#include <pthread.h>int myint_for_something=1;pthread_t thread;void tasklet_function(unsigned long);char tasklet_data[64];DECLARE_TASKLET(test_tasklet,tasklet_function, (unsigned long) &tasklet_data); void * start_routine(void *arg){ struct sched_param p; int i; p . sched_priority = 1; pthread_setschedparam (pthread_self(), SCHED_FIFO, &p); pthread_make_periodic_np (pthread_self(), gethrtime(), 500000000); i=0; while (1) { pthread_wait_np (); rtl_printf("RT-Thread; my arg is %x\n", (unsigned) arg); sprintf(tasklet_data,"%s \"%x\"", "Linux tasklet received RT-Thread arg", (unsigned) arg); tasklet_hi_schedule(&test_tasklet); i++; } return 0;} void tasklet_function(unsigned long data){ struct timeval now; do_gettimeofday(&now); printk("%s at %ld,%ld\n",(char *) data,now.tv_sec,now.tv_usec);} int init_module(void) { return pthread_create (&thread, NULL, start_routine, 0);}void cleanup_module(void) { pthread_delete_np(thread);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -