驱动代码
dma.c
#include <linux/init.h>
#include <linux/module.h>
#include <linux/gfp.h>
#include <linux/mm.h>
MODULE_LICENSE("DUAL BSD/GPL");
static int __init alloc_pages_init(void);
static void __exit alloc_pages_exit(void);
struct page *pages = NULL;
int __init alloc_pages_init(void)
{
pages = alloc_pages(GFP_KERNEL, 3);
if(!pages)
return -ENOMEM;
else
{
printk(KERN_ALERT "alloc_pages Successfully!\n");
printk(KERN_ALERT "pages=0x%lx\n", (unsigned long)pages);
printk(KERN_ALERT "size of 'pages'=%ld\n", sizeof pages);
printk(KERN_ALERT "pages=0x%lx\n", pages);
printk(KERN_ALERT "mem_map = 0x%lx\n",(unsigned long)mem_map);
printk(KERN_ALERT "size of 'mem_map'=