⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chap.8.interrupts.ps

📁 嵌入开发笔记 用ps阅读器打开
💻 PS
📖 第 1 页 / 共 5 页
字号:
3624(able)X3818(to)X3926(cause)X4173(the)X576 1391(CPU)N795(to)X2 f903(interrupt)X1 f1278(the)X1429(processing)X1873(of)X1986(the)X2137(main)X2363(program)X2722(in)X2830(progress,)X3212(and)X3384(to)X2 f3492(immediately)X1 f3997(transfer)X576 1503(control)N898(to)X1022(the)X1189(appropriate)X1677(service)X1999(routine.)X2345(When)X2624(the)X2790(service)X3111(routine)X3432(is)X3544(completed,)X4018(control)X576 1615(transfers)N942(back)X1159(to)X2 f1269(wherever)X1662(the)X1815(program)X2185(was)X2369(when)X2608(it)X2698(was)X2883(interrupted)X1 f3316(.)X3376(That)X3589(point)X3823(can)X3993(be)X4120(any-)X576 1727(where)N844(in)X951(the)X1101(main)X1326(program.)X1708(In)X1820(the)X1970(example)X2329(of)X2441(Figure)X2724(8.2,)X2900(it)X2986(could)X3232(have)X3446(been)X3660(anywhere)X4066(in)X4173(the)X576 1839(main)N793(loop.)X3 f576 2063(8.4.)N768(How)X984(It)X1077(Works)X1378(\(From)X1664(20,000)X1952(Feet\))X1 f776 2203(The)N956(mechanism)X1425(of)X1535(interrupts,)X1958(as)X2068(described)X2467(so)X2582(far,)X2743(is)X2837(quite)X3060(simple.)X3371(The)X3552(details)X3835(of)X3946(how)X4142(it)X4227(is)X576 2315(made)N814(to)X918(work)X1143(are)X1289(somewhat)X1707(complex,)X2091(but)X2242(the)X2388(basic)X2614(mechanism)X3081(is)X3173(illustrated)X3587(in)X3690(Figure)X3969(8.3.)X4141(The)X576 2427(device,)N886(at)X990(the)X1142(moment)X1492(when)X1734(it)X1822(desires)X2123(service,)X2454(signals)X2755(the)X2907(CPU)X3127(with)X3332(it's)X3489(vector)X3764(number)X4092(\()X7 f4124(i)X1 f4216(in)X576 2539(Figure)N856(8.3\),)X1061(and)X1229(its)X1349(priority)X1667(\()X7 f1699(pri_i)X1 f2018(in)X2122(Figure)X2402(8.3\).)X2607(The)X2785(CPU)X2999(examines)X3391(its)X3510(current)X3811(priority,)X4152(and)X576 2651(if)N667(the)X817(priority)X1138(of)X1250(the)X1401(requesting)X1835(device)X2120(is)X2217(higher,)X2520(then)X2719(the)X2870(CPU)X3089(transfers)X3453(control)X3759(to)X3867(the)X4018(service)X576 2763(routine,)N903(but)X1056(only)X1257(after)X1463(making)X1781(a)X1853(note)X2048(of)X2157(the)X2304(address)X2621(where)X2885(it)X2968(is)X3061(currently)X3438(executing)X3842(instructions)X576 2875(\(somewhere)N1074(in)X1177(the)X7 f1357(main\(\))X1 f1733(program\).)X2167(Referring)X2564(to)X2667(Figure)X2946(8.3,)X3118(this)X3285(is)X3377(accomplished)X3936(when)X4173(the)X576 2987(CPU)N789(looks)X1024(in)X1126(memory)X1474(at)X1571(location)X7 f1942(vector_i)X1 f2432(and)X2597(\256nds)X2809(the)X2953(value)X7 f3222(st_addr)X1 f3628(.)X3678(It)X3763(then)X3955(jumps)X4216(to)X576 3099(the)N722(subroutine)X1156(found)X1408(at)X1506(that)X1679(location)X2019(which,)X2307(in)X2411(Figure)X2691(8.3,)X2864(is)X7 f2991 0.4018(service_routine)AX1 f3861(.)X3914(When)X4173(the)X576 3211(service)N879(routine)X1182(has)X1340(completed)X1772(execution,)X2201(the)X2349(CPU)X2564(transfer)X2887(control)X3189(back)X3400(to)X3504(the)X3651(address)X3968(that)X4142(was)X576 3323(noted)N814(earlier)X1085(by)X1205(the)X1347(CPU)X1557(when)X1789(the)X1931(interrupt)X2287(was)X2460(received.)X11 s2883 4573 MXY0 -1007 Dl3565 MY-432 0 Dl0 1007 Dl4573 MY432 0 Dl2020 5149 MXY0 -1583 Dl3565 MY-720 0 Dl0 1583 Dl5149 MY720 0 Dl3891 4141 MXY0 -576 Dl-576 0 Dl0 576 Dl576 0 Dl1300 3709 MXY720 0 Dl1300 3637 MXY720 0 Dl1300 4429 MXY720 0 Dl1300 3889 MXY720 0 Dl1300 3997(.)N1321(.)X1342(.)X1363(.)X1384(.)X(.)S1427(.)X1448(.)X1469(.)X1490(.)X(.)S1532(.)X(.)S1575(.)X1596(.)X1617(.)X1638(.)X(.)S1681(.)X1702(.)X1723(.)X1744(.)X(.)S1787(.)X1808(.)X1829(.)X1850(.)X(.)S1892(.)X(.)S1935(.)X1956(.)X1977(.)X1998(.)X(.)S1300 4213 MXY720 0 Dl1300 4717 MXY720 0 Dl2941 3695 MXY-57 14 Dl2941 3724 MXY-57 -14 Dl2883 3709 MXY432 0 Dl2941 3875 MXY-57 14 Dl2941 3904 MXY-57 -14 Dl2883 3889 MXY432 0 Dl2020 3997 MXY71 -72 Dl2020 3997 MXY71 72 Dl2379 3925 MXY72 72 Dl-72 72 Dl2056 3961 MXY360 0 Dl2056 4033 MXY360 0 Dl1300 4537(.)N1321(.)X1342(.)X1363(.)X1384(.)X(.)S1427(.)X1448(.)X1469(.)X1490(.)X(.)S1532(.)X(.)S1575(.)X1596(.)X1617(.)X1638(.)X(.)S1681(.)X1702(.)X1723(.)X1744(.)X(.)S1787(.)X1808(.)X1829(.)X1850(.)X(.)S1892(.)X(.)S1935(.)X1956(.)X1977(.)X1998(.)X(.)S12 s976 4499(st_addr:)N976 3709(vector)N1241(i:)X1480(st_addr)X1336 3961(main\(\))N16 s3387 3487(Device)N2523 3493(CPU)N1444(M)X1558(em)X1715(ory)X12 s1336 4507(service)N1633(routine)X3064 3673(`i')N2955 3997(`pri_i')N3 f1108 5376(Figure)N1405(8.3.)X1573(Basic)X1816(Elements)X2219(of)X2323(the)X2475(Interrupt)X2888(Processing)X3350(Sequence.)X1 f576 5536(For)N745(the)X899(programmer,)X1435(using)X1679(interrupts)X2084(in)X2195(an)X2322(application)X2787(requires)X3134(mostly)X3433(preparation.)X3933(Once)X4173(the)X576 5648(program)N929(is)X1020(properly)X1373(prepared,)X1761(however,)X2143(the)X2288(processing)X2726(is)X2817 0.2812(automatically)AX3369(handled)X3700(by)X3822(the)X3966(M68000)X576 5760(CPU)N786(in)X885(the)X1027(manner)X1340(just)X1503(described.)X1920(The)X2094(main)X2311(steps)X2527(in)X2626(the)X2 f2768(preparation)X1 f3251(are:)X63 p%%Page: 63 612 s 0 xH 0 xS 1 f3 f576 400(57:017)N872(CIE)X1 f2329(-)X2385(63)X2505(-)X3 f3717(Lecture)X4062(Notes)X1 f776 803(1.)N920(Physical)X1273(connection)X1723(of)X1830(the)X1975(device)X2254(to)X2357(the)X2503(CPU)X2717(so)X2830(that)X3003(when)X3239(it)X3321(needs)X3568(service,)X3893(the)X4039(device)X920 915(will)N1094(be)X1209(able)X1394(to)X1493(identify)X1817(itself)X2034(and)X2197(its)X2 f2312(priority)X1 f2630(to)X2729(the)X2871(CPU.)X776 1055(2.)N920(Create)X1211(an)X1341(interrupt)X1712(service)X2024(routine)X2337(\(e.g.,)X7 f2606 0.3929(service_hydraulic_leak)AX1 f3882(,)X3946(from)X4173(the)X920 1167(example)N1274(above\).)X1587(This)X1785(is)X1875(compiled)X2260(and)X2425(loaded)X2708(with)X2905(your)X3107(main)X3326(program)X3678(just)X3843(as)X3949(a)X4018(normal)X920 1279(subroutine)N1360(would)X1634(be.)X1783(However,)X2193(your)X2403(main)X2630(program)X2990(will)X3174(not)X3332(contain)X3651(any)X2 f3825(calls)X1 f4042(to)X4152(this)X920 1391(service)N1217(routine.)X776 1531(3.)N920(Finally,)X1244(the)X1389(CPU)X1602(must)X1816(know)X2 f2056(where)X1 f2318(to)X2421(\256nd)X2598(the)X2744(service)X3045(routine)X3346(when)X3582(the)X3728(device)X4008(noti\256es)X920 1643(it)N999(that)X1169(a)X1237(device)X1514(has)X1667(generated)X2066(an)X2181(interrupt.)X2585(This)X2780(is)X2868(done)X3079(via)X3221(the)X2 f3363(interrupt)X3729(vector)X3994(table)X1 f4211(as)X920 1755(shown)N1195(in)X1295(Figure)X1571(8.3.)X1740(Literally,)X2122(this)X2287(is)X2377(a)X2446(table)X2660(in)X2761(the)X2905(low)X3075(address)X3389(portion)X3693(of)X3799(memory)X4146(that)X920 1867(contains)N1269(the)X1415(starting)X1732(addresses)X2127(for)X2266(the)X2411(interrupt)X2770(service)X3070(routines)X3407(for)X3546(each)X3750(of)X3857(the)X4002(devices)X920 1979(that)N1090(may)X1282(generate)X1635(an)X1752(interrupt.)X2158(Therefore,)X2 f2588(prior)X1 f2811(to)X2912(the)X3056(\256rst)X3231(interrupt)X3589(from)X3802(a)X3871(device,)X4173(the)X920 2091(address)N1236(of)X1344(the)X1489(interrupt)X1848(service)X2148(routine)X2448(for)X2587(the)X2732(device)X3011(must)X3225(be)X3343(stored)X3605(in)X3707(the)X3852(appropriate)X920 2203(location)N1255(in)X1354(the)X1496(vector)X1761(table.)X3 f576 2427(8.5.)N768(Ef\256ciency)X1198(Example:)X1617(DNA)X1848(Sequencing)X1 f776 2567(We)N937(now)X1129(illustrate)X1494(quantitatively,)X2076(the)X2222(bene\256t)X2512(of)X2620(interrupts)X3017(for)X3157(improving)X3586(the)X3732(ef\256ciency)X4140(of)X4248(a)X576 2679(computer.)N995(Our)X1175(example)X1533(will)X1714(be)X1836(the)X1985(generation)X2423(of)X2534(1)X2612(million)X2921(strings)X3207(of)X3317(DNA,)X3578(each)X3785(1000)X4007(charac-)X576 2791(ters)N741(long,)X962(then)X1154(printing)X1485(them)X1704(out.)X1877(In)X1983(fact,)X2178(each)X2381(string)X2626(will)X2802(be)X2919(printed)X3219(right)X3428(after)X3632(it)X3713(is)X3804(computed)X4211(or)X576 2903(generated.)N1023(Consider)X1394(the)X1536(main)X1753(program)X2103(of)X2207(Figure)X2482(8.4.)X7 f1152 3063(main\(\))N1558({)X1152 3175(char)N1442 0.4167(DNA[1000];)AX1152 3287(int)N1384(i;)X1152 3511(for)N1384(\(i=0;)X1732 0.4167(i<1000000;)AX2370(i++\))X2660({)X1728 3623(/*)N1902(Compute)X2366(a)X2482 0.4062(100-character)AX3294(strand)X3700(of)X3874(DNA)X4106(*/)X2304 3735(.)N2478(.)X2652(.)X2826(.)X1728 3847(/*)N1902(Output)X2308(the)X2540(string)X2946(\(maybe)X3352(to)X3526(disk\))X3874(*/)X1728 3959 0.4091(strout\(DNA\);)AN1152 4071(}})N3 f1429 4279(Figure)N1726(8.4.)X1894(DNA)X2125(String)X2405(Generation)X2894(and)X3072(Printing.)X1 f576 4439(For)N756(the)X921(example)X1295(of)X1422(Figure)X1720(8.4,)X1911(assume)X2242(that)X2435(the)X2601(computation)X3131(of)X3259(one)X3446(1000-character)X4072(string)X576 4551(requires)N922(5)X1006(seconds,)X1370(and)X1545(that)X1726(the)X1880(outputting)X2312(of)X2428(one)X2603(character)X2993(requires)X3339(about)X3588(3)X3671(msecs.)X3965(Thus,)X4216(to)X576 4663(print)N798(1000)X1030(characters)X1461(requires)X1812(3)X1901(seconds.)X2270(Therefore,)X2715(if)X2815(executed)X3199(in)X3315(the)X3474(obvious)X3819(manner,)X4173(the)X576 4775(entire)N829(loop)X1033(body)X1258(will)X1441(require)X1747(8)X1828(seconds,)X2189(and)X2361(the)X2512(processing)X2956(and)X3127(outputting)X3555(of)X3667(1000000)X4035(strings)X576 4887(will)N754(require)X1056(approximately)X2 f1642(92)X1767(days)X1 f(!.)S2028(However,)X2433(if)X2521(we)X2662(could)X2905(overlap)X3223(the)X3370(printing)X3704(of)X3813(the)X3960(previous)X576 4999(string)N837(with)X1050(the)X1210(computation)X1734(of)X1856(the)X2016(next)X2224(string,)X2509(the)X2669(loop)X2882(will)X3074(only)X3287(take)X3490(a)X3575(little)X3795(more)X4035(than)X4243(5)X576 5111(seconds)N911(on)X1038(each)X1246(iteration,)X1623(for)X1766(a)X1840(total)X2044(of)X2156(only)X2359(57)X2487(days.)X2743(Thus,)X2991(a)X3066(little)X3276(more)X3506(than)X3704(a)X2 f3779(month)X1 f4051(of)X4163(run)X576 5223(time)N772(might)X1021(be)X1136(saved)X1379(for)X1515(this)X1678(application.)X576 5363(The)N750(void)X945(function)X7 f1324(strout)X1 f1696(shown)X1970(above)X2224(must)X2435(be)X2550(written)X2847(to)X2946(have)X3152(the)X3294(following)X3692(behavior:)X776 5475(When)N1030(called,)X7 f1343(strout)X1 f1715(must)X1926(initiate)X2219(the)X2361(printing)X2690(of)X2794(the)X2937(\256rst)X3111(character,)X3514(enable)X3791(the)X3934(printer)X4216(to)X776 5587(interrupt)N1138(the)X1286(CPU)X1502(when)X

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -