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

📄 chap.8.interrupts.ps

📁 嵌入开发笔记 用ps阅读器打开
💻 PS
📖 第 1 页 / 共 5 页
字号:
1740(\256nished,)X2098(and)X2267(then)X2463(immediately)X2976(return)X3236(to)X3341(the)X3489(caller.)X3757(Thus,)X4002(another)X776 5699(subroutine)N1217(\(an)X1375(interrupt)X1742(service)X2050(routine)X2358(in)X2468(fact\))X2680(must)X2902(be)X3028(written)X3336(and)X3511(initialized)X3934(such)X4146(that)X776 5811(when)N1022(the)X1178(printer)X1473(interrupts)X1880(the)X2035(CPU,)X2282(it)X2373(is)X2474(invoked)X2821(and)X2997(will)X3184(print)X3403(the)X3558(next)X3761(character)X4152(and)X64 p%%Page: 64 712 s 0 xH 0 xS 1 f3 f576 400(57:017)N872(CIE)X1 f2329(-)X2385(64)X2505(-)X3 f3717(Lecture)X4062(Notes)X1 f776 803(enable)N1052(the)X1194(next)X1384(interrupt.)X576 943(The)N750(Printer)X1036(interface)X1398(is)X1486(assumed)X1841(to)X1940(consist)X2231(of:)X10 f576 1083(g)N1 f634(A)X727(Display)X1050(Control)X1368(and)X1531(Status)X1790(Register)X2135(\(DSPCS\))X776 1223(:)N872(A)X968(value)X1204(of)X1311(0x00)X1530(written)X1830(by)X1953(the)X2098(CPU)X2311(to)X2413(this)X2579(register)X2895(disables)X3232(the)X3378(printer)X3663(from)X3878(both)X4077(print-)X872 1335(ing)N1019(and)X1182(generating)X1613(interrupts.)X776 1475(:)N872(A)X965(value)X1199(of)X1304(0x41)X1521(tells)X1707(the)X1850(device)X2127(to)X2227(print)X2434(the)X2577(character)X2956(currently)X3329(in)X3429(DSPDATA,)X3919(and)X4083(when)X872 1587(done,)N1107(to)X1206(generate)X1557(an)X1672(interrupt)X2028(back)X2234(to)X2333(the)X2475(CPU.)X10 f576 1727(g)N1 f634(A)X727(Display)X1050(Data)X1256(Register)X1601(\(DSPDATA\))X776 1867(:)N872(This)X1068(register)X1382(is)X1471(written)X1769(to)X1869(by)X1990(the)X2133(CPU)X2344(and)X2508(will)X2683(contain)X2992(the)X3135(ASCII)X3411(code)X3619(for)X3757(the)X3901(next)X4093(char-)X872 1979(acter)N1084(to)X1183(be)X1298(printed)X1595(by)X1715(the)X1857(device.)X576 2119(We)N734(assume)X1041(the)X1183(two)X1351(registers)X1701(above)X1955(are)X2097(mapped)X2426(to)X2525(memory)X2870(locations)X3242(as)X3346(follows:)X776 2231(DSPCS)N1092(-)X1148(0x00FFF005)X776 2343(DSPDATA)N1241(-)X1297(0x00FFF007)X576 2483(Figure)N854(8.5)X1001(shows)X1267(the)X1412(entire)X1659(program)X2012(and)X2178(the)X2323(interface)X2689(needed)X2990(to)X3093(implement)X3534(the)X3680(overlapped)X4136(ver-)X576 2595(sion)N763(of)X7 f904(strout)X1 f1252(.)X1327(Note)X1541(\256rst,)X1741(that)X1913(the)X2057(main)X2276(program)X2628(is)X2718(nearly)X2985(identical)X3344(to)X3445(the)X3589(one)X3754(shown)X4030(in)X4131(Fig-)X576 2707(ure)N728(8.4.)X901(The)X1080(only)X1280(different)X1642(is)X1736(in)X1841(line)X2016(22,)X2166(where)X2431(the)X2579(interrupt)X2941(vector)X3212(table)X3430(location)X3771(for)X3913(this)X4082(inter-)X576 2819(rupt)N755(is)X843(initialized.)X1302(The)X1476(interrupt)X1832(vector)X2097(being)X2335(used)X2535(in)X2634(this)X2797(example)X3148(is)X3236(the)X3378(one)X3541(at)X3635(memory)X3980(location)X576 2931(0x00000020.)N776 3071(The)N951(declarations)X1442(and)X1606(de\256nes)X1903(in)X2003(lines)X2210(1-4)X2363(are)X2 f2506(global)X1 f2752(.)X2801(That)X3003(is,)X3116(they)X3308(are)X3452(accessible)X3869(and)X4034(visible)X576 3183(to)N679(all)X804(functions,)X1214(as)X1322(well)X1515(as)X1622(the)X1767(main)X1987(program.)X2364(The)X2541(variables)X7 f2950(sbusy)X1 f3240(,)X7 f3325(Ibufpnt)X1 f3731(,)X3782(and)X3948(the)X4093(array)X7 f576 3295(ibuf)N1 f833(are)X976(used)X1177(for)X1314(communication)X1939(between)X2286(the)X2430(two)X2600(functions)X2984(and)X3149(the)X3293(main)X3512(program.)X3912(The)X4088(func-)X576 3407(tion)N7 f795(strout)X1 f1177(``busy)X1456(waits'')X1757(on)X7 f1921(sbusy)X1 f2245(in)X2354(line)X2533(6)X2615(to)X2724(be)X2849(sure)X3043(that)X3222(there)X3449(is)X3547(not)X3704(still)X3883(a)X3960(previous)X576 3519(string)N825(being)X1069(processed.)X1527(Once)X1761(this)X1931(is)X2026(done,)X2268(a)X2342(copy)X2560(of)X2671(the)X2820(string)X3070(to)X3176(be)X3298(printed)X3602(is)X3697(made)X3937(in)X4043(line)X4219(7.)X576 3631(This)N774(is)X865(necessary)X1266(so)X1377(that)X1548(the)X1692(caller)X1933(of)X7 f2073(strout)X1 f2447(can)X2607(immediately)X3116(start)X3308(calculating)X3758(new)X3944(values)X4216(in)X7 f576 3743(DNA)N1 f783(as)X896(shown)X1179(in)X1287(line)X1465(24.)X7 f1652(bufpnt)X1 f2033(is)X2130(initalized)X2523(in)X2631(line)X2809(8)X2891(to)X3000(point)X3232(to)X3341(the)X3493(\256rst)X3676(character)X4064(in)X4173(the)X576 3855(string)N829(to)X938(be)X1063(printed.)X7 f1428(sbusy)X1 f1752(is)X1850(set)X1991(in)X2100(line)X2279(9)X2361(so)X2480(that)X2659(a)X2736(subsequent)X3197(call)X3371(to)X7 f3513(strout)X1 f3894(will)X4077(block)X576 3967(unless)N852(this)X1027(entire)X1283(string)X1538(has)X1702(been)X1920(printed.)X2277(\()X7 f2309(sbusy)X1 f2635(is)X2735(cleared)X3050(only)X3257(in)X7 f3403(strint)X1 f3788(after)X4002(the)X4157(last)X576 4079(character)N957(in)X7 f1092(ibuf)X1 f1350(has)X1504(been)X1712(printed\).)X2067(Finally,)X2390(in)X2491(lines)X2699(10-11,)X2973(the)X3117(character)X3497(to)X3598(be)X3715(printed)X4014(is)X4104(writ-)X576 4191(ten)N733(to)X847(the)X1004(display)X1321(data)X1521(register,)X1873(and)X2051(the)X2208(value)X2456(0x41)X2687(is)X2790(written)X3102(to)X3216(the)X3373(display)X3690(control)X4002(register)X576 4303(which)N848(tells)X1046(the)X1201(printer)X1494(to)X1605(begin)X1855(printing)X2196(the)X2350(character,)X2764(and)X2939(also)X3130(enables)X3455(an)X3582(interrupt)X3950(from)X4173(the)X576 4415(printer)N857(when)X1089(it)X1167(\(the)X1341(printer\))X1654(completes)X2069(printing)X2398(the)X2540(character)X2918(stored)X3177(in)X3276(DSPDATA.)X7 f776 4555(strint)N1 f1156(is)X1252(the)X1402(actual)X1665(interrupt)X2030(service)X2336(routine)X2642(that)X2820(is)X2917(invoked)X3260(everytime)X3679(the)X3830(printer)X4120(gen-)X576 4667(erates)N826(an)X942(interrupt)X1299(to)X1399(the)X1542(CPU.)X1777(The)X1952(routine)X2250(in)X2350(fact)X2520(only)X2716(checks)X3003(to)X3103(see)X3250(if)X3333(there)X3550(is)X3638(yet)X3780(another)X4093(char-)X576 4779(acter)N796(to)X903(print,)X1141(and)X1312(if)X1403(there)X1628(is,)X1748(it)X1834(does)X2042(so.)X2183(Otherwise,)X2634(it)X2720(disables)X3062(printing)X3400(and)X3572(clears)X7 f3864(sbusy)X1 f4154(.)X4211(In)X576 4891(line)N746(13,)X891(the)X1034(pointer)X1332(to)X1432(the)X1575(next)X1766(character)X2145(is)X2234(updated.)X2612(In)X2717(line)X2887(14,)X3032(the)X3175(character)X3554(is)X3643(checked)X3984(to)X4084(see)X4232(if)X576 5003(it)N657(is)X748(the)X893(NUL)X1117(\(string)X1395(termination\))X1899(character.)X2305(If)X2397(not,)X2572(then)X2766(there)X2987(is)X3079(another)X3396(character)X3778(to)X3881(print.)X4115(Oth-)X576 5115(erwise,)N889(the)X7 f1079(else)X1 f1349(clause)X1628(of)X1746(lines)X1966(18-19)X2228(sends)X2479(the)X2635(command)X3052(to)X3164(the)X3319(printer)X3613(\(0x00\))X3906(to)X4018(disable)X576 5227(printing)N905(and)X1068(further)X1354(interrupts,)X1771(and)X1934(also)X2113(clears)X7 f2396(sbusy)X1 f2686(.)X65 p%%Page: 65 812 s 0 xH 0 xS 1 f3 f576 400(57:017)N872(CIE)X1 f2329(-)X2385(65)X2505(-)X3 f3717(Lecture)X4062(Notes)X7 f576 851(1)N1152(#define)X1728 0.4062(STRINTVECaddr)AX2880 0.4167(0x00000020)AX576 1075(2)N1152(int)X1728(sbusy=0;)X576 1187(3)N1152(char)X1728 0.4125(ibuf[1000],)AX2424(*bufpnt,)X1728 1299 0.3929(*\(DSPDATA=0x00FFF007\),)AN3062 0.3947(*\(DSPCS=0x00FFF005\);)AX576 1411(4)N1152(unsigned)X1674(long)X2304 0.3929(*\(ivec=STRINTVECaddr\);)AX576 1635(5)N1152(void)X1442 0.4125(strout\(char)AX2138 0.4219(buffer[]\))AX2718({)X576 1747(6)N1728(while)X2076(\(sbusy\);)X576 1859(7)N1728 0.4038(strcpy\(buffer,)AX2598(ibuf\);)X576 1971(8)N1728(bufpnt)X2134(=)X2250(ibuf;)X576 2083(9)N1728(sbusy)X2076(=)X2192(1;)X576 2195(10)N1728(*DSPDATA)X2250(=)X2366(*bufpnt;)X576 2307(11)N1728(*DSPCS)X2134(=)X2250(0x41;)X1152 2419(})N576 2643(12)N1152(void)X1442(strint\(\))X1964({)X576 2755(13)N1728 0.4219(bufpnt++;)AX576 2867(14)N1728(if)X1902(\(*bufpnt)X2424(!=)X2598(0\))X2772({)X576 2979(15)N2304(*DSPDATA)X2826(=)X2942 0.4219(*bufpnt\);)AX576 3091(16)N2304(*DSPCS)X2710(=)X2826(0x41;)X3174(})X576 3203(17)N1728(else)X2018({)X576 3315(18)N2304(*DSPCS)X2710(=)X2826(0x00;)X576 3427(19)N2304(sbusy)X2652(=)X2768(0;)X2942(})X1152 3539(})N576 3763(20)N1152(main\(\))X1558({)X576 3875(21)N1728(char)X2018 0.4167(DNA[1000];)AX2656(int)X2888(i;)X576 4099(22)N1728(*ivec)X2076(=)X2192 0.4167(&strint\(\);)AX576 4323(23)N1728(for)X1960(\(i=0;)X2308 0.4167(i<1000000;)AX2946(i++\))X3236({)X576 4435(24)N2304(/*)X2478(Compute)X2942(a)X3058 0.4062(100-character)AX3870(strand)X4276(of)X4450(DNA)X4682(*/)X2304 4547(.)N2478(.)X2652(.)X2826(.)X1728 4659(/*)N1902(Output)X2308(the)X2540(string)X2946(\(maybe)X3352(to)X3526(disk\))X3874(*/)X576 4771(25)N1728 0.4091(strout\(DNA\);)AX2482(})X1040 4883(})N3 f1339 5043(Figure)N1636(8.5.)X1804(Interrupt-driven)X2516(string)X2780(printing)X3140(interface.)X576 5155(8.6.)N768(Details)X1075(of)X1179(M68000)X1534(Interrupt)X1947(Processing:)X2441(Before)X2738(and)X2916(After)X3159(Snapshots)X1 f776 5295(To)N916(better)X1169(understand)X1624(the)X1775(mechanics)X2215(of)X2328(how)X2526(interrupts)X2928(are)X3079(processed)X3491(consider)X3850(Figures)X4171(8.6)X576 5407(and)N742(8.7.)X937(In)X1044(Figure)X1322(8.6,)X1493(the)X1638(state)X1842(of)X1949(a)X2019(computer)X2410(\(memory)X2790(and)X2956(some)X3186(registers\))X3571(is)X3662(shown)X3939(just)X4104(prior)X576 5519(to)N681(a)X754(level)X972(4)X1050(interrupt.)X1460(Figure)X1741(8.7)X1891(shows)X2160(the)X2308(partial)X2585(state)X2792(of)X2902(the)X3050(computer)X3444(and)X3613(memory)X3964(immedi-)X576 5631(ately)N796(after)X1005(the)X1155(CPU)X1373(has)X1533(processed)X1944(the)X2094(interrupt)X2457(and)X2627(transferred)X3075(control)X3379(to)X3485(the)X3634(Interrupt)X4002(Service)X576 5743(Routine.)N66 p%%Page: 66 912 s 0 xH 0 xS 1 f3 f576 400(57:017)N872(CIE)X1 f2329(-)X2385(66)X2505(-)X3 f3717(Lecture)X4062(Notes)X1 f8 s1623 883 MXY270 0 Dl1835 897 MXY57 -14 Dl1835 868 MXY57 14 Dl1514 883 MXY-269 0 Dl1302 868 MXY-57 14 Dl1302 897 MXY-57 -14 Dl9 s1542 907(16)N18 s1542 1548(.)N1542 1589(.)N1542 1616(.)N1542 1670(.)N1542 1697(.)N1542 1724(.)N1542 1994(.)N1542 2021(.)N1542 2048(.)N1514 2642(.)N1514 2669(.)N1514 2696(.)N1514 2750(.)N1514 2777(.)N1514 2804(.)N1029 2642(.)N1029 2669(.)N1029 2696(.)N1029 2750(.)N1029 2777(.)N1029 2804(.)N1002 1994(.)N1002 2021(.)N1002 2048(.)N1002 1562(.)N1002 1589(.)N1002 1616(.)N1893 915 MXY0 323 Dl1245 996 MXY648 0 Dl1245 1104 MXY648 0 Dl1245 1212 MXY648 0 Dl1347 MY0 755 Dl1245 1428 MXY648 0 Dl1245 1536 MXY648 0 Dl1245 1644 MXY648 0 Dl1245 1752 MXY648 0 Dl1245 1860 MXY648 0 Dl1245 1968 MXY648 0 Dl1245 2076 MXY648 0 Dl1919 1428 MXY54 53 Dl

⌨️ 快捷键说明

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