Source: http://gliethttp.cublog.cn
Linux to based I / O mapping of the I / O port and memory mapping approach based on I / O port resources, collectively referred to as I / O Region). I / O Region is still an I / O resources, it can still be used to describe the type of resource structure.
Linux is an inverted tree structure to manage each type of I / O resources (such as: I / O ports, peripheral memory, DMA and IRQ) for. each type of I / O resources are the resources corresponding to have an inverted tree, each node in the tree is a resource structure, and tree the root of the root of such resources is described in the resource space.
1. structure
1.1> struct resource iomem_resource = {1.2> struct resource {
const char * name;
unsigned long start, end;
unsigned long flags;
struct resource * parent, * sibling,
christian louboutin boutique, * child;
2. Call function
request_mem_region (S1D_PHYSICAL_REG_ADDR, S1D_PHYSICAL_REG_SIZE, Check for safe occupancy after the start physical address S1D_PHYSICAL_REG_ADDR S1D_PHYSICAL_REG_SIZE consecutive bytes of space struct resource * __request_region (struct resource * parent, unsigned long start, unsigned long n, const char * name) struct resource * res = kmalloc (sizeof ( * res), GFP_KERNEL); if (res) {memset (res, 0, sizeof (* res)); res-> name = name; res-> start = start; res-> end = start + n - 1; res-> flags = IORESOURCE_BUSY; write_lock (& resource_lock); for (;;) {struct resource * conflict; conflict = __request_resource (parent, res); / / sibling parent under all unit test for partial the existence of overlapping conflicts if (! conflict) / / conflict = 0; application is successful, the normal placement of the [start, end] to the corresponding position break; if (conflict! = parent) {parent = conflict; if (! (conflict- > flags & IORESOURCE_BUSY)) continue; kfree (res); / / resource overlap conflict is detected, kfree application for the return kmalloc memory res = NULL; break; write_unlock (& resource_lock); return res; static struct resource * __request_resource (struct resource * root, struct resource * new) unsigned long start = new-> start; unsigned long end = new-> end; struct resource * tmp, ** p; if (end start) return root; if (end> root-> end) return root; p = & root-> child; / / root element under the first list * p . [child list is based on I / O resources, physical address from low to high in the order of] for (;;) {tmp = * p; if (! tmp | | tmp-> start> end) {new- > sibling = tmp; * p = new; / / from root-> child = null begin our analysis, then tmp = null, then the first applications will be! tmp conditions are met, and enter / / this time root-> child the value of new indicators,
Man, who after being struck by lightning pictograph similar pattern (Figure ), new-> sibling = tmp = null; When the second application occurs: If the tmp-> start> end set up, / / then, root-> child's new pointer value, new-> sibling = tmp; This link, and spatial distribution,
infrared air force 1, such as: / / child = [start, end ]-->[ tmp-> start, tmp-> end] (1); If the conditions tmp-> start> end does not hold, then only! tmp conditions of access / / Well,
jordans shoes, root-> child the value of the constant, tmp-> sibling = new; new-> sibling = tmp = null This link, and spatial distribution, such as: / / child = [child-> start,
air max 91 6 -year-old Hmong girl suffering from strange dis, child-> end ]-->[ start, end] (2); / / When the first time of three applications: If you start in (2) of the [child-> end, end], between then tmp-> end start slibing = null, / / because the tmp-> end> start, so the resource conflict, return ( 2) the [start, end] domain / / sum of the two boundary conditions and a median value of the analysis, we can see a code to address to high address from the order of list / / model diagram: childe = [a, b ]-->[ c, d ]-->[ e, f], then there is a [x,
cheap jordans shoes, y] to be inserted into, tmp as a sibling pointer swimming / / tmp point to the child = [ ,
buy cheap supra shoes,],[> [c, d ]-->[ e, f] -> null; when tmp-> end> = x, the conflict to return tmp / / tmp point to [c, d], if tmp-> ; start> y, insert the link after the photo: child = [a, b ]-->[ x, y ]-->[ c, d ]-->[ e, f] -> ; null; when tmp-> end> = x, the conflict to return tmp / / tmp point to [e, f], if tmp-> start> y, insert the link after the photo: child = [a, b ]-->[ c, d ]-->[ x, y ]-->[ e, f] -> null; when tmp-> end> = x, the conflict to return tmp / / tmp point to null, insert the link after the photo: child = [a, b ]-->[ c, d ]-->[ e, f ]-->[ x, y] -> null ; / / smooth to the detection of conflict, the purpose of the order link new-> parent = root; return NULL; p = & tmp-> sibling; if (tmp-> end <start) continue; return tmp ; article from CSDN blog, reproduced, please credit: http://
HW: test the water to enter the electronic education market Baidu response: three days to deal with all written documents and Baidu infringement battle of two artists who YouTube or re-position joint venture co-founder of Google founders Page start next month, got rid of bureaucracy as CEO of the multi-threading capabilities Silverlight (below) using Myisamchk medical examination of the MySQL tables Silverlight 2.5D RPG gaming skills and effects processing: (vii) Animated Feature Tour VS2010 test function: coded UI test (4) - the way by writing test code create UI tests (below) for more articles ... China-pub Knowledge of computer books online store! 65,000 varieties of 2 - 8 off,
女童失踪8天后被神秘送回 其父欣喜若狂跌倒! China-Pub-demand printing services computer print books under the request_mem_region rough understanding of linux android developer (4) bootloader (1) linux driver (17) mobile developer (1) my linux device driver (1) 2011 年 3 months ( 6) February 2011 (2) January 2011 (7) December 2010 (5) November 2010 (2) October 2010 (8) August 2010 (3) 1. Android JNI Knowledge About (824) 2. Android Development Notes Programming Example of a NDK (511) 3. Linux device driver development environment set up (turn) (273) 4. socket and multi-thread programming b
asics portability (transfer) (221) 5. Android TQ2440 development board in the transfer (transfer) (203) 1. Android JNI Knowledge About (0) 2. Android Development Notes Programming Example of a NDK (0) 3. Android development board in the TQ2440 transplantation (transfer) (0) 4. ARM assembler programming (0) 5. c language static usage summary (0) 1. Linux device driver layer design (transfer) (63) 2. platform_device and platform_driver (47) 3. S3C2440 RTC clock on driven development example to explain (to) http://hbhuanggang.cublog.cn (30) 4. ic_card Driver Development (7) 5. static Usage (4)