Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

linuxÄں˿ռäÉêÇ볬¹ý2MBÁ¬Ðø¿Õ¼äµÄʵÏÖº¯Êý¡£

 /*
kmalloc can apply 128KB memory only. This func support any continous memory allocate more than 2MB.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kallsyms.h>
#define KMEM_PAGES        //apply more than one page
#define KMEM_DEBUG        //debug message switch
/*
// Pure 2^n version of get_order
static __inline__ __attribute_const__ int get_order(unsigned long size)
{
    int order;
    size = (size - 1) >> (PAGE_SHIFT - 1);
    order = -1;
    do {
        size >>= 1;
        order++;
    } while (size);
    return order;
}
*/
/*
alloc memory for DMA using in kernel space.
*/
void *kmem_alloc(size_t size, dma_addr_t *dma_handle, unsigned long flags)
{
    struct page *page;        //start page address
    void *cpu_addr = NULL;        //cpu io address
    struct page *end;        //end of pages
    unsigned int  PageOrder=0;
    
    size = PAGE_ALIGN(size);    //must be times of 4KB
    PageOrder=get_order(size);
#ifdef CONFIG_ISOLATE_HIGHMEM        //allocate in high memory
    page = alloc_pages(GFP_HIGHUSER, PageOrder);
#else                                //allocate from low memory
    page = alloc_pages(GFP_KERNEL, PageOrder);        //get_order(size) means how many 4KB page do you want to apply. 2^n
#end


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

£¨L2CAPЭÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPЭÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼­Á¬½Ó¿ØÖƺÍÊÊÅäЭÒé (L2CAP) ΪÉϲãЭÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àЭÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãЭÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......

Linux Shell

 ShellÊÇϵͳµÄÓû§½çÃ棬ÌṩÁËÓû§ÓëÄں˽øÐн»»¥²Ù×÷µÄÒ»ÖÖ½Ó¿Ú¡£Ëü½ÓÊÕÓû§ÊäÈëµÄÃüÁî²¢°ÑËüËÍÈëÄÚºËÈ¥Ö´ÐС£
¡¡¡¡Êµ¼ÊÉÏShellÊÇÒ»¸öÃüÁî½âÊÍÆ÷£¬Ëü½âÊÍÓÉÓû§ÊäÈëµÄÃüÁî²¢ÇÒ°ÑËüÃÇË͵½Äںˡ£²»½öÈç´Ë£¬ShellÓÐ×Ô¼ºµÄ±à³ÌÓïÑÔÓÃÓÚ¶ÔÃüÁîµÄ±à¼­£¬ËüÔÊÐíÓû§±àдÓÉshellÃüÁî×é³ÉµÄ³ÌÐò¡£Shell±à³ÌÓïÑÔ¾ßÓÐÆÕͨ±à³ÌÓ ......

Linux±ØѧµÄ60¸öÃüÁî (ת)

inux±ØѧµÄ60¸öÃüÁî
LinuxÌṩÁË´óÁ¿µÄÃüÁÀûÓÃËü¿ÉÒÔÓÐЧµØÍê³É´óÁ¿µÄ¹¤×÷£¬Èç´ÅÅ̲Ù×÷¡¢Îļþ´æÈ¡¡¢Ä¿Â¼²Ù×÷¡¢½ø³Ì¹ÜÀí¡¢ÎļþȨÏÞÉ趨µÈ¡£ËùÒÔ£¬ÔÚLinuxϵͳÉϹ¤×÷Àë²»¿ªÊ¹ÓÃϵͳÌṩµÄÃüÁî¡£ÒªÏëÕæÕýÀí½âLinuxϵͳ£¬¾Í±ØÐë´ÓLinuxÃüÁîѧÆð£¬Í¨¹ý»ù´¡µÄÃüÁîѧϰ¿ÉÒÔ½øÒ»²½Àí½âLinuxϵͳ¡£
²»Í¬Linux·¢ÐаæµÄÃüÁîÊýÁ¿² ......

LinuxÄÚ´æ¹ÜÀíÖ®slab·ÖÅäÆ÷·ÖÎö(Ðø¶þ)

 Î壺kmem_cache_create£¨£©·ÖÎö
ÎÒÃÇÒÔÒ»¸öÀý×ÓÀ´¸ú×Ù·ÖÎöÒ»ÏÂslabµÄ»úÖÆ£º
ÏÂÃæÊÇÒ»¸ö²âÊÔÄ£¿éµÄ´úÂ룺
#include <linux/config.h>
#include <linux/module.h>
#include <linux/slab.h>
 
MODULE_LICENSE("GPL");
MODULE_AUTHOR("ericxiao <xgr178@163.com>");
MODULE_DESCRI ......

LinuxÏÂRPCµÄhello world

Linux ÏÂÃæʹÓÃRPCÐèҪʹÓõ½ÃüÁîrpcgen.
ÔÚLinuxÏ¿ª·¢RPC³ÌÐòÁ÷³ÌÈçÏ£º
1.дһ¸örpc³ÌÐò£¬
       Èçtest.x
2.ʹÓÃrpcgenÉú³É±ØÐëµÄÎļþ£¬Í¨³£ÊÇ¿Í»§¶ËºÍ·þÎñÆ÷¶ËÒÔ¼°Í·Îļþ
       $rpcgen test.x
3.ʹÓÃrpcgenÉú³É·þÎñÆ÷¶ËºÍ¿Í»§¶ËµÄCÓïÑÔ´úÂë
&n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ